@readme/stylelint-config 3.1.19 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +78 -0
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -17,6 +17,16 @@ module.exports = {
17
17
  'stylelint-prettier/recommended',
18
18
  ],
19
19
  rules: {
20
+ // Until we migrate *all* our repos away from legacy node-sass to dart sass,
21
+ // we must continue defining alpha values with decimal numbers. Node-sass
22
+ // has its own "rgb" and "rgba" funcitons. These get compiled and fails to
23
+ // parse percentage values appropriately, e.g. rgba(0,0,0,50%) gets compiled
24
+ // to rgb(0,0,0).
25
+ //
26
+ // This rule forces us to continue using decimal numbers for alpha value.
27
+ // e.g. rgba(0, 0, 0, 0.015)
28
+ 'alpha-value-notation': 'number',
29
+
20
30
  // ReadMe relies on legacy color functions (e.g. rgba(0, 0, 0, 0.5))
21
31
  // everywhere in addition to Scss allowing this to be written with a color
22
32
  // name (e.g. rgba(black, 0.5)). Eventually, consider removing this rule to
@@ -27,9 +37,77 @@ module.exports = {
27
37
  // ReadMe still uses color names as values in many places.
28
38
  'color-named': null,
29
39
 
40
+ // Extend the existing rule for our custom CSS props and make an exception
41
+ // for legacy CSS names like "--lightGray" and "--minimumGray" since
42
+ // customers may still be defining these in their custom stylesheets.
43
+ 'custom-property-pattern': [
44
+ '^(([A-Z]+)?([A-Z][a-z0-9]+)+|([a-z][a-z0-9]*))((-[a-z0-9]+)*|Gray)$',
45
+ {
46
+ message:
47
+ 'Expected custom property name to be kebab-case and optionally prefixed with TitleCase or ALLCAPSTitleCase, e.g. "text-color", "MyComponent-text-color", "APIAuthInput-text-color.',
48
+ },
49
+ ],
50
+
30
51
  // ReadMe breaks this rule in many places.
31
52
  'max-nesting-depth': null,
32
53
 
54
+ // Allows us to write duplicate selectors in groups
55
+ // https://github.com/stylelint/stylelint/issues/3196
56
+ 'no-descending-specificity': [
57
+ true,
58
+ {
59
+ ignore: ['selectors-within-list'],
60
+ },
61
+ ],
62
+
63
+ // Extend from existing rule to allow additional sections that are specific
64
+ // to our project such as dark-theme mixins, etc.
65
+ // https://github.com/bjankord/stylelint-config-sass-guidelines/blob/main/index.js#L50
66
+ 'order/order': [
67
+ [
68
+ {
69
+ // Always place custom mixin definitions at the very top to ensure they
70
+ // are defined before any references below it.
71
+ type: 'at-rule',
72
+ name: 'mixin',
73
+ },
74
+ 'custom-properties',
75
+ {
76
+ // Allow "@mixin {prefix}-dark-mode" directly after custom props
77
+ // section to support defining dark-mode styles inside a mixin that
78
+ // can be invoked in multiple places.
79
+ type: 'at-rule',
80
+ name: 'mixin',
81
+ parameter: '-dark-mode$',
82
+ },
83
+ {
84
+ // Allow "@include dark-mode" directly after custom props section to
85
+ // support our dark-mode pattern as documented here:
86
+ // https://next.readme.ninja/ui/#/Core/Themes
87
+ type: 'at-rule',
88
+ name: 'include',
89
+ parameter: '^dark-mode$',
90
+ },
91
+ 'dollar-variables',
92
+ {
93
+ type: 'at-rule',
94
+ name: 'extend',
95
+ },
96
+ {
97
+ type: 'at-rule',
98
+ name: 'include',
99
+ hasBlock: false,
100
+ },
101
+ 'declarations',
102
+ {
103
+ type: 'at-rule',
104
+ name: 'include',
105
+ hasBlock: true,
106
+ },
107
+ 'rules',
108
+ ],
109
+ ],
110
+
33
111
  // Custom regex of ReadMe's current BEM selector class pattern.
34
112
  'selector-class-pattern': [
35
113
  '^[a-zA-Z0-9]+((_|-)([a-zA-Z0-9]+))*$',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readme/stylelint-config",
3
- "version": "3.1.19",
3
+ "version": "3.2.0",
4
4
  "description": "ReadMe coding standards for styles",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -33,8 +33,8 @@
33
33
  "stylelint": "^14.6.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@readme/eslint-config": "^10.6.0",
36
+ "@readme/eslint-config": "^10.6.1",
37
37
  "jest": "^29.4.3"
38
38
  },
39
- "gitHead": "d5156c4843a480d106e06c711e9d76bb2570aeb2"
39
+ "gitHead": "4b53a9bdf9efd6006033bf34656dc7a3da321d65"
40
40
  }