@wistia/eslint-config 0.15.0 → 0.16.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.
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  plugins: ['stylelint-prettier'],
3
- extends: ['stylelint-config-standard', 'stylelint-config-prettier'].map(require.resolve),
3
+ extends: ['../../rules/stylelint/css', 'stylelint-config-prettier'].map(require.resolve),
4
4
  rules: {
5
5
  // prettier configuration
6
6
  'prettier/prettier': true,
@@ -1,8 +1,7 @@
1
- // see: https://github.com/stylelint-scss/stylelint-config-standard-scss/blob/main/index.js
2
-
3
1
  module.exports = {
4
2
  plugins: ['stylelint-prettier', 'stylelint-scss'],
5
- extends: ['stylelint-config-standard-scss', '../../rules/stylelint/scss'].map(require.resolve),
3
+ extends: ['../../rules/stylelint/css', '../../rules/stylelint/scss'].map(require.resolve),
4
+ customSyntax: require('postcss-scss'),
6
5
  rules: {
7
6
  // prettier configuration
8
7
  'prettier/prettier': true,
@@ -1,11 +1,16 @@
1
1
  module.exports = {
2
- plugins: ['stylelint-prettier', 'stylelint-declaration-block-no-ignored-properties'],
2
+ plugins: [
3
+ 'stylelint-prettier',
4
+ 'stylelint-scss',
5
+ 'stylelint-declaration-block-no-ignored-properties',
6
+ ],
3
7
  extends: [
4
- 'stylelint-config-standard-scss',
8
+ '../../rules/stylelint/css',
9
+ '../../rules/stylelint/scss',
5
10
  '../../rules/stylelint/styled-components',
6
11
  'stylelint-config-prettier',
7
12
  ].map(require.resolve),
8
- customSyntax: 'postcss-scss',
13
+ customSyntax: require('postcss-scss'),
9
14
  processors: ['stylelint-processor-styled-components'],
10
15
  rules: {
11
16
  // prettier configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "main": "react.js",
6
6
  "exports": {
@@ -27,46 +27,43 @@
27
27
  "test:stylelint": "stylelint --print-config ./test/index.js"
28
28
  },
29
29
  "dependencies": {
30
- "@babel/core": "^7.18.10",
31
- "@babel/eslint-parser": "^7.18.9",
30
+ "@babel/core": "^7.19.6",
31
+ "@babel/eslint-parser": "^7.19.1",
32
32
  "@babel/preset-react": "^7.18.6",
33
- "@rushstack/eslint-patch": "^1.1.4",
34
- "@typescript-eslint/eslint-plugin": "^5.35.1",
35
- "@typescript-eslint/parser": "^5.35.1",
33
+ "@rushstack/eslint-patch": "^1.2.0",
34
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
35
+ "@typescript-eslint/parser": "^5.41.0",
36
36
  "confusing-browser-globals": "^1.0.11",
37
- "eslint": "^8.21.0",
37
+ "eslint": "^8.26.0",
38
38
  "eslint-config-prettier": "^8.5.0",
39
- "eslint-import-resolver-typescript": "^3.4.0",
39
+ "eslint-import-resolver-typescript": "^3.5.2",
40
40
  "eslint-plugin-better-styled-components": "^1.1.2",
41
41
  "eslint-plugin-cypress": "^2.12.1",
42
42
  "eslint-plugin-filenames": "^1.3.2",
43
43
  "eslint-plugin-import": "^2.26.0",
44
- "eslint-plugin-jest": "^27.0.1",
44
+ "eslint-plugin-jest": "^27.1.3",
45
45
  "eslint-plugin-jest-dom": "^4.0.2",
46
46
  "eslint-plugin-jest-formatting": "^3.1.0",
47
47
  "eslint-plugin-jsx-a11y": "^6.6.1",
48
- "eslint-plugin-no-only-tests": "^3.0.0",
48
+ "eslint-plugin-no-only-tests": "^3.1.0",
49
49
  "eslint-plugin-no-snapshot-testing": "^1.0.61",
50
50
  "eslint-plugin-node": "^11.1.0",
51
51
  "eslint-plugin-prettier": "^4.2.1",
52
- "eslint-plugin-promise": "^6.0.0",
53
- "eslint-plugin-react": "^7.30.1",
52
+ "eslint-plugin-promise": "^6.1.1",
53
+ "eslint-plugin-react": "^7.31.10",
54
54
  "eslint-plugin-react-hooks": "^4.6.0",
55
55
  "eslint-plugin-sonarjs": "^0.16.0",
56
56
  "eslint-plugin-styled-components-a11y": "^1.0.0",
57
- "eslint-plugin-testing-library": "^5.6.0",
58
- "postcss": "^8.4.16",
59
- "postcss-scss": "^4.0.4",
57
+ "eslint-plugin-testing-library": "^5.9.1",
58
+ "postcss": "^8.4.18",
59
+ "postcss-scss": "^4.0.5",
60
60
  "prettier": "^2.7.1",
61
- "stylelint": "^14.9.1",
61
+ "stylelint": "^14.14.0",
62
62
  "stylelint-config-prettier": "^9.0.3",
63
- "stylelint-config-standard": "^29.0.0",
64
- "stylelint-config-standard-scss": "^5.0.0",
65
- "stylelint-declaration-block-no-ignored-properties": "^2.5.0",
63
+ "stylelint-declaration-block-no-ignored-properties": "^2.6.0",
66
64
  "stylelint-prettier": "^2.0.0",
67
65
  "stylelint-processor-styled-components": "^1.10.0",
68
- "stylelint-scss": "^4.3.0",
69
- "typescript": "4.7.4"
66
+ "stylelint-scss": "^4.3.0"
70
67
  },
71
68
  "devDependencies": {
72
69
  "@commitlint/cli": "^17.0.3",
@@ -74,7 +71,8 @@
74
71
  "check-export-map": "^1.3.0",
75
72
  "husky": "^8.0.1",
76
73
  "jest": "^29.0.2",
77
- "jest-specific-snapshot": "^5.0.0"
74
+ "jest-specific-snapshot": "^5.0.0",
75
+ "typescript": "4.7.4"
78
76
  },
79
77
  "engines": {
80
78
  "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -0,0 +1,221 @@
1
+ // only add rules pertaining to css
2
+
3
+ module.exports = {
4
+ rules: {
5
+ // https://github.com/stylelint/stylelint-config-recommended/blob/main/index.js
6
+ // 'annotation-no-unknown': true,
7
+ 'at-rule-no-unknown': true,
8
+ 'block-no-empty': true,
9
+ 'color-no-invalid-hex': true,
10
+ 'comment-no-empty': true,
11
+ 'custom-property-no-missing-var-function': true,
12
+ 'declaration-block-no-duplicate-custom-properties': true,
13
+ 'declaration-block-no-duplicate-properties': [
14
+ true,
15
+ {
16
+ ignore: ['consecutive-duplicates-with-different-values'],
17
+ },
18
+ ],
19
+ 'declaration-block-no-shorthand-property-overrides': true,
20
+ 'font-family-no-duplicate-names': true,
21
+ 'font-family-no-missing-generic-family-keyword': true,
22
+ 'function-calc-no-unspaced-operator': true,
23
+ 'function-linear-gradient-no-nonstandard-direction': true,
24
+ 'function-no-unknown': true,
25
+ 'keyframe-block-no-duplicate-selectors': true,
26
+ 'keyframe-declaration-no-important': true,
27
+ 'media-feature-name-no-unknown': true,
28
+ 'named-grid-areas-no-invalid': true,
29
+ 'no-descending-specificity': true,
30
+ 'no-duplicate-at-import-rules': true,
31
+ 'no-duplicate-selectors': true,
32
+ 'no-empty-source': true,
33
+ 'no-extra-semicolons': true,
34
+ 'no-invalid-double-slash-comments': true,
35
+ 'no-invalid-position-at-import-rule': true,
36
+ 'no-irregular-whitespace': true,
37
+ 'property-no-unknown': true,
38
+ 'selector-pseudo-class-no-unknown': true,
39
+ 'selector-pseudo-element-no-unknown': true,
40
+ 'selector-type-no-unknown': [
41
+ true,
42
+ {
43
+ ignore: ['custom-elements'],
44
+ },
45
+ ],
46
+ 'string-no-newline': true,
47
+ 'unit-no-unknown': true,
48
+
49
+ // https://github.com/stylelint/stylelint-config-standard/blob/main/index.js
50
+ 'alpha-value-notation': [
51
+ 'percentage',
52
+ {
53
+ exceptProperties: [
54
+ 'opacity',
55
+ 'fill-opacity',
56
+ 'flood-opacity',
57
+ 'stop-opacity',
58
+ 'stroke-opacity',
59
+ ],
60
+ },
61
+ ],
62
+ 'at-rule-empty-line-before': [
63
+ 'always',
64
+ {
65
+ except: ['blockless-after-same-name-blockless', 'first-nested'],
66
+ ignore: ['after-comment'],
67
+ },
68
+ ],
69
+ 'at-rule-name-case': 'lower',
70
+ 'at-rule-name-space-after': 'always-single-line',
71
+ '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
+ 'color-function-notation': 'modern',
81
+ 'color-hex-case': 'lower',
82
+ 'color-hex-length': 'short',
83
+ 'comment-empty-line-before': [
84
+ 'always',
85
+ {
86
+ except: ['first-nested'],
87
+ ignore: ['stylelint-commands'],
88
+ },
89
+ ],
90
+ 'comment-whitespace-inside': 'always',
91
+ 'custom-property-empty-line-before': [
92
+ 'always',
93
+ {
94
+ except: ['after-custom-property', 'first-nested'],
95
+ ignore: ['after-comment', 'inside-single-line-block'],
96
+ },
97
+ ],
98
+ 'custom-media-pattern': [
99
+ '^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
100
+ {
101
+ message: (name) => `Expected custom media query name "${name}" to be kebab-case`,
102
+ },
103
+ ],
104
+ 'custom-property-pattern': [
105
+ '^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
106
+ {
107
+ message: (name) => `Expected custom property name "${name}" to be kebab-case`,
108
+ },
109
+ ],
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
+ '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
+ 'declaration-empty-line-before': [
122
+ 'always',
123
+ {
124
+ except: ['after-declaration', 'first-nested'],
125
+ ignore: ['after-comment', 'inside-single-line-block'],
126
+ },
127
+ ],
128
+ '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
+ 'function-name-case': 'lower',
134
+ 'function-parentheses-newline-inside': 'always-multi-line',
135
+ 'function-parentheses-space-inside': 'never-single-line',
136
+ 'function-url-quotes': 'always',
137
+ 'function-whitespace-after': 'always',
138
+ 'hue-degree-notation': 'angle',
139
+ 'import-notation': 'url',
140
+ indentation: 2,
141
+ // 'keyframe-selector-notation': 'percentage-unless-within-keyword-only-block',
142
+ 'keyframes-name-pattern': [
143
+ '^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
144
+ {
145
+ message: (name) => `Expected keyframe name "${name}" to be kebab-case`,
146
+ },
147
+ ],
148
+ 'length-zero-no-unit': true,
149
+ 'max-empty-lines': 1,
150
+ 'max-line-length': 120,
151
+ 'media-feature-colon-space-after': 'always',
152
+ 'media-feature-colon-space-before': 'never',
153
+ 'media-feature-name-case': 'lower',
154
+ 'media-feature-name-no-vendor-prefix': true,
155
+ 'media-feature-parentheses-space-inside': 'never',
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',
165
+ 'number-max-precision': 4,
166
+ 'number-no-trailing-zeros': true,
167
+ 'property-case': 'lower',
168
+ 'property-no-vendor-prefix': true,
169
+ 'rule-empty-line-before': [
170
+ 'always-multi-line',
171
+ {
172
+ except: ['first-nested'],
173
+ ignore: ['after-comment'],
174
+ },
175
+ ],
176
+ 'selector-attribute-brackets-space-inside': 'never',
177
+ 'selector-attribute-operator-space-after': 'never',
178
+ 'selector-attribute-operator-space-before': 'never',
179
+ 'selector-attribute-quotes': 'always',
180
+ 'selector-class-pattern': [
181
+ '^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
182
+ {
183
+ message: (selector) => `Expected class selector "${selector}" to be kebab-case`,
184
+ },
185
+ ],
186
+ 'selector-combinator-space-after': 'always',
187
+ 'selector-combinator-space-before': 'always',
188
+ 'selector-descendant-combinator-no-non-space': true,
189
+ 'selector-id-pattern': [
190
+ '^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
191
+ {
192
+ message: (selector) => `Expected id selector "${selector}" to be kebab-case`,
193
+ },
194
+ ],
195
+ 'selector-list-comma-newline-after': 'always',
196
+ 'selector-list-comma-space-before': 'never',
197
+ 'selector-max-empty-lines': 0,
198
+ 'selector-no-vendor-prefix': true,
199
+ '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
+ 'selector-pseudo-element-colon-notation': 'double',
204
+ 'selector-type-case': 'lower',
205
+ 'shorthand-property-no-redundant-values': true,
206
+ 'string-quotes': 'double',
207
+ 'unit-case': 'lower',
208
+ '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
+ 'value-no-vendor-prefix': [
214
+ true,
215
+ {
216
+ // `-webkit-box` is allowed as standard. See https://www.w3.org/TR/css-overflow-3/#webkit-line-clamp
217
+ ignoreValues: ['box'],
218
+ },
219
+ ],
220
+ },
221
+ };
@@ -2,34 +2,91 @@
2
2
 
3
3
  module.exports = {
4
4
  rules: {
5
- // disallow vendor prefixes
6
- 'at-rule-no-vendor-prefix': true,
7
- 'property-no-vendor-prefix': true,
8
- 'selector-no-vendor-prefix': true,
9
- 'value-no-vendor-prefix': true,
10
-
11
- // prefer single to double quotes for better js compat
12
- 'string-quotes': 'single',
13
-
14
- // *** DISABLED RULES ***
15
- // too many violations to fix so we just allow any pattern
16
- 'selector-class-pattern': '[a-zA-Z0-9]',
17
- 'selector-id-pattern': '[a-zA-Z0-9]',
5
+ // adjust/disable some rules from css that cause issues
6
+ // 'annotation-no-unknown': [
7
+ // true,
8
+ // {
9
+ // ignoreAnnotations: ['default', 'global'],
10
+ // },
11
+ // ],
12
+ 'at-rule-no-unknown': null,
13
+ 'at-rule-empty-line-before': [
14
+ 'always',
15
+ {
16
+ except: ['blockless-after-blockless', 'first-nested'],
17
+ ignore: ['after-comment'],
18
+ ignoreAtRules: ['else'],
19
+ },
20
+ ],
21
+ 'block-closing-brace-newline-after': [
22
+ 'always',
23
+ {
24
+ ignoreAtRules: ['if', 'else'],
25
+ },
26
+ ],
27
+ 'function-no-unknown': null,
28
+ 'import-notation': 'string',
29
+ 'no-invalid-position-at-import-rule': [
30
+ true,
31
+ {
32
+ ignoreAtRules: ['use', 'forward'],
33
+ },
34
+ ],
18
35
 
19
36
  // unfortunately these conflict with sass functions; hopefully someday we will be able to enable
20
37
  'color-function-notation': null,
21
38
  'alpha-value-notation': null,
22
39
 
23
- // thousands of these errors, not realistically fixable
24
- 'no-descending-specificity': null,
25
-
26
- // TODO: enable this?
27
- 'no-duplicate-selectors': null,
28
-
40
+ 'scss/at-else-closing-brace-newline-after': 'always-last-in-chain',
41
+ 'scss/at-else-closing-brace-space-after': 'always-intermediate',
42
+ 'scss/at-else-empty-line-before': 'never',
43
+ 'scss/at-else-if-parentheses-space-before': 'always',
44
+ 'scss/at-function-parentheses-space-before': 'never',
45
+ 'scss/at-function-pattern': [
46
+ '^(-?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',
47
+ {
48
+ message: 'Expected function name to be kebab-case',
49
+ },
50
+ ],
51
+ 'scss/at-if-closing-brace-newline-after': 'always-last-in-chain',
52
+ 'scss/at-if-closing-brace-space-after': 'always-intermediate',
53
+ 'scss/at-mixin-argumentless-call-parentheses': 'never',
54
+ 'scss/at-mixin-parentheses-space-before': 'never',
55
+ 'scss/at-rule-conditional-no-parentheses': true,
56
+ 'scss/dollar-variable-colon-space-after': 'always',
57
+ 'scss/dollar-variable-colon-space-before': 'never',
58
+ 'scss/dollar-variable-empty-line-before': [
59
+ 'always',
60
+ {
61
+ except: ['after-dollar-variable', 'first-nested'],
62
+ ignore: ['after-comment', 'inside-single-line-block'],
63
+ },
64
+ ],
65
+ 'scss/double-slash-comment-empty-line-before': [
66
+ 'always',
67
+ {
68
+ except: ['first-nested'],
69
+ ignore: ['between-comments', 'stylelint-commands'],
70
+ },
71
+ ],
29
72
  'scss/at-extend-no-missing-placeholder': null,
73
+ 'scss/at-if-no-null': true,
74
+ 'scss/at-import-no-partial-leading-underscore': true,
75
+ 'scss/at-import-partial-extension': 'never',
30
76
  'scss/at-mixin-pattern': null,
77
+ 'scss/at-rule-no-unknown': true,
78
+ 'scss/comment-no-empty': true,
79
+ 'scss/declaration-nested-properties-no-divided-groups': true,
80
+ 'scss/dollar-variable-no-missing-interpolation': true,
31
81
  'scss/dollar-variable-pattern': null,
82
+ 'scss/double-slash-comment-whitespace-inside': 'always',
83
+ 'scss/function-quote-no-quoted-strings-inside': true,
84
+ 'scss/function-unquote-no-unquoted-strings-inside': true,
85
+ 'scss/no-duplicate-mixins': true,
32
86
  'scss/no-global-function-names': null,
87
+ 'scss/operator-no-newline-after': true,
88
+ 'scss/operator-no-newline-before': true,
89
+ 'scss/operator-no-unspaced': true,
33
90
  'scss/percent-placeholder-pattern': null,
34
91
  },
35
92
  };
@@ -17,6 +17,8 @@ module.exports = {
17
17
  // these selectors are used as placeholders by styled-components preprocessor
18
18
  'selector-type-case': ['lower', { ignoreTypes: ['$dummyValue'] }],
19
19
  'selector-type-no-unknown': [true, { ignoreTypes: ['$dummyValue', '/^-styled-/'] }],
20
+ // prefer single to double quotes for better js compat
21
+ 'string-quotes': 'single',
20
22
  'value-keyword-case': [
21
23
  'lower',
22
24
  { ignoreKeywords: [/dummyValue/], ignoreProperties: [/dummyValue/] },