linter-bundle 2.11.1 → 2.14.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
@@ -6,7 +6,69 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.11.1...HEAD)
9
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.13.0...HEAD)
10
+
11
+ ## [2.14.0] - 2022.05.05
12
+
13
+ ### Changed
14
+
15
+ - [general] Remove files from npm package which are only necessary for development
16
+ - [eslint] Updated `eslint-import-resolver-typescript` from `2.7.0` to `2.7.1`
17
+ - [eslint] Updated `@typescript-eslint` from `5.21.0` to `5.22.0`
18
+ - [eslint] Updated `eslint-plugin-jsdoc` from `39.2.8` to `39.2.9`
19
+ - [eslint] Updated `eslint-plugin-react-hooks` from `4.4.0` to `4.5.0`
20
+ - [stylelint] Updated `stylelint` from `14.7.1` to `14.8.2`
21
+ - [eslint] Make use of new [`@typescript-eslint/no-duplicate-enum-values`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-duplicate-enum-values.md) rule
22
+ - [stylelint] Make use of new [`keyframe-block-no-duplicate-selectors`](https://github.com/stylelint/stylelint/blob/main/lib/rules/keyframe-block-no-duplicate-selectors/README.md) rule
23
+ - [stylelint] In the deployment process, ensure that the used Stylelint options are valid
24
+ - [stylelint] Fix invalid configuration of [`declaration-property-max-values`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-property-max-values/README.md) rule
25
+
26
+ ## [2.13.0] - 2022.04.25
27
+
28
+ ### Changed
29
+
30
+ - [eslint] Activate `allowExpressions` option of [`@typescript-eslint/explicit-function-return-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) rule
31
+ - [eslint] Updated `@typescript-eslint` from `5.17.0` to `5.21.0`
32
+ - [eslint] Updated `eslint` from `8.12.0` to `8.14.0`
33
+ - [eslint] Updated `eslint-import-resolver-typescript` from `2.7.0` to `2.7.1`
34
+ - [eslint] Updated `eslint-plugin-functional` from `4.2.0` to `4.2.1`
35
+ - [eslint] Updated `eslint-plugin-import` from `2.25.4` to `2.26.0`
36
+ - [eslint] Updated `eslint-plugin-jest` from `26.1.3` to `26.1.5`
37
+ - [eslint] Updated `eslint-plugin-jsdoc` from `38.1.4` to `39.2.8`
38
+ - [eslint] Updated `eslint-plugin-unicorn` from `41.0.1` to `42.0.0`
39
+ - [stylelint] Updated `postcss-scss` from `4.0.3` to `4.0.4`
40
+ - [stylelint] Updated `stylelint` from `14.6.1` to `14.7.1`
41
+ - [eslint] Activate `allowExpressions` option of [`@typescript-eslint/explicit-function-return-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) rule
42
+ - [eslint/overrides-jsdoc] Set [`minLineCount` option to 2](https://github.com/gajus/eslint-plugin-jsdoc/issues/870) for `require-jsdoc` rule
43
+ - [eslint] Reactivated the [`import/no-relative-packages`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-relative-packages.md) rule
44
+ - [eslint] Make use of new [`unicorn/no-useless-switch-case`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md) rule
45
+ - [eslint] Make use of new [`unicorn/prefer-modern-math-apis`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-math-apis.md) rule
46
+ - [eslint] Make use of new [`unicorn/no-unreadable-iife`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-iife.md) rule
47
+ - [eslint] Add but disable [`unicorn/prefer-native-coercion-functions`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-native-coercion-functions.md) rule, because this would produce inconsistency in the code and is harder to read
48
+ - [stylelint] Set [`selector-not-notation`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-not-notation/README.md) rule to `"complex"`
49
+
50
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.12.0...v2.13.0)
51
+
52
+ ## [2.12.0] - 2022.03.30
53
+
54
+ ### Changed
55
+
56
+ - [eslint] Updated `@typescript-eslint` from `5.14.0` to `5.17.0`
57
+ - [eslint] Updated `eslint` from `8.11.0` to `8.12.0`
58
+ - [eslint] Updated `eslint-import-resolver-typescript` from `2.5.0` to `2.7.0`
59
+ - [eslint] Updated `eslint-plugin-jest` from `26.1.1` to `26.1.3`
60
+ - [eslint] Updated `eslint-plugin-jsdoc` from `38.0.2` to `38.1.4`
61
+ - [eslint] Updated `eslint-plugin-react` from `7.29.3` to `7.29.4`
62
+ - [eslint] Updated `eslint-plugin-react-hooks` from `4.3.0` to `4.4.0`
63
+ - [eslint] Updated `eslint-plugin-unicorn` from `41.0.0` to `41.0.1`
64
+ - [stylelint] Updated `stylelint` from `14.5.3` to `14.6.1`
65
+ - [stylelint] Updated `stylelint-scss` from `4.1.0` to `4.2.0`
66
+ - [general] Updated `micromatch` from `4.0.4` to `4.0.5`
67
+ - [eslint] Make use of [`destructuredArrayIgnorePattern`](https://eslint.org/docs/rules/no-unused-vars#destructuredarrayignorepattern) of `@typescript-eslint/no-unused-vars` rule, to ignore variables with leading underscore.
68
+ - [stylelint] Make use of [`declaration-property-max-values`](https://stylelint.io/user-guide/rules/list/declaration-property-max-values/) rule, and set `unprefixed-property-name` to `4`
69
+ - [stylelint] Replace `function-no-unknown` by `scss/function-no-unknown`
70
+
71
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.11.1...v2.12.0)
10
72
 
11
73
  ## [2.11.1] - 2022.03.13
12
74
 
@@ -21,7 +83,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
21
83
 
22
84
  ### Added
23
85
 
24
- - Ensures that the ["overrides"](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) and ["resolutions"](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) configuration in the `package.json` is up-to-date for linter dependencies, to prevent errors with unknown
86
+ - [general] Ensures that the ["overrides"](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) and ["resolutions"](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) configuration in the `package.json` is up-to-date for linter dependencies, to prevent errors with unknown
25
87
  linter rules or options.
26
88
 
27
89
  ### Changed
@@ -72,8 +134,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
72
134
 
73
135
  ### Added
74
136
 
75
- - `--timing` argument to show information how long each linting process was running.
76
- - Experimental `--git` argument to only lint (ESLint, Stylelint and Markdownlint) files which have been detected as changed (compared to the upstream branch) by Git
137
+ - [general] `--timing` argument to show information how long each linting process was running.
138
+ - [general] Experimental `--git` argument to only lint (ESLint, Stylelint and Markdownlint) files which have been detected as changed (compared to the upstream branch) by Git
77
139
 
78
140
  [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.8.4...v2.9.0)
79
141
 
@@ -311,7 +373,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
311
373
 
312
374
  ### Changed
313
375
 
314
- - The minimum required Node.js version is v14 now
376
+ - [general] The minimum required Node.js version is v14 now
315
377
  - [eslint] Updated `@typescript-eslint` from v4.31.0 to v4.31.1
316
378
  - [eslint] Updated `eslint-import-resolver-typescript` from v2.4.0 to v2.5.0
317
379
  - [eslint] Updated `eslint-plugin-jest` from v24.4.0 to v24.4.2
@@ -700,7 +762,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
700
762
 
701
763
  ### Changed
702
764
 
703
- - By default, the terminal output of the linters is printed only in case of failure to prevent unnecessary noise. Use `--verbose` to show their output even on success.
765
+ - [general] By default, the terminal output of the linters is printed only in case of failure to prevent unnecessary noise. Use `--verbose` to show their output even on success.
704
766
  - [stylelint] Disallow reserved ECMAScript keywords (`abstract`, `arguments`, `await`, `boolean`, `break`, `byte`, `case`, `catch`, `char`, `class`, `const`, `continue`, `debugger`, `default`, `delete`, `do`, `double`, `else`, `enum`, `eval`, `export`, `extends`, `false`, `final`, `finally`,
705
767
  `float`, `for`, `function`, `goto`, `if`, `implements`, `import`, `in`, `Infinity`, `instanceof`, `int`, `interface`, `let`, `long`, `NaN`, `native`, `new`, `null`, `package`, `private`, `protected`, `public`, `return`, `short`, `static`, `super`, `switch`, `synchronized`, `this`, `throw`,
706
768
  `throws`, `transient`, `true`, `try`, `typeof`, `undefined`, `var`, `void`, `volatile`, `while`, `with`, and `yield`) as class names
package/README.md CHANGED
@@ -168,7 +168,7 @@ module.exports = {
168
168
  Source | Description | Rules setup
169
169
  -|-|-
170
170
  `linter-bundle/eslint` | General rule setup. This is also the base for the following **overrides**. | [View](./eslint/index.js)
171
- `linter-bundle/eslint/overrides-gatsby` | Settings for Gatsby-based projects. | [View](./eslint/overrides-gatsby)
171
+ `linter-bundle/eslint/overrides-gatsby` | Settings for Gatsby-based projects. | [View](./eslint/overrides-gatsby.js)
172
172
  `linter-bundle/eslint/overrides-javascript` | Strict settings for JavaScript files, which enforces correct types everywhere. | [View](./eslint/overrides-javascript.js)
173
173
  `linter-bundle/eslint/overrides-javascript-lazy` | Can be used instead of `overrides-javascript`. It's less strict and allows the `any` type. | [View](./eslint/overrides-javascript-lazy.js)
174
174
  `linter-bundle/eslint/overrides-jest` | Settings for projects using Jest. | [View](./eslint/overrides-jest.js)
package/eslint/index.js CHANGED
@@ -426,7 +426,7 @@ module.exports = {
426
426
  '@typescript-eslint/consistent-type-exports': 'error',
427
427
  '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
428
428
  '@typescript-eslint/dot-notation': 'error',
429
- '@typescript-eslint/explicit-function-return-type': 'error',
429
+ '@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
430
430
  '@typescript-eslint/explicit-member-accessibility': ['error', {
431
431
  ignoredMethodNames: [
432
432
  'constructor',
@@ -628,6 +628,7 @@ module.exports = {
628
628
  '@typescript-eslint/no-confusing-non-null-assertion': 'error',
629
629
  '@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true, ignoreVoidOperator: true }],
630
630
  '@typescript-eslint/no-dupe-class-members': 'error',
631
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
631
632
  '@typescript-eslint/no-duplicate-imports': 'error',
632
633
  '@typescript-eslint/no-dynamic-delete': 'error',
633
634
  '@typescript-eslint/no-empty-function': 'error',
@@ -689,7 +690,7 @@ module.exports = {
689
690
  '@typescript-eslint/no-unsafe-member-access': 'error',
690
691
  '@typescript-eslint/no-unsafe-return': 'error',
691
692
  '@typescript-eslint/no-unused-expressions': 'error',
692
- '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
693
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_' }],
693
694
  '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
694
695
  '@typescript-eslint/no-useless-constructor': 'error',
695
696
  '@typescript-eslint/no-var-requires': 'error',
@@ -800,7 +801,7 @@ module.exports = {
800
801
  'import/no-named-export': 'off',
801
802
  'import/no-namespace': 'off', // @todo Enabling this produces a JavaScript error in the rule; anyhow - could that reduce the package size, because of improved tree-shaking/dead-code-elimination?
802
803
  'import/no-nodejs-modules': 'error',
803
- // 'import/no-relative-packages': 'error', -- Removed because of roll-back of eslint-plugin-import in version 1.18.0
804
+ 'import/no-relative-packages': 'error',
804
805
  'import/no-relative-parent-imports': 'off', // @todo Disabled because of a bug on Windows, re-enable as soon as it's resolved: https://github.com/import-js/eslint-plugin-import/issues/1644
805
806
  'import/no-restricted-paths': 'error',
806
807
  'import/no-self-import': 'error',
@@ -961,6 +962,7 @@ module.exports = {
961
962
  'unicorn/no-thenable': 'error',
962
963
  'unicorn/no-this-assignment': 'error',
963
964
  'unicorn/no-unreadable-array-destructuring': 'error',
965
+ 'unicorn/no-unreadable-iife': 'error',
964
966
  'unicorn/no-unsafe-regex': 'off',
965
967
  'unicorn/no-unused-properties': 'error',
966
968
  'unicorn/no-useless-fallback-in-spread': 'error',
@@ -968,6 +970,7 @@ module.exports = {
968
970
  'unicorn/no-invalid-remove-event-listener': 'error',
969
971
  'unicorn/no-useless-length-check': 'error',
970
972
  'unicorn/no-useless-spread': 'error',
973
+ 'unicorn/no-useless-switch-case': 'error',
971
974
  'unicorn/no-useless-undefined': ['error', { checkArguments: false }],
972
975
  'unicorn/no-zero-fractions': 'error',
973
976
  'unicorn/number-literal-case': 'error',
@@ -992,7 +995,9 @@ module.exports = {
992
995
  'unicorn/prefer-keyboard-event-key': 'error',
993
996
  'unicorn/prefer-math-trunc': 'error',
994
997
  'unicorn/prefer-modern-dom-apis': 'error',
998
+ 'unicorn/prefer-modern-math-apis': 'error',
995
999
  'unicorn/prefer-module': 'off',
1000
+ 'unicorn/prefer-native-coercion-functions': 'off',
996
1001
  'unicorn/prefer-negative-index': 'error',
997
1002
  'unicorn/prefer-number-properties': 'error',
998
1003
  'unicorn/prefer-object-has-own': 'off', // Not widely supported yet. Can be activated in 2024
@@ -50,7 +50,7 @@ module.exports = {
50
50
  'jsdoc/require-example': 'off',
51
51
  'jsdoc/require-file-overview': 'error',
52
52
  'jsdoc/require-hyphen-before-param-description': 'error',
53
- 'jsdoc/require-jsdoc': 'error',
53
+ 'jsdoc/require-jsdoc': ['error', { minLineCount: 2 }],
54
54
  'jsdoc/require-param-description': 'error',
55
55
  'jsdoc/require-param-name': 'error',
56
56
  'jsdoc/require-param-type': 'error',
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @file Executes a process asynchronously.
3
+ */
4
+
5
+ /** @typedef {{ code: number; stdout: string; stderr: string; runtime: number; }} ProcessResult */
6
+
7
+ const childProcess = require('child_process');
8
+
9
+ /**
10
+ * Executes a process asynchronously.
11
+ *
12
+ * @param {string} command - The process to execute.
13
+ * @param {childProcess.ExecOptions | undefined} [options] - The options of the `childProcess.exec()` method.
14
+ * @returns {Promise<ProcessResult>} An object containing the result of the process execution
15
+ */
16
+ async function runProcess (command, options) {
17
+ return new Promise((resolve) => {
18
+ const startTimestamp = performance.now();
19
+
20
+ /** @type {string[]} */
21
+ const stdout = [];
22
+
23
+ /** @type {string[]} */
24
+ const stderr = [];
25
+
26
+ const lintingProcess = childProcess.exec(command, options);
27
+
28
+ lintingProcess.stdout?.on('data', (/** @type {string} */data) => {
29
+ stdout.push(data);
30
+ });
31
+
32
+ lintingProcess.stderr?.on('data', (/** @type {string} */data) => {
33
+ stderr.push(data);
34
+ });
35
+
36
+ lintingProcess.on('exit', (code) => resolve({
37
+ code: code ?? 0,
38
+ stdout: stdout.join(''),
39
+ stderr: stderr.join(''),
40
+ runtime: performance.now() - startTimestamp
41
+ }));
42
+ });
43
+ }
44
+
45
+ module.exports = {
46
+ runProcess
47
+ };
package/lint.js CHANGED
@@ -4,18 +4,18 @@
4
4
  * @file Entry point of the linter-bundle.
5
5
  */
6
6
 
7
- const childProcess = require('child_process');
8
7
  const fs = require('fs');
9
8
  const path = require('path');
10
9
  const tty = require('tty');
11
10
 
12
11
  const micromatch = require('micromatch');
13
12
 
13
+ const { runProcess } = require('./helper/run-process.js');
14
14
  const { validatePackageOverrides } = require('./helper/validate-package-overrides.js');
15
15
 
16
+ /** @typedef {import('./helper/run-process').ProcessResult} ProcessResult */
16
17
  /** @typedef {{ taskName: string; config: Partial<Record<string, (string | true)[]>>; }} TaskNameAndConfig */
17
- /** @typedef {TaskNameAndConfig & { command: string; options?: childProcess.ExecOptions; }} TaskSetup */
18
- /** @typedef {{ code: number; stdout: string; stderr: string; runtime: number; }} ProcessResult */
18
+ /** @typedef {TaskNameAndConfig & { command: string; options?: import('child_process').ExecOptions; }} TaskSetup */
19
19
  /** @typedef {{ jobTitle: string; taskSetup: TaskSetup; job: Promise<ProcessResult>; }} Job */
20
20
 
21
21
  const isTerminal = tty.isatty(1);
@@ -378,42 +378,6 @@ function generateDummyJobOutput (taskName, config, output) {
378
378
  };
379
379
  }
380
380
 
381
- /**
382
- * Exectues a process asynchronously.
383
- *
384
- * @param {string} command - The process to execute.
385
- * @param {childProcess.ExecOptions | undefined} [options] - The options of the `childProcess.exec()` method.
386
- * @returns {Promise<ProcessResult>} An object containing the result of the process execution
387
- */
388
- async function runProcess (command, options) {
389
- return new Promise((resolve) => {
390
- const startTimestamp = performance.now();
391
-
392
- /** @type {string[]} */
393
- const stdout = [];
394
-
395
- /** @type {string[]} */
396
- const stderr = [];
397
-
398
- const lintingProcess = childProcess.exec(command, options);
399
-
400
- lintingProcess.stdout?.on('data', (/** @type {string} */data) => {
401
- stdout.push(data);
402
- });
403
-
404
- lintingProcess.stderr?.on('data', (/** @type {string} */data) => {
405
- stderr.push(data);
406
- });
407
-
408
- lintingProcess.on('exit', (code) => resolve({
409
- code: code ?? 0,
410
- stdout: stdout.join(''),
411
- stderr: stderr.join(''),
412
- runtime: performance.now() - startTimestamp
413
- }));
414
- });
415
- }
416
-
417
381
  /**
418
382
  * Returns the title (command line string) of a specific job.
419
383
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linter-bundle",
3
- "version": "2.11.1",
3
+ "version": "2.14.0",
4
4
  "description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -32,36 +32,37 @@
32
32
  "publish:major": "npm version major",
33
33
  "publish:minor": "npm version minor",
34
34
  "publish:patch": "npm version patch",
35
- "lint": "node ./lint tsc ts md audit --min-severity=critical",
35
+ "lint": "npm run validate-stylelint-options && node ./lint tsc ts md audit --min-severity=critical",
36
36
  "preversion": "npm run check-outdated && npm run stylelint-find-rules && npm run lint",
37
37
  "postversion": "git push && git push --tags && npm publish",
38
38
  "stylelint-find-rules": "stylelint-find-new-rules ./stylelint/index.js",
39
+ "validate-stylelint-options": "node ./validate-stylelint-options",
39
40
  "check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
40
41
  },
41
42
  "dependencies": {
42
- "@typescript-eslint/eslint-plugin": "5.14.0",
43
- "@typescript-eslint/parser": "5.14.0",
44
- "eslint": "8.11.0",
45
- "eslint-import-resolver-typescript": "2.5.0",
43
+ "@typescript-eslint/eslint-plugin": "5.22.0",
44
+ "@typescript-eslint/parser": "5.22.0",
45
+ "eslint": "8.14.0",
46
+ "eslint-import-resolver-typescript": "2.7.1",
46
47
  "eslint-import-resolver-webpack": "0.13.2",
47
48
  "eslint-plugin-eslint-comments": "3.2.0",
48
- "eslint-plugin-functional": "4.2.0",
49
- "eslint-plugin-import": "2.25.4",
50
- "eslint-plugin-jest": "26.1.1",
51
- "eslint-plugin-jsdoc": "38.0.2",
49
+ "eslint-plugin-functional": "4.2.1",
50
+ "eslint-plugin-import": "2.26.0",
51
+ "eslint-plugin-jest": "26.1.5",
52
+ "eslint-plugin-jsdoc": "39.2.9",
52
53
  "eslint-plugin-jsx-a11y": "6.5.1",
53
54
  "eslint-plugin-node": "11.1.0",
54
55
  "eslint-plugin-promise": "6.0.0",
55
- "eslint-plugin-react": "7.29.3",
56
- "eslint-plugin-react-hooks": "4.3.0",
57
- "eslint-plugin-unicorn": "41.0.0",
56
+ "eslint-plugin-react": "7.29.4",
57
+ "eslint-plugin-react-hooks": "4.5.0",
58
+ "eslint-plugin-unicorn": "42.0.0",
58
59
  "markdownlint-cli": "0.31.1",
59
- "micromatch": "4.0.4",
60
- "postcss-scss": "4.0.3",
61
- "stylelint": "14.5.3",
60
+ "micromatch": "4.0.5",
61
+ "postcss-scss": "4.0.4",
62
+ "stylelint": "14.8.2",
62
63
  "stylelint-declaration-block-no-ignored-properties": "2.5.0",
63
64
  "stylelint-order": "5.0.0",
64
- "stylelint-scss": "4.1.0",
65
+ "stylelint-scss": "4.2.0",
65
66
  "stylelint-selector-no-empty": "1.0.8",
66
67
  "stylelint-use-logical-spec": "3.2.2"
67
68
  },
@@ -70,10 +71,10 @@
70
71
  "typescript": "^4.0.0"
71
72
  },
72
73
  "devDependencies": {
73
- "@types/eslint": "8.4.1",
74
+ "@types/eslint": "8.4.2",
74
75
  "@types/micromatch": "4.0.2",
75
- "@types/node": "17.0.21",
76
+ "@types/node": "17.0.31",
76
77
  "stylelint-find-new-rules": "4.0.0",
77
- "typescript": "4.6.2"
78
+ "typescript": "4.6.4"
78
79
  }
79
80
  }
@@ -157,6 +157,7 @@ module.exports = {
157
157
  ]
158
158
  }
159
159
  ],
160
+ 'declaration-property-max-values': { '/.*/': 4 },
160
161
  'declaration-no-important': [true, {
161
162
  severity: 'warning'
162
163
  }],
@@ -183,7 +184,7 @@ module.exports = {
183
184
  'function-linear-gradient-no-nonstandard-direction': true,
184
185
  'function-max-empty-lines': 0,
185
186
  'function-name-case': 'lower',
186
- 'function-no-unknown': null, // @todo Create issue for false positives for "color.scale". Need this be covered by the `ignoreFunctions` option?
187
+ 'function-no-unknown': null, // Implemented by scss/function-no-unknown
187
188
  'function-parentheses-newline-inside': 'always-multi-line',
188
189
  'function-parentheses-space-inside': 'never-single-line',
189
190
  'function-url-no-scheme-relative': true,
@@ -193,6 +194,7 @@ module.exports = {
193
194
  'function-whitespace-after': 'always',
194
195
  'hue-degree-notation': 'number', // @todo change that to 'angle'?
195
196
  'indentation': 'tab',
197
+ 'keyframe-block-no-duplicate-selectors': true,
196
198
  'keyframe-declaration-no-important': true,
197
199
  'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*\\d*$',
198
200
  'length-zero-no-unit': true,
@@ -289,6 +291,7 @@ module.exports = {
289
291
  'selector-nested-pattern': null,
290
292
  'selector-no-qualifying-type': [true, { ignore: ['attribute', 'class'] }],
291
293
  'selector-no-vendor-prefix': true,
294
+ 'selector-not-notation': 'complex',
292
295
  'selector-pseudo-class-allowed-list': null,
293
296
  'selector-pseudo-class-case': 'lower',
294
297
  'selector-pseudo-class-disallowed-list': null,
@@ -890,6 +893,7 @@ module.exports = {
890
893
  'scss/double-slash-comment-inline': null,
891
894
  'scss/double-slash-comment-whitespace-inside': 'always',
892
895
  'scss/function-color-relative': true,
896
+ 'scss/function-no-unknown': true,
893
897
  'scss/function-quote-no-quoted-strings-inside': true,
894
898
  'scss/function-unquote-no-unquoted-strings-inside': true,
895
899
  'scss/map-keys-quotes': 'always',
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @file Ensures that stylelint options are valid by checking the `invalidOptionWarnings` property of the JSON response.
3
+ */
4
+
5
+ const fs = require('fs');
6
+ const os = require('os');
7
+ const path = require('path');
8
+
9
+ const { runProcess } = require('./helper/run-process.js');
10
+
11
+ void (async () => {
12
+ const temporaryPath = path.join(os.tmpdir(), 'linter-bundle-');
13
+
14
+ const folder = fs.mkdtempSync(temporaryPath);
15
+
16
+ const tempFilePath = path.join(folder, 'tmp.scss');
17
+
18
+ fs.writeFileSync(tempFilePath, '* {\n\tborder: 1px solid var(--color);\n\n\tcolor: var(--color);\n}\n', 'utf8');
19
+
20
+ const result = await runProcess(`stylelint -f json "${tempFilePath}"`);
21
+
22
+ fs.unlinkSync(tempFilePath);
23
+
24
+ if (result.stderr) {
25
+ process.stderr.write(result.stderr);
26
+
27
+ process.exitCode = 1;
28
+
29
+ return;
30
+ }
31
+
32
+ /**
33
+ * @type {import('stylelint').LintResult}
34
+ */
35
+ const { invalidOptionWarnings, warnings } = JSON.parse(result.stdout)[0];
36
+
37
+ if (warnings.length > 0) {
38
+ process.stderr.write(warnings.join('\n'));
39
+
40
+ process.exitCode = 1;
41
+
42
+ return;
43
+ }
44
+
45
+ if (invalidOptionWarnings.length > 0) {
46
+ process.stderr.write(`Invalid stylelint configuration:\n\n- ${invalidOptionWarnings.map(({ text }) => text).join('\n- ')}`);
47
+
48
+ process.exitCode = 1;
49
+
50
+ return;
51
+ }
52
+ })();
package/.eslintrc.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * @file Configuration used for linting the linter-bundle.
3
- */
4
-
5
- module.exports = {
6
- root: true,
7
- extends: [
8
- require.resolve('./eslint'),
9
- require.resolve('./eslint/overrides-javascript-lazy'),
10
- require.resolve('./eslint/overrides-jsdoc')
11
- ]
12
- };
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "markdownlint/base.json"
3
- }
package/tsconfig.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // General settings for code interpretation
4
- "target": "esnext",
5
- "module": "commonjs",
6
- "resolveJsonModule": true,
7
- "checkJs": true,
8
- "noEmit": true,
9
-
10
- "baseUrl": ".",
11
-
12
- // General settings for code generation
13
- "newLine": "LF",
14
-
15
- // Console output settings
16
- "pretty": true,
17
-
18
- // Code validation
19
- "allowUnreachableCode": false,
20
- "allowUnusedLabels": false,
21
- "alwaysStrict": true,
22
- "exactOptionalPropertyTypes": true,
23
- "forceConsistentCasingInFileNames": true,
24
- "keyofStringsOnly": false,
25
- "noFallthroughCasesInSwitch": true,
26
- "noImplicitAny": true,
27
- "noImplicitReturns": true,
28
- "noImplicitThis": true,
29
- "noImplicitUseStrict": false,
30
- "noPropertyAccessFromIndexSignature": true,
31
- "noUnusedLocals": true,
32
- "noUnusedParameters": true,
33
- "strict": true,
34
- "strictBindCallApply": true,
35
- "strictFunctionTypes": true,
36
- "strictNullChecks": true,
37
- "strictPropertyInitialization": true,
38
- "suppressExcessPropertyErrors": false,
39
- "suppressImplicitAnyIndexErrors": true,
40
- "useUnknownInCatchVariables": true
41
- },
42
- "include": [
43
- "./types.d.ts",
44
- "**/*.js",
45
- "./.eslintrc.js"
46
- ]
47
- }