@wistia/eslint-config 0.18.0 → 0.19.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.
- package/configs/eslint/react.js +1 -1
- package/configs/eslint/typescript-react.js +6 -1
- package/configs/stylelint/scss.js +5 -1
- package/configs/stylelint/styled-components.js +2 -8
- package/package.json +2 -2
- package/rules/eslint/typescript.js +1 -1
- package/rules/stylelint/css.js +13 -71
- package/rules/stylelint/styled-components.js +2 -10
package/configs/eslint/react.js
CHANGED
|
@@ -12,5 +12,10 @@ module.exports = {
|
|
|
12
12
|
es2022: true,
|
|
13
13
|
},
|
|
14
14
|
|
|
15
|
-
extends: [
|
|
15
|
+
extends: [
|
|
16
|
+
'../../rules/eslint/react',
|
|
17
|
+
'../../rules/eslint/react-a11y',
|
|
18
|
+
'../../rules/eslint/react-hooks',
|
|
19
|
+
'../../rules/eslint/typescript-react',
|
|
20
|
+
].map(require.resolve),
|
|
16
21
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
plugins: ['stylelint-prettier', 'stylelint-scss'],
|
|
3
|
-
extends: [
|
|
3
|
+
extends: [
|
|
4
|
+
'../../rules/stylelint/css',
|
|
5
|
+
'../../rules/stylelint/scss',
|
|
6
|
+
'stylelint-config-prettier',
|
|
7
|
+
].map(require.resolve),
|
|
4
8
|
customSyntax: require('postcss-scss'),
|
|
5
9
|
rules: {
|
|
6
10
|
// prettier configuration
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
plugins: [
|
|
3
|
-
'stylelint-prettier',
|
|
4
|
-
'stylelint-scss',
|
|
5
|
-
'stylelint-declaration-block-no-ignored-properties',
|
|
6
|
-
],
|
|
2
|
+
plugins: ['stylelint-prettier', 'stylelint-declaration-block-no-ignored-properties'],
|
|
7
3
|
extends: [
|
|
8
4
|
'../../rules/stylelint/css',
|
|
9
|
-
'../../rules/stylelint/scss',
|
|
10
5
|
'../../rules/stylelint/styled-components',
|
|
11
6
|
'stylelint-config-prettier',
|
|
12
7
|
].map(require.resolve),
|
|
13
|
-
customSyntax: require('postcss-
|
|
14
|
-
processors: ['stylelint-processor-styled-components'],
|
|
8
|
+
customSyntax: require('postcss-styled-syntax'),
|
|
15
9
|
rules: {
|
|
16
10
|
// prettier configuration
|
|
17
11
|
'prettier/prettier': true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"main": "react.js",
|
|
6
6
|
"exports": {
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"eslint-plugin-testing-library": "^5.10.2",
|
|
63
63
|
"postcss": "^8.4.21",
|
|
64
64
|
"postcss-scss": "^4.0.6",
|
|
65
|
+
"postcss-styled-syntax": "^0.4.0",
|
|
65
66
|
"prettier": "^2.8.7",
|
|
66
67
|
"stylelint": "^15.4.0",
|
|
67
68
|
"stylelint-config-prettier": "^9.0.5",
|
|
68
69
|
"stylelint-declaration-block-no-ignored-properties": "^2.7.0",
|
|
69
70
|
"stylelint-prettier": "^3.0.0",
|
|
70
|
-
"stylelint-processor-styled-components": "^1.10.0",
|
|
71
71
|
"stylelint-scss": "^4.6.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
@@ -546,7 +546,7 @@ module.exports = {
|
|
|
546
546
|
'@typescript-eslint/no-magic-numbers': [
|
|
547
547
|
'error',
|
|
548
548
|
{
|
|
549
|
-
ignore: [-1, 0, 1, 2, 3, 4, 5, 100,
|
|
549
|
+
ignore: [-1, 0, 1, 2, 3, 4, 5, 100, 1024, 1000, 10000],
|
|
550
550
|
ignoreArrayIndexes: true,
|
|
551
551
|
ignoreDefaultValues: true,
|
|
552
552
|
ignoreTypeIndexes: true,
|
package/rules/stylelint/css.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
rules: {
|
|
5
|
-
// https://github.com/stylelint/stylelint-config-recommended/blob/main/index.js
|
|
6
|
-
|
|
5
|
+
// https://github.com/stylelint/stylelint-config-recommended/blob/main/index.js#L5
|
|
6
|
+
'annotation-no-unknown': true,
|
|
7
7
|
'at-rule-no-unknown': true,
|
|
8
8
|
'block-no-empty': true,
|
|
9
9
|
'color-no-invalid-hex': true,
|
|
@@ -30,11 +30,11 @@ module.exports = {
|
|
|
30
30
|
'no-duplicate-at-import-rules': true,
|
|
31
31
|
'no-duplicate-selectors': true,
|
|
32
32
|
'no-empty-source': true,
|
|
33
|
-
'no-extra-semicolons': true,
|
|
34
33
|
'no-invalid-double-slash-comments': true,
|
|
35
34
|
'no-invalid-position-at-import-rule': true,
|
|
36
35
|
'no-irregular-whitespace': true,
|
|
37
36
|
'property-no-unknown': true,
|
|
37
|
+
'selector-anb-no-unmatchable': true,
|
|
38
38
|
'selector-pseudo-class-no-unknown': true,
|
|
39
39
|
'selector-pseudo-element-no-unknown': true,
|
|
40
40
|
'selector-type-no-unknown': [
|
|
@@ -46,7 +46,7 @@ module.exports = {
|
|
|
46
46
|
'string-no-newline': true,
|
|
47
47
|
'unit-no-unknown': true,
|
|
48
48
|
|
|
49
|
-
// https://github.com/stylelint/stylelint-config-standard/blob/main/index.js
|
|
49
|
+
// https://github.com/stylelint/stylelint-config-standard/blob/main/index.js#L5
|
|
50
50
|
'alpha-value-notation': [
|
|
51
51
|
'percentage',
|
|
52
52
|
{
|
|
@@ -66,19 +66,8 @@ module.exports = {
|
|
|
66
66
|
ignore: ['after-comment'],
|
|
67
67
|
},
|
|
68
68
|
],
|
|
69
|
-
'at-rule-name-case': 'lower',
|
|
70
|
-
'at-rule-name-space-after': 'always-single-line',
|
|
71
69
|
'at-rule-no-vendor-prefix': true,
|
|
72
|
-
'at-rule-semicolon-newline-after': 'always',
|
|
73
|
-
'block-closing-brace-empty-line-before': 'never',
|
|
74
|
-
'block-closing-brace-newline-after': 'always',
|
|
75
|
-
'block-closing-brace-newline-before': 'always-multi-line',
|
|
76
|
-
'block-closing-brace-space-before': 'always-single-line',
|
|
77
|
-
'block-opening-brace-newline-after': 'always-multi-line',
|
|
78
|
-
'block-opening-brace-space-after': 'always-single-line',
|
|
79
|
-
'block-opening-brace-space-before': 'always',
|
|
80
70
|
'color-function-notation': 'modern',
|
|
81
|
-
'color-hex-case': 'lower',
|
|
82
71
|
'color-hex-length': 'short',
|
|
83
72
|
'comment-empty-line-before': [
|
|
84
73
|
'always',
|
|
@@ -107,17 +96,7 @@ module.exports = {
|
|
|
107
96
|
message: (name) => `Expected custom property name "${name}" to be kebab-case`,
|
|
108
97
|
},
|
|
109
98
|
],
|
|
110
|
-
'declaration-bang-space-after': 'never',
|
|
111
|
-
'declaration-bang-space-before': 'always',
|
|
112
|
-
'declaration-block-semicolon-newline-after': 'always-multi-line',
|
|
113
|
-
'declaration-block-semicolon-space-after': 'always-single-line',
|
|
114
|
-
'declaration-block-semicolon-space-before': 'never',
|
|
115
|
-
'declaration-block-single-line-max-declarations': 1,
|
|
116
|
-
'declaration-block-trailing-semicolon': 'always',
|
|
117
99
|
'declaration-block-no-redundant-longhand-properties': true,
|
|
118
|
-
'declaration-colon-newline-after': 'always-multi-line',
|
|
119
|
-
'declaration-colon-space-after': 'always-single-line',
|
|
120
|
-
'declaration-colon-space-before': 'never',
|
|
121
100
|
'declaration-empty-line-before': [
|
|
122
101
|
'always',
|
|
123
102
|
{
|
|
@@ -126,45 +105,26 @@ module.exports = {
|
|
|
126
105
|
},
|
|
127
106
|
],
|
|
128
107
|
'font-family-name-quotes': 'always-where-recommended',
|
|
129
|
-
'function-comma-newline-after': 'always-multi-line',
|
|
130
|
-
'function-comma-space-after': 'always-single-line',
|
|
131
|
-
'function-comma-space-before': 'never',
|
|
132
|
-
'function-max-empty-lines': 0,
|
|
133
108
|
'function-name-case': 'lower',
|
|
134
|
-
'function-parentheses-newline-inside': 'always-multi-line',
|
|
135
|
-
'function-parentheses-space-inside': 'never-single-line',
|
|
136
109
|
'function-url-quotes': 'always',
|
|
137
|
-
'function-whitespace-after': 'always',
|
|
138
110
|
'hue-degree-notation': 'angle',
|
|
139
111
|
'import-notation': 'url',
|
|
140
|
-
|
|
141
|
-
// 'keyframe-selector-notation': 'percentage-unless-within-keyword-only-block',
|
|
112
|
+
'keyframe-selector-notation': 'percentage-unless-within-keyword-only-block',
|
|
142
113
|
'keyframes-name-pattern': [
|
|
143
114
|
'^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
|
|
144
115
|
{
|
|
145
116
|
message: (name) => `Expected keyframe name "${name}" to be kebab-case`,
|
|
146
117
|
},
|
|
147
118
|
],
|
|
148
|
-
'length-zero-no-unit':
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
119
|
+
'length-zero-no-unit': [
|
|
120
|
+
true,
|
|
121
|
+
{
|
|
122
|
+
ignore: ['custom-properties'],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
154
125
|
'media-feature-name-no-vendor-prefix': true,
|
|
155
|
-
'media-feature-
|
|
156
|
-
'media-feature-range-operator-space-after': 'always',
|
|
157
|
-
'media-feature-range-operator-space-before': 'always',
|
|
158
|
-
'media-query-list-comma-newline-after': 'always-multi-line',
|
|
159
|
-
'media-query-list-comma-space-after': 'always-single-line',
|
|
160
|
-
'media-query-list-comma-space-before': 'never',
|
|
161
|
-
'no-empty-first-line': true,
|
|
162
|
-
'no-eol-whitespace': true,
|
|
163
|
-
'no-missing-end-of-source-newline': true,
|
|
164
|
-
'number-leading-zero': 'always',
|
|
126
|
+
'media-feature-range-notation': 'prefix',
|
|
165
127
|
'number-max-precision': 4,
|
|
166
|
-
'number-no-trailing-zeros': true,
|
|
167
|
-
'property-case': 'lower',
|
|
168
128
|
'property-no-vendor-prefix': true,
|
|
169
129
|
'rule-empty-line-before': [
|
|
170
130
|
'always-multi-line',
|
|
@@ -173,9 +133,6 @@ module.exports = {
|
|
|
173
133
|
ignore: ['after-comment'],
|
|
174
134
|
},
|
|
175
135
|
],
|
|
176
|
-
'selector-attribute-brackets-space-inside': 'never',
|
|
177
|
-
'selector-attribute-operator-space-after': 'never',
|
|
178
|
-
'selector-attribute-operator-space-before': 'never',
|
|
179
136
|
'selector-attribute-quotes': 'always',
|
|
180
137
|
'selector-class-pattern': [
|
|
181
138
|
'^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
|
|
@@ -183,38 +140,23 @@ module.exports = {
|
|
|
183
140
|
message: (selector) => `Expected class selector "${selector}" to be kebab-case`,
|
|
184
141
|
},
|
|
185
142
|
],
|
|
186
|
-
'selector-combinator-space-after': 'always',
|
|
187
|
-
'selector-combinator-space-before': 'always',
|
|
188
|
-
'selector-descendant-combinator-no-non-space': true,
|
|
189
143
|
'selector-id-pattern': [
|
|
190
144
|
'^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
|
|
191
145
|
{
|
|
192
146
|
message: (selector) => `Expected id selector "${selector}" to be kebab-case`,
|
|
193
147
|
},
|
|
194
148
|
],
|
|
195
|
-
'selector-list-comma-newline-after': 'always',
|
|
196
|
-
'selector-list-comma-space-before': 'never',
|
|
197
|
-
'selector-max-empty-lines': 0,
|
|
198
149
|
'selector-no-vendor-prefix': true,
|
|
199
150
|
'selector-not-notation': 'complex',
|
|
200
|
-
'selector-pseudo-class-case': 'lower',
|
|
201
|
-
'selector-pseudo-class-parentheses-space-inside': 'never',
|
|
202
|
-
'selector-pseudo-element-case': 'lower',
|
|
203
151
|
'selector-pseudo-element-colon-notation': 'double',
|
|
204
152
|
'selector-type-case': 'lower',
|
|
205
153
|
'shorthand-property-no-redundant-values': true,
|
|
206
|
-
'string-quotes': 'double',
|
|
207
|
-
'unit-case': 'lower',
|
|
208
154
|
'value-keyword-case': 'lower',
|
|
209
|
-
'value-list-comma-newline-after': 'always-multi-line',
|
|
210
|
-
'value-list-comma-space-after': 'always-single-line',
|
|
211
|
-
'value-list-comma-space-before': 'never',
|
|
212
|
-
'value-list-max-empty-lines': 0,
|
|
213
155
|
'value-no-vendor-prefix': [
|
|
214
156
|
true,
|
|
215
157
|
{
|
|
216
158
|
// `-webkit-box` is allowed as standard. See https://www.w3.org/TR/css-overflow-3/#webkit-line-clamp
|
|
217
|
-
ignoreValues: ['box'],
|
|
159
|
+
ignoreValues: ['box', 'inline-box'],
|
|
218
160
|
},
|
|
219
161
|
],
|
|
220
162
|
},
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
rules: {
|
|
5
|
+
// unfortunately this causes false positives
|
|
6
|
+
'block-no-empty': null,
|
|
5
7
|
// in css-in-js when variables are being passed around, this rule
|
|
6
8
|
// often leads to less readable code, even though it is more compact
|
|
7
9
|
'declaration-block-no-redundant-longhand-properties': null,
|
|
@@ -14,17 +16,7 @@ module.exports = {
|
|
|
14
16
|
// prevent snake case from being used for class/id selectors but be otherwise flexible
|
|
15
17
|
'selector-class-pattern': '^[a-zA-Z0-9-]+(-[a-zA-Z0-9]+)*$',
|
|
16
18
|
'selector-id-pattern': '^[a-zA-Z0-9-]+(-[a-zA-Z0-9]+)*$',
|
|
17
|
-
// these selectors are used as placeholders by styled-components preprocessor
|
|
18
|
-
'selector-type-case': ['lower', { ignoreTypes: ['$dummyValue'] }],
|
|
19
|
-
'selector-type-no-unknown': [true, { ignoreTypes: ['$dummyValue', '/^-styled-/'] }],
|
|
20
19
|
// prefer single to double quotes for better js compat
|
|
21
20
|
'string-quotes': 'single',
|
|
22
|
-
'value-keyword-case': [
|
|
23
|
-
'lower',
|
|
24
|
-
{ ignoreKeywords: [/dummyValue/], ignoreProperties: [/dummyValue/] },
|
|
25
|
-
],
|
|
26
|
-
// styled-components adds vendor prefixes if necessary so we should avoid adding them in code
|
|
27
|
-
'value-no-vendor-prefix': true,
|
|
28
|
-
'property-no-vendor-prefix': true,
|
|
29
21
|
},
|
|
30
22
|
};
|