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 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 }],
@@ -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.18.0",
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.33.1",
44
- "@typescript-eslint/parser": "5.33.1",
45
- "eslint": "8.22.0",
46
- "eslint-import-resolver-typescript": "3.4.2",
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.8.3",
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.0",
56
- "eslint-plugin-react": "7.30.1",
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.1",
59
+ "markdownlint-cli": "0.32.2",
60
60
  "micromatch": "4.0.5",
61
61
  "postcss-scss": "4.0.4",
62
- "stylelint": "14.10.0",
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.6",
76
+ "@types/node": "18.7.13",
77
77
  "stylelint-find-new-rules": "4.0.0",
78
- "typescript": "4.7.4"
78
+ "typescript": "4.8.2"
79
79
  }
80
80
  }
@@ -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 blacklisted properties.
125
+ * Get disallowed properties.
126
126
  *
127
127
  * @param {string} ignore - Property name.
128
- * @returns {string[]} - Array of blacklisted properties.
128
+ * @returns {string[]} - Array of disallowed properties.
129
129
  */
130
- const getBlacklist = (ignore) => {
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
- module.exports = stylelint.createPlugin(
150
- ruleName,
151
- (actual, options) => (cssRoot, result) => {
152
- const validOptions = stylelint.utils.validateOptions(
153
- result,
154
- ruleName,
155
- { actual },
156
- {
157
- actual: options,
158
- possible: {
159
- ignore: ['paint-properties'],
160
- ignoreProperties: [isString]
161
- },
162
- optional: true
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
- if (!validOptions) { return; }
171
+ if (!validOptions) { return; }
167
172
 
168
- // @ts-expect-error -- Property 'ignore' comes from an index signature, so it must be accessed with ['ignore'].
169
- const blacklist = getBlacklist(options.ignore);
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
- cssRoot.walkDecls('transition-property', (decl) => {
174
- valueParser(decl.value).walk((node) => {
175
- const value = unprefixed(node.value);
176
+ cssRoot.walkDecls('transition-property', (decl) => {
177
+ valueParser(decl.value).walk((node) => {
178
+ const value = unprefixed(node.value);
176
179
 
177
- if (
178
- node.type === 'word' &&
179
- !ignored.includes(value) &&
180
- (blacklist.includes(value) || value === 'all')
181
- ) {
182
- const index = declarationValueIndex(decl) + node.sourceIndex;
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
- stylelint.utils.report({
185
- ruleName,
186
- result,
187
- node: decl,
188
- message: messages.rejected('transition', node.value),
189
- index
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
- cssRoot.walkDecls('transition', (decl) => {
196
- /** @type {{ index: number; value: string; }[]} */
197
- const nodes = [];
198
+ cssRoot.walkDecls('transition', (decl) => {
199
+ /** @type {{ index: number; value: string; }[]} */
200
+ const nodes = [];
198
201
 
199
- valueParser(decl.value).walk((node) => {
200
- if (node.type === 'word' || node.type === 'function') {
201
- nodes.push({
202
- index: node.sourceIndex,
203
- value: node.value
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
- return false;
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
- if (!ignored.includes('all')) {
211
- const transitionProp = nodes.filter((node) => {
212
- const isUnit = valueParser.unit(node.value);
213
- const isTimingFunction = cssTimingFunctionsRE.test(node.value);
218
+ if (isUnit || isTimingFunction) {
219
+ return false;
220
+ }
214
221
 
215
- if (isUnit || isTimingFunction) {
216
- return false;
217
- }
222
+ return node;
223
+ });
218
224
 
219
- return node;
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
- if (nodes.length > 0 && transitionProp.length === 0) {
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
- for (const property of nodes) {
236
- const index = declarationValueIndex(decl) + property.index;
237
- const value = unprefixed(property.value);
238
+ for (const property of nodes) {
239
+ const index = declarationValueIndex(decl) + property.index;
240
+ const value = unprefixed(property.value);
238
241
 
239
- if (
240
- !ignored.includes(value) &&
241
- (blacklist.includes(value) || value === 'all')
242
- ) {
243
- stylelint.utils.report({
244
- ruleName,
245
- result,
246
- node: decl,
247
- message: messages.rejected('transition', property.value),
248
- index
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
- cssRoot.walkAtRules(/^keyframes$/iu, (atRuleKeyframes) => {
255
- atRuleKeyframes.walkDecls((decl) => {
256
- const value = unprefixed(decl.prop);
257
+ cssRoot.walkAtRules(/^keyframes$/iu, (atRuleKeyframes) => {
258
+ atRuleKeyframes.walkDecls((decl) => {
259
+ const value = unprefixed(decl.prop);
257
260
 
258
- if (!ignored.includes(value) && blacklist.includes(value)) {
259
- stylelint.utils.report({
260
- ruleName,
261
- result,
262
- node: decl,
263
- message: messages.rejected('animation', decl.prop)
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
- // @ts-expect-error -- Cannot assign to 'ruleName' because it is a read-only property.
272
- module.exports.ruleName = ruleName;
273
- module.exports.messages = messages;
276
+ module.exports = stylelint.createPlugin(ruleName, ruleFunction);