forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.stylelintrc.mjs
45 lines (43 loc) · 1.51 KB
/
.stylelintrc.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// These are all the custom `@` (at) rules that we use within our custom PostCSS plugins
const CUSTOM_AT_RULES = [
// Tailwind-specific at-rules
'apply',
'layer',
'responsive',
'screen',
'tailwind',
'variants',
// PostCSS-specific at-rules
'define-mixin',
'mixin',
];
// Enforces certain selectors to be only in camelCase notation
// We use these for id selectors and classname selectors
const ONLY_ALLOW_CAMEL_CASE_SELECTORS = [
/^(?:[a-z]+(?:[A-Z][a-z]*)*)$/,
{ message: s => `Expected '${s}' to be in camelCase` },
];
export default {
extends: ['stylelint-config-standard'],
plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],
rules: {
// Enforces Element Class Names to be camelCase
'selector-class-pattern': ONLY_ALLOW_CAMEL_CASE_SELECTORS,
// Enforces Element IDs to be camelCase
'selector-id-pattern': ONLY_ALLOW_CAMEL_CASE_SELECTORS,
// Allow Tailwind-based CSS Rules
'at-rule-no-unknown': [true, { ignoreAtRules: CUSTOM_AT_RULES }],
// Allow the Global CSS Selector
'selector-pseudo-class-no-unknown': [
true,
{ ignorePseudoClasses: ['global'] },
],
// Enforces the order of the CSS properties to be in alphabetical order
'order/properties-alphabetical-order': true,
'no-descending-specificity': null,
// Disables the Level-4 Media Queries; Since they're more exotic and less known
'media-feature-range-notation': 'prefix',
// Adopts the import notation from `postcss-import`
'import-notation': 'string',
},
};