linter-bundle 2.3.0 → 2.6.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,9 +6,58 @@ 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.2.0...HEAD)
9
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.6.0...HEAD)
10
10
 
11
- ## [2.2.0] - 2022.01.27
11
+ ## [2.6.0] - 2022.02.14
12
+
13
+ - [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.11.0 to v5.12.0
14
+ - [eslint] Updated `@typescript-eslint/parser` from v5.11.0 to v5.12.0
15
+ - [eslint] Updated `eslint` from v8.8.0 to v8.9.0
16
+ - [eslint] Updated `eslint-plugin-jsdoc` from v37.8.2 to v37.9.1
17
+ - [eslint] Ignore `generics` in [@typescript-eslint/comma-dangle](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/comma-dangle.md) to allow [generic component definitions for function components](https://wanago.io/2020/03/09/functional-react-components-with-generic-props-in-typescript/#crayon-620a96e97d44a141656396)
18
+
19
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.5.0...v2.6.0)
20
+
21
+ ## [2.5.0] - 2022.02.11
22
+
23
+ - [eslint] Updated `eslint-plugin-jsdoc` from v37.8.1 to v37.8.2
24
+ - [stylelint] Updated `stylelint` from v14.4.0 to v14.5.0
25
+ - [eslint/overrides-gatsby] Disabled `unusedExports` and enabled `missingExports` for the [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md) rule, for `src/pages/*.tsx` files.
26
+
27
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.4.0...v2.5.0)
28
+
29
+ ## [2.4.0] - 2022.02.09
30
+
31
+ - [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.10.1 to v5.11.0
32
+ - [eslint] Updated `eslint` from v8.7.0 to v8.8.0
33
+ - [eslint] Updated `eslint-plugin-functional` from v4.1.1 to v4.2.0
34
+ - [eslint] Updated `eslint-plugin-jest` from v26.0.0 to v26.1.0
35
+ - [eslint] Updated `eslint-plugin-jsdoc` from v37.7.0 to v37.8.1
36
+ - [markdownlint] Updated `markdownlint-cli` from v0.30.0 to v0.31.1, which adds the new rules `MD049` and `MD050` for consistent emphasis/strong style, and improves the rules `MD007`/`MD010`/`MD032`/`MD033`/`MD035`/`MD037`/`MD039`
37
+ - [stylelint] Updated `stylelint` from v14.3.0 to v14.4.0
38
+ - [eslint] Activated `unusedExports` option of the [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md) rule
39
+ - [eslint] Activate [`@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
40
+ - [eslint/react] Add React class methods (`componentDidMount`, `render` etc.) to the allowed names in the [`@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
41
+ - [eslint/jest] Make use of new [`no-conditional-in-test`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-in-test.md) rule, which deprecates `no-if`
42
+ - [eslint/jest] Make use of new [`prefer-snapshot-hint`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-snapshot-hint.md) rule
43
+ - [stylelint] Added but disabled new [`function-no-unknown`](https://github.com/stylelint/stylelint/blob/main/lib/rules/function-no-unknown/README.md) rule, because of false positives
44
+
45
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.3.1...v2.4.0)
46
+
47
+ ## [2.3.1] - 2022.01.28
48
+
49
+ ### Fixed
50
+
51
+ - [eslint/overrides-javascript(-lazy)] Move `import/no-import-module-exports` rule to`overrides-javascript`
52
+ - [eslint/overrides-gatsby] Ignore '@reach/router' in `import/no-unresolved` rule
53
+ - [eslint] Disabled `react/require-default-props`, because of false-positive for React.forwardRef wrapped functional components
54
+ - [eslint] Disabled `unicorn/prefer-top-level-await`, because of false-positive on environments with Node.js below v14.8
55
+ - [eslint] Activated `allowThrowingUnknown` option of the [`@typescript-eslint/no-throw-literal`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md) rule
56
+ - [stylelint] Activate `camelCaseSvgKeywords` option of the [`value-keyword-case`](https://github.com/stylelint/stylelint/tree/main/lib/rules/value-keyword-case) rule
57
+
58
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.3.0...v2.3.1)
59
+
60
+ ## [2.3.0] - 2022.01.27
12
61
 
13
62
  ### Changed
14
63
 
@@ -47,7 +96,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
47
96
  - [stylelint] Added new [`scss/at-use-no-unnamespaced`](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/at-use-no-unnamespaced) rule
48
97
  - [stylelint] Added but disabled [`rule-selector-property-disallowed-list`](https://github.com/stylelint/stylelint/tree/main/lib/rules/rule-selector-property-disallowed-list) rule
49
98
 
50
- [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.1.0...v2.2.0)
99
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.1.0...v2.3.0)
51
100
 
52
101
  ## [2.1.0] - 2021.11.07
53
102
 
package/TODO.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @todo
2
2
 
3
+ Some tools like Gatsby ship deprecated dependencies of eslint and @typescript-eslint.
4
+ Since npm installs packages alphabetically, the outdated `gatsby` dependencies are installed in the `node_modules` root, instead of the newer `linter-bundle` dependencies. Since the old versions often do not support new rules or new options, this may cause linting to fail with errors like this:
5
+
6
+ ```bash
7
+ Error while loading rule 'import/no-unused-modules': .eslintrc.js » ./node_modules/linter-bundle/eslint/index.js:
8
+ Configuration for rule "@typescript-eslint/no-throw-literal" is invalid:
9
+ Value [{"allowThrowingAny":false,"allowThrowingUnknown":true}] should NOT have more than 0 items.
10
+ ```
11
+
12
+ To solve such problems, npm supports [`overrides`](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) as of version [8.3](https://github.com/npm/cli/releases/tag/v8.3.0), while yarn supports [`resolutions`](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/).
13
+
14
+ By using the `enforce-deps` option, linter-bundle will ensure the right versions of the dependencies are installed, and if not it automatically write these options to your package.json and then run an `npm i` or `yarn`, before starting the linting to ensure that the correct dependency versions are installed.
15
+
16
+ ```json
17
+ "overrides": {
18
+ "@typescript-eslint/eslint-plugin": "$linter-bundle",
19
+ "@typescript-eslint/parser": "$linter-bundle",
20
+ "eslint": "$linter-bundle"
21
+ }
22
+ ```
23
+
3
24
  - Option to lint only changed files in Git
4
25
  [lint-staged](https://github.com/okonet/lint-staged)
5
26
  [affected](https://www.npmjs.com/package/affected)
package/eslint/index.js CHANGED
@@ -416,7 +416,9 @@ module.exports = {
416
416
  }],
417
417
  '@typescript-eslint/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
418
418
  '@typescript-eslint/class-literal-property-style': 'error',
419
- '@typescript-eslint/comma-dangle': ['error', 'never'],
419
+ '@typescript-eslint/comma-dangle': ['error', {
420
+ generics: 'ignore'
421
+ }],
420
422
  '@typescript-eslint/comma-spacing': 'error',
421
423
  '@typescript-eslint/consistent-indexed-object-style': 'error',
422
424
  '@typescript-eslint/consistent-type-assertions': 'error',
@@ -424,7 +426,7 @@ module.exports = {
424
426
  '@typescript-eslint/consistent-type-exports': 'error',
425
427
  '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
426
428
  '@typescript-eslint/dot-notation': 'error',
427
- '@typescript-eslint/explicit-function-return-type': 'off', // @todo Disabled till we can specify exceptions (React-default class methods, like render())
429
+ '@typescript-eslint/explicit-function-return-type': 'error',
428
430
  '@typescript-eslint/explicit-member-accessibility': ['error', {
429
431
  ignoredMethodNames: [
430
432
  'constructor',
@@ -644,7 +646,7 @@ module.exports = {
644
646
  '@typescript-eslint/no-this-alias': 'error',
645
647
  '@typescript-eslint/no-throw-literal': ['error', {
646
648
  allowThrowingAny: false,
647
- allowThrowingUnknown: false
649
+ allowThrowingUnknown: true
648
650
  }],
649
651
  '@typescript-eslint/no-type-alias': ['off', { // @todo There should be an option like 'sub-in-unions-and-intersections', which allows `type A = (string | number)[];`
650
652
  allowAliases: 'always',
@@ -770,7 +772,7 @@ module.exports = {
770
772
  'workbox-window/utils/WorkboxEvent'
771
773
  ]
772
774
  }],
773
- 'import/no-import-module-exports': 'error',
775
+ 'import/no-import-module-exports': 'off', // Activated only for JavaScript files
774
776
  'import/no-mutable-exports': 'error',
775
777
  'import/no-named-as-default-member': 'error',
776
778
  'import/no-named-as-default': 'error',
@@ -789,7 +791,7 @@ module.exports = {
789
791
  ]
790
792
  }],
791
793
  'import/no-unresolved': ['error', { caseSensitiveStrict: true }],
792
- 'import/no-unused-modules': 'error',
794
+ 'import/no-unused-modules': ['error', { unusedExports: true }],
793
795
  'import/no-useless-path-segments': 'error',
794
796
  'import/no-webpack-loader-syntax': 'off', // Indeed, you should avoid that, but if we do it, we have a reason for it
795
797
  'import/order': ['error', {
@@ -987,7 +989,7 @@ module.exports = {
987
989
  'unicorn/prefer-string-trim-start-end': 'error',
988
990
  'unicorn/prefer-switch': 'error',
989
991
  'unicorn/prefer-ternary': 'off', // We prefer readability over saving a few chars
990
- 'unicorn/prefer-top-level-await': 'error',
992
+ 'unicorn/prefer-top-level-await': 'off', // @todo There should be a detection that this option is only activated on Node.js v14.8 environments and above (Check for "engine" property in package.json, and "node -v")
991
993
  'unicorn/prefer-regexp-test': 'error',
992
994
  'unicorn/prefer-type-error': 'error',
993
995
  'unicorn/prevent-abbreviations': ['error', { ignore: ['args', 'i', 'j', 'i18n', 'ref', 'Ref', 'params', 'props', 'Props'] }],
@@ -33,6 +33,13 @@ module.exports = {
33
33
  */
34
34
  '@typescript-eslint/no-confusing-void-expression': 'off', // @todo Conflicts with graphql-template strings
35
35
 
36
+ /**
37
+ * eslint-plugin-import
38
+ *
39
+ * @see https://github.com/import-js/eslint-plugin-import
40
+ */
41
+ 'import/no-unresolved': ['error', { caseSensitiveStrict: true, ignore: ['@reach/router'] }],
42
+
36
43
  /**
37
44
  * eslint-plugin-unicorn
38
45
  *
@@ -80,6 +87,7 @@ module.exports = {
80
87
  * @see https://github.com/import-js/eslint-plugin-import
81
88
  */
82
89
  'import/no-default-export': 'off',
90
+ 'import/no-unused-modules': ['error', { missingExports: true }],
83
91
 
84
92
  /**
85
93
  * eslint-plugin-unicorn
@@ -42,6 +42,7 @@ module.exports = {
42
42
  * @see https://github.com/import-js/eslint-plugin-import
43
43
  */
44
44
  'import/no-commonjs': 'off',
45
+ 'import/no-import-module-exports': 'error',
45
46
  'import/no-internal-modules': 'off',
46
47
  'import/no-nodejs-modules': 'off',
47
48
 
@@ -66,6 +66,7 @@ module.exports = {
66
66
  'jest/no-alias-methods': 'error',
67
67
  'jest/no-commented-out-tests': 'error',
68
68
  'jest/no-conditional-expect': 'error',
69
+ 'jest/no-conditional-in-test': 'error',
69
70
  'jest/no-deprecated-functions': 'error',
70
71
  'jest/no-disabled-tests': 'error',
71
72
  'jest/no-done-callback': 'error',
@@ -74,7 +75,6 @@ module.exports = {
74
75
  'jest/no-focused-tests': 'error',
75
76
  'jest/no-hooks': ['error', { allow: ['beforeEach', 'afterEach', 'afterAll'] }],
76
77
  'jest/no-identical-title': 'error',
77
- 'jest/no-if': 'error',
78
78
  'jest/no-interpolation-in-snapshots': 'error',
79
79
  'jest/no-jasmine-globals': 'error',
80
80
  'jest/no-jest-import': 'error',
@@ -90,6 +90,7 @@ module.exports = {
90
90
  'jest/require-hook': 'error',
91
91
  'jest/prefer-comparison-matcher': 'error',
92
92
  'jest/prefer-equality-matcher': 'error',
93
+ 'jest/prefer-snapshot-hint': 'error',
93
94
  'jest/prefer-spy-on': 'error',
94
95
  'jest/prefer-strict-equal': 'error',
95
96
  'jest/prefer-to-be': 'error',
@@ -15,6 +15,19 @@ module.exports = {
15
15
  * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules
16
16
  */
17
17
  '@typescript-eslint/member-ordering': 'off', // For React components we are using react/sort-comp
18
+ '@typescript-eslint/explicit-function-return-type': ['error', {
19
+ allowedNames: [
20
+ 'componentDidCatch',
21
+ 'componentDidMount',
22
+ 'componentDidUpdate',
23
+ 'componentWillUnmount',
24
+ 'getDerivedStateFromError',
25
+ 'getDerivedStateFromProps',
26
+ 'getSnapshotBeforeUpdate',
27
+ 'render',
28
+ 'shouldComponentUpdate'
29
+ ]
30
+ }],
18
31
 
19
32
  /**
20
33
  * eslint-plugin-react-hooks
@@ -88,7 +101,7 @@ module.exports = {
88
101
  'react/prefer-stateless-function': 'error',
89
102
  'react/prop-types': 'off',
90
103
  'react/react-in-jsx-scope': 'error',
91
- 'react/require-default-props': ['error', { forbidDefaultForRequired: true, ignoreFunctionalComponents: true }], // @see https://medium.com/@matanbobi/react-defaultprops-is-dying-whos-the-contender-443c19d9e7f1
104
+ 'react/require-default-props': ['off', { forbidDefaultForRequired: true, ignoreFunctionalComponents: true }], // @see https://medium.com/@matanbobi/react-defaultprops-is-dying-whos-the-contender-443c19d9e7f1 @todo Also disabled becaues of false-positive with React.forwardRef(), create bug report?
92
105
  'react/require-optimization': 'error',
93
106
  'react/require-render-return': 'error',
94
107
  'react/self-closing-comp': 'error',
@@ -21,6 +21,7 @@ module.exports = {
21
21
  * @see https://github.com/import-js/eslint-plugin-import
22
22
  */
23
23
  'import/no-default-export': 'off',
24
+ 'import/no-unused-modules': 'off',
24
25
 
25
26
  /**
26
27
  * eslint-plugin-unicorn
package/lint.js CHANGED
@@ -121,7 +121,6 @@ const jobs = getTasksToRun(process.argv.splice(2)).map(({ taskName, config }) =>
121
121
  throw new Error(`"${taskName}" is not a valid task.`);
122
122
  });
123
123
 
124
- // eslint-disable-next-line unicorn/prefer-top-level-await -- The minimum required Node.js version is v14.8, but we are also support down till v14.0
125
124
  void (async () => {
126
125
  for (const { jobTitle, taskSetup, job } of jobs) {
127
126
  process.stdout.write(jobTitle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linter-bundle",
3
- "version": "2.3.0",
3
+ "version": "2.6.0",
4
4
  "description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -39,25 +39,25 @@
39
39
  "check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
40
40
  },
41
41
  "dependencies": {
42
- "@typescript-eslint/eslint-plugin": "5.10.1",
43
- "@typescript-eslint/parser": "5.10.1",
44
- "eslint": "8.7.0",
42
+ "@typescript-eslint/eslint-plugin": "5.12.0",
43
+ "@typescript-eslint/parser": "5.12.0",
44
+ "eslint": "8.9.0",
45
45
  "eslint-import-resolver-typescript": "2.5.0",
46
46
  "eslint-import-resolver-webpack": "0.13.2",
47
47
  "eslint-plugin-eslint-comments": "3.2.0",
48
- "eslint-plugin-functional": "4.1.1",
48
+ "eslint-plugin-functional": "4.2.0",
49
49
  "eslint-plugin-import": "2.25.4",
50
- "eslint-plugin-jest": "26.0.0",
51
- "eslint-plugin-jsdoc": "37.7.0",
50
+ "eslint-plugin-jest": "26.1.0",
51
+ "eslint-plugin-jsdoc": "37.9.1",
52
52
  "eslint-plugin-jsx-a11y": "6.5.1",
53
53
  "eslint-plugin-node": "11.1.0",
54
54
  "eslint-plugin-promise": "6.0.0",
55
55
  "eslint-plugin-react": "7.28.0",
56
56
  "eslint-plugin-react-hooks": "4.3.0",
57
57
  "eslint-plugin-unicorn": "40.1.0",
58
- "markdownlint-cli": "0.30.0",
58
+ "markdownlint-cli": "0.31.1",
59
59
  "postcss-scss": "4.0.3",
60
- "stylelint": "14.3.0",
60
+ "stylelint": "14.5.0",
61
61
  "stylelint-declaration-block-no-ignored-properties": "2.5.0",
62
62
  "stylelint-order": "5.0.0",
63
63
  "stylelint-scss": "4.1.0",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/eslint": "8.4.1",
73
- "@types/node": "17.0.12",
73
+ "@types/node": "17.0.17",
74
74
  "stylelint-find-new-rules": "^3.0.4",
75
75
  "typescript": "4.5.5"
76
76
  }
@@ -183,6 +183,7 @@ module.exports = {
183
183
  'function-linear-gradient-no-nonstandard-direction': true,
184
184
  'function-max-empty-lines': 0,
185
185
  'function-name-case': 'lower',
186
+ 'function-no-unknown': false, // @todo Create issue for false positives for "color.scale". Need this be covered by the `ignoreFunctions` option?
186
187
  'function-parentheses-newline-inside': 'always-multi-line',
187
188
  'function-parentheses-space-inside': 'never-single-line',
188
189
  'function-url-no-scheme-relative': true,
@@ -309,7 +310,12 @@ module.exports = {
309
310
  'unit-case': 'lower',
310
311
  'unit-disallowed-list': null,
311
312
  'unit-no-unknown': true,
312
- 'value-keyword-case': 'lower',
313
+ 'value-keyword-case': [
314
+ 'lower',
315
+ {
316
+ camelCaseSvgKeywords: true
317
+ }
318
+ ],
313
319
  'value-list-comma-newline-after': 'always-multi-line',
314
320
  'value-list-comma-newline-before': 'never-multi-line',
315
321
  'value-list-comma-space-after': 'always-single-line',