linter-bundle 2.18.0 → 2.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/CHANGELOG.md +19 -0
- package/eslint/index.js +1 -1
- package/eslint/overrides-jest.js +1 -0
- package/package.json +12 -12
- package/stylelint/index.js +1 -1
- package/stylelint/plugins/stylelint-high-performance-animation.js +109 -106
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
8
8
|
|
|
9
9
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.18.0...HEAD)
|
|
10
10
|
|
|
11
|
+
## [2.19.0] - 2022.08.28
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [eslint] Updated `@typescript-eslint` from `5.33.1` to `5.35.1`
|
|
16
|
+
- [eslint] Updated `eslint` from `8.22.0` to `8.23.0`
|
|
17
|
+
- [eslint] Updated `eslint-import-resolver-typescript` from `3.4.2` to `3.5.0`
|
|
18
|
+
- [eslint] Updated `eslint-plugin-jest` from `26.8.3` to `26.9.0`
|
|
19
|
+
- [eslint] Updated `eslint-plugin-promise` from `6.0.0` to `6.0.1`
|
|
20
|
+
- [eslint] Updated `eslint-plugin-react` from `7.30.1` to `7.31.1`
|
|
21
|
+
- [markdownlint] Updated `markdownlint-cli` from `0.32.1` to `0.32.2`
|
|
22
|
+
- [stylelint] Updated `stylelint` from `14.10.0` to `14.11.0`
|
|
23
|
+
- [eslint] Activate [`allowEmptyCase`](https://github.com/eslint/eslint/blob/main/docs/src/rules/no-fallthrough.md#allowemptycase) option of `no-fallthrough` rule
|
|
24
|
+
- [stylelint] Activate [`ignoreAfterCombinators: ['>', '+']`](https://stylelint.io/user-guide/rules/list/selector-max-universal/#ignoreaftercombinators-array-of-combinators) of `selector-max-universal` rule, see [this issue](https://github.com/stylelint/stylelint/issues/5792) for details
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- [eslint/overrides-jest] Make use of [jest/prefer-each](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-each.md) rule
|
|
29
|
+
|
|
11
30
|
## [2.18.0] - 2022.08.19
|
|
12
31
|
|
|
13
32
|
### Changed
|
package/eslint/index.js
CHANGED
|
@@ -173,7 +173,7 @@ module.exports = {
|
|
|
173
173
|
'no-extend-native': 'error',
|
|
174
174
|
'no-extra-bind': 'error',
|
|
175
175
|
'no-extra-label': 'error',
|
|
176
|
-
'no-fallthrough': 'error',
|
|
176
|
+
'no-fallthrough': ['error', { allowEmptyCase: true }],
|
|
177
177
|
'no-floating-decimal': 'error',
|
|
178
178
|
'no-global-assign': 'error',
|
|
179
179
|
'no-implicit-coercion': ['error', { disallowTemplateShorthand: true }],
|
package/eslint/overrides-jest.js
CHANGED
|
@@ -97,6 +97,7 @@ module.exports = {
|
|
|
97
97
|
'jest/prefer-hooks-in-order': 'error',
|
|
98
98
|
'jest/prefer-hooks-on-top': 'error',
|
|
99
99
|
'jest/prefer-comparison-matcher': 'error',
|
|
100
|
+
'jest/prefer-each': 'error',
|
|
100
101
|
'jest/prefer-equality-matcher': 'error',
|
|
101
102
|
'jest/prefer-mock-promise-shorthand': 'error',
|
|
102
103
|
'jest/prefer-snapshot-hint': 'error',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linter-bundle",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -40,26 +40,26 @@
|
|
|
40
40
|
"check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
44
|
-
"@typescript-eslint/parser": "5.
|
|
45
|
-
"eslint": "8.
|
|
46
|
-
"eslint-import-resolver-typescript": "3.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "5.35.1",
|
|
44
|
+
"@typescript-eslint/parser": "5.35.1",
|
|
45
|
+
"eslint": "8.23.0",
|
|
46
|
+
"eslint-import-resolver-typescript": "3.5.0",
|
|
47
47
|
"eslint-import-resolver-webpack": "0.13.2",
|
|
48
48
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
49
49
|
"eslint-plugin-functional": "4.2.2",
|
|
50
50
|
"eslint-plugin-import": "2.26.0",
|
|
51
|
-
"eslint-plugin-jest": "26.
|
|
51
|
+
"eslint-plugin-jest": "26.9.0",
|
|
52
52
|
"eslint-plugin-jsdoc": "39.3.6",
|
|
53
53
|
"eslint-plugin-jsx-a11y": "6.6.1",
|
|
54
54
|
"eslint-plugin-node": "11.1.0",
|
|
55
|
-
"eslint-plugin-promise": "6.0.
|
|
56
|
-
"eslint-plugin-react": "7.
|
|
55
|
+
"eslint-plugin-promise": "6.0.1",
|
|
56
|
+
"eslint-plugin-react": "7.31.1",
|
|
57
57
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
58
58
|
"eslint-plugin-unicorn": "43.0.2",
|
|
59
|
-
"markdownlint-cli": "0.32.
|
|
59
|
+
"markdownlint-cli": "0.32.2",
|
|
60
60
|
"micromatch": "4.0.5",
|
|
61
61
|
"postcss-scss": "4.0.4",
|
|
62
|
-
"stylelint": "14.
|
|
62
|
+
"stylelint": "14.11.0",
|
|
63
63
|
"stylelint-declaration-block-no-ignored-properties": "2.5.0",
|
|
64
64
|
"stylelint-order": "5.0.0",
|
|
65
65
|
"stylelint-scss": "4.3.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/eslint": "8.4.6",
|
|
75
75
|
"@types/micromatch": "4.0.2",
|
|
76
|
-
"@types/node": "18.7.
|
|
76
|
+
"@types/node": "18.7.13",
|
|
77
77
|
"stylelint-find-new-rules": "4.0.0",
|
|
78
|
-
"typescript": "4.
|
|
78
|
+
"typescript": "4.8.2"
|
|
79
79
|
}
|
|
80
80
|
}
|
package/stylelint/index.js
CHANGED
|
@@ -290,7 +290,7 @@ module.exports = {
|
|
|
290
290
|
}
|
|
291
291
|
],
|
|
292
292
|
'selector-max-type': 6,
|
|
293
|
-
'selector-max-universal': 1,
|
|
293
|
+
'selector-max-universal': [1, { ignoreAfterCombinators: ['>', '+'] }],
|
|
294
294
|
'selector-nested-pattern': null,
|
|
295
295
|
'selector-no-qualifying-type': [true, { ignore: ['attribute', 'class'] }],
|
|
296
296
|
'selector-no-vendor-prefix': true,
|
|
@@ -122,12 +122,12 @@ const propsThatCausePaint = [
|
|
|
122
122
|
];
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
|
-
* Get
|
|
125
|
+
* Get disallowed properties.
|
|
126
126
|
*
|
|
127
127
|
* @param {string} ignore - Property name.
|
|
128
|
-
* @returns {string[]} - Array of
|
|
128
|
+
* @returns {string[]} - Array of disallowed properties.
|
|
129
129
|
*/
|
|
130
|
-
const
|
|
130
|
+
const getDisallowedList = (ignore) => {
|
|
131
131
|
if (ignore === 'paint-properties') {
|
|
132
132
|
return propertiesThatCauseLayout;
|
|
133
133
|
}
|
|
@@ -146,128 +146,131 @@ const getBlacklist = (ignore) => {
|
|
|
146
146
|
*/
|
|
147
147
|
const unprefixed = (property) => property.replace(/^-\w+-/u, '');
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Rule function.
|
|
151
|
+
*
|
|
152
|
+
* @param {Record<string, any>} actual - Primary options
|
|
153
|
+
* @param {Record<string, any>} options - Secondary options
|
|
154
|
+
* @returns {(root: import('postcss').Root, result: import('stylelint').PostcssResult) => Promise<void> | void} PostCSS plugin
|
|
155
|
+
*/
|
|
156
|
+
const ruleFunction = (actual, options) => (cssRoot, result) => {
|
|
157
|
+
const validOptions = stylelint.utils.validateOptions(
|
|
158
|
+
result,
|
|
159
|
+
ruleName,
|
|
160
|
+
{ actual },
|
|
161
|
+
{
|
|
162
|
+
actual: options,
|
|
163
|
+
possible: {
|
|
164
|
+
ignore: ['paint-properties'],
|
|
165
|
+
ignoreProperties: [isString]
|
|
166
|
+
},
|
|
167
|
+
optional: true
|
|
168
|
+
}
|
|
169
|
+
);
|
|
165
170
|
|
|
166
|
-
|
|
171
|
+
if (!validOptions) { return; }
|
|
167
172
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// @ts-expect-error -- Property 'ignoreProperties' comes from an index signature, so it must be accessed with ['ignoreProperties'].
|
|
171
|
-
const ignored = options.ignoreProperties ?? [];
|
|
173
|
+
const disallowedList = getDisallowedList(options['ignore']);
|
|
174
|
+
const ignored = options['ignoreProperties'] ?? [];
|
|
172
175
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
cssRoot.walkDecls('transition-property', (decl) => {
|
|
177
|
+
valueParser(decl.value).walk((node) => {
|
|
178
|
+
const value = unprefixed(node.value);
|
|
176
179
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
if (
|
|
181
|
+
node.type === 'word' &&
|
|
182
|
+
!ignored.includes(value) &&
|
|
183
|
+
(disallowedList.includes(value) || value === 'all')
|
|
184
|
+
) {
|
|
185
|
+
const index = declarationValueIndex(decl) + node.sourceIndex;
|
|
183
186
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
187
|
+
stylelint.utils.report({
|
|
188
|
+
ruleName,
|
|
189
|
+
result,
|
|
190
|
+
node: decl,
|
|
191
|
+
message: messages.rejected('transition', node.value),
|
|
192
|
+
index
|
|
193
|
+
});
|
|
194
|
+
}
|
|
193
195
|
});
|
|
196
|
+
});
|
|
194
197
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
cssRoot.walkDecls('transition', (decl) => {
|
|
199
|
+
/** @type {{ index: number; value: string; }[]} */
|
|
200
|
+
const nodes = [];
|
|
198
201
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
valueParser(decl.value).walk((node) => {
|
|
203
|
+
if (node.type === 'word' || node.type === 'function') {
|
|
204
|
+
nodes.push({
|
|
205
|
+
index: node.sourceIndex,
|
|
206
|
+
value: node.value
|
|
207
|
+
});
|
|
208
|
+
}
|
|
206
209
|
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
return false;
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
if (!ignored.includes('all')) {
|
|
214
|
+
const transitionProp = nodes.filter((node) => {
|
|
215
|
+
const isUnit = valueParser.unit(node.value);
|
|
216
|
+
const isTimingFunction = cssTimingFunctionsRE.test(node.value);
|
|
209
217
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const isTimingFunction = cssTimingFunctionsRE.test(node.value);
|
|
218
|
+
if (isUnit || isTimingFunction) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
214
221
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
222
|
+
return node;
|
|
223
|
+
});
|
|
218
224
|
|
|
219
|
-
|
|
225
|
+
if (nodes.length > 0 && transitionProp.length === 0) {
|
|
226
|
+
stylelint.utils.report({
|
|
227
|
+
ruleName,
|
|
228
|
+
result,
|
|
229
|
+
node: decl,
|
|
230
|
+
message: messages.rejected('transition', 'all'),
|
|
231
|
+
index: declarationValueIndex(decl) + nodes[0].index
|
|
220
232
|
});
|
|
221
233
|
|
|
222
|
-
|
|
223
|
-
stylelint.utils.report({
|
|
224
|
-
ruleName,
|
|
225
|
-
result,
|
|
226
|
-
node: decl,
|
|
227
|
-
message: messages.rejected('transition', 'all'),
|
|
228
|
-
index: declarationValueIndex(decl) + nodes[0].index
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
234
|
+
return;
|
|
233
235
|
}
|
|
236
|
+
}
|
|
234
237
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
+
for (const property of nodes) {
|
|
239
|
+
const index = declarationValueIndex(decl) + property.index;
|
|
240
|
+
const value = unprefixed(property.value);
|
|
238
241
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
242
|
+
if (
|
|
243
|
+
!ignored.includes(value) &&
|
|
244
|
+
(disallowedList.includes(value) || value === 'all')
|
|
245
|
+
) {
|
|
246
|
+
stylelint.utils.report({
|
|
247
|
+
ruleName,
|
|
248
|
+
result,
|
|
249
|
+
node: decl,
|
|
250
|
+
message: messages.rejected('transition', property.value),
|
|
251
|
+
index
|
|
252
|
+
});
|
|
251
253
|
}
|
|
252
|
-
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
253
256
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
cssRoot.walkAtRules(/^keyframes$/iu, (atRuleKeyframes) => {
|
|
258
|
+
atRuleKeyframes.walkDecls((decl) => {
|
|
259
|
+
const value = unprefixed(decl.prop);
|
|
257
260
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
});
|
|
261
|
+
if (!ignored.includes(value) && disallowedList.includes(value)) {
|
|
262
|
+
stylelint.utils.report({
|
|
263
|
+
ruleName,
|
|
264
|
+
result,
|
|
265
|
+
node: decl,
|
|
266
|
+
message: messages.rejected('animation', decl.prop)
|
|
267
|
+
});
|
|
268
|
+
}
|
|
267
269
|
});
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
ruleFunction.ruleName = ruleName;
|
|
274
|
+
ruleFunction.messages = messages;
|
|
270
275
|
|
|
271
|
-
|
|
272
|
-
module.exports.ruleName = ruleName;
|
|
273
|
-
module.exports.messages = messages;
|
|
276
|
+
module.exports = stylelint.createPlugin(ruleName, ruleFunction);
|