linter-bundle 2.3.1 → 2.7.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,51 @@ 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.3.1...HEAD)
9
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.7.0...HEAD)
10
+
11
+ ## [2.7.0] - 2022.02.16
12
+
13
+ - [eslint] Update `eslint-plugin-jest` from v26.1.0 to v26.1.1
14
+ - [stylelint] Update `stylelint` from v14.5.0 to v14.5.1
15
+ - [eslint] Activate `ignoreUsedVariables` option of [unicorn/prefer-export-from](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md) rule
16
+
17
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.6.0...v2.7.0)
18
+
19
+ ## [2.6.0] - 2022.02.14
20
+
21
+ - [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.11.0 to v5.12.0
22
+ - [eslint] Updated `@typescript-eslint/parser` from v5.11.0 to v5.12.0
23
+ - [eslint] Updated `eslint` from v8.8.0 to v8.9.0
24
+ - [eslint] Updated `eslint-plugin-jsdoc` from v37.8.2 to v37.9.1
25
+ - [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)
26
+
27
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.5.0...v2.6.0)
28
+
29
+ ## [2.5.0] - 2022.02.11
30
+
31
+ - [eslint] Updated `eslint-plugin-jsdoc` from v37.8.1 to v37.8.2
32
+ - [stylelint] Updated `stylelint` from v14.4.0 to v14.5.0
33
+ - [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.
34
+
35
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.4.0...v2.5.0)
36
+
37
+ ## [2.4.0] - 2022.02.09
38
+
39
+ - [eslint] Updated `@typescript-eslint/eslint-plugin` from v5.10.1 to v5.11.0
40
+ - [eslint] Updated `eslint` from v8.7.0 to v8.8.0
41
+ - [eslint] Updated `eslint-plugin-functional` from v4.1.1 to v4.2.0
42
+ - [eslint] Updated `eslint-plugin-jest` from v26.0.0 to v26.1.0
43
+ - [eslint] Updated `eslint-plugin-jsdoc` from v37.7.0 to v37.8.1
44
+ - [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`
45
+ - [stylelint] Updated `stylelint` from v14.3.0 to v14.4.0
46
+ - [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
47
+ - [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
48
+ - [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
49
+ - [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`
50
+ - [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
51
+ - [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
52
+
53
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.3.1...v2.4.0)
10
54
 
11
55
  ## [2.3.1] - 2022.01.28
12
56
 
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',
@@ -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', {
@@ -964,7 +966,7 @@ module.exports = {
964
966
  'unicorn/prefer-dom-node-dataset': 'off', // `setAttribute` is faster than `dataset`. See https://www.measurethat.net/Benchmarks/Show/7740/0/classname-vs-setattribute-vs-classlist-vs-dataset
965
967
  'unicorn/prefer-dom-node-remove': 'error',
966
968
  'unicorn/prefer-dom-node-text-content': 'error',
967
- 'unicorn/prefer-export-from': 'error',
969
+ 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
968
970
  'unicorn/prefer-includes': 'error',
969
971
  'unicorn/prefer-json-parse-buffer': 'error',
970
972
  'unicorn/prefer-keyboard-event-key': 'error',
@@ -87,6 +87,7 @@ module.exports = {
87
87
  * @see https://github.com/import-js/eslint-plugin-import
88
88
  */
89
89
  'import/no-default-export': 'off',
90
+ 'import/no-unused-modules': ['error', { missingExports: true }],
90
91
 
91
92
  /**
92
93
  * eslint-plugin-unicorn
@@ -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
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linter-bundle",
3
- "version": "2.3.1",
3
+ "version": "2.7.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.1",
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.1",
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.13",
73
+ "@types/node": "17.0.18",
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,