linter-bundle 2.1.0 → 2.3.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,48 @@ 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.1.0...HEAD)
9
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.2.0...HEAD)
10
+
11
+ ## [2.2.0] - 2022.01.27
12
+
13
+ ### Changed
14
+
15
+ - [eslint] In the `.vscode/settings.json` the "configFile" option in "eslint.options" has been renamed to "overrideConfigFile"
16
+ - [eslint] Re-added [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) v6.5.1
17
+ - [eslint] Re-added [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise) v6.0.0
18
+ - [eslint] Re-added [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) v7.28.0
19
+ - [stylelint] Re-added [`stylelint-declaration-block-no-ignored-properties`](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties) v2.5.0
20
+ - [eslint] Updated `eslint-plugin-react-hooks` from v4.2.1-alpha-13455d26d-20211104 to v4.3.0
21
+ - [eslint] Re-added [`react/no-invalid-html-attribute`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md) rule
22
+ - [eslint] Re-added [`react/no-arrow-function-lifecycle`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md) rule
23
+ - [eslint] Re-added [`react/no-unused-class-component-methods`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md) rule
24
+ - [eslint] Disabled [`unicorn/prefer-object-has-own`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-has-own.md) for now, because of limited engine support
25
+ - [eslint] Disabled `allowThrowingAny` and `allowThrowingUnknown` 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
26
+ - [eslint] Reactivated [`import/no-import-module-exports`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-import-module-exports.md) rule
27
+ - [eslint] Added new [`import/no-unused-modules`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md) rule
28
+ - [eslint] Added new [`jest/prefer-comparison-matcher`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md) rule
29
+ - [eslint] Added new [`jest/prefer-equality-matcher`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-equality-matcher.md) rule
30
+ - [eslint] Added new [`unicorn/no-await-expression-member`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-expression-member.md) rule
31
+ - [eslint] Added new [`unicorn/prefer-code-point`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-code-point.md) rule
32
+ - [eslint] Added new [`unicorn/no-thenable`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-thenable.md) rule
33
+ - [eslint] Added new [`unicorn/no-useless-promise-resolve-reject`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-promise-resolve-reject.md) rule
34
+ - [eslint] Added new [`unicorn/relative-url-style`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/relative-url-style.md) rule
35
+ - [eslint] Added new [`unicorn/prefer-json-parse-buffer`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-json-parse-buffer.md) rule
36
+ - [eslint] Updated `@typescript-eslint` from v5.3.0 to v5.10.1
37
+ - [eslint] Updated `eslint` from v8.2.0 to v8.7.0
38
+ - [eslint] Updated `eslint-plugin-functional` from v4.0.2 to v4.1.1
39
+ - [eslint] Updated `eslint-plugin-import` from v2.25.2 to v2.25.4
40
+ - [eslint] Updated `eslint-plugin-jest` from v25.2.3 to v26.0.0
41
+ - [eslint] Updated `eslint-plugin-jsdoc` from v37.0.3 to v37.7.0
42
+ - [eslint] Updated `eslint-plugin-unicode` from v38.0.0 to v40.1.0
43
+ - [markdownlint] Updated `markdownlint-cli` from v0.29.0 to v0.30.0
44
+ - [stylelint] Updated `stylelint` from v14.0.1 to v14.3.0
45
+ - [stylelint] Updated `stylelint-scss` from v4.0.0 to v4.1.0
46
+ - [stylelint] Added new [`scss/dollar-variable-no-namespaced-assignment`](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/dollar-variable-no-namespaced-assignment) rule
47
+ - [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
+ - [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
+
50
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.1.0...v2.2.0)
10
51
 
11
52
  ## [2.1.0] - 2021.11.07
12
53
 
@@ -23,7 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
23
64
 
24
65
  - [eslint] [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) has been removed, because it seems not to be regularly maintained anymore, which blocks us from updating to ESLint v8
25
66
  - [eslint] [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise) has been removed, because it seems not to be regularly maintained anymore, which blocks us from updating to ESLint v8
26
- - [eslint] [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) has been removed, because it's relying on unmaintained dependencies, which blocks us from updating to ESLint v8
67
+ - [eslint] [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) has been removed, because it's relying on unmaintained dependencies, which blocks us from updating to ESLint v8
27
68
  - [stylelint] [`stylelint-declaration-block-no-ignored-properties`](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties) has been removed, because it seems not to be regularly maintained anymore, which blocks us from updating to Stylelint v14
28
69
  - [stylelint] [`stylelint-use-nesting`](https://www.npmjs.com/package/stylelint-use-nesting) has been removed, because it seems not to be regularly maintained anymore, which blocks us from updating to Stylelint v14
29
70
 
package/README.md CHANGED
@@ -28,8 +28,11 @@ This setup is using the following additional plugins:
28
28
  - [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)
29
29
  - [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest)
30
30
  - [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc)
31
+ - [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)
31
32
  - [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node)
33
+ - [eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise)
32
34
  - [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)
35
+ - [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)
33
36
  - [eslint-plugin-unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn)
34
37
 
35
38
  Beside that, the following additional rules are part of this bundle:
@@ -38,22 +41,19 @@ Beside that, the following additional rules are part of this bundle:
38
41
 
39
42
  ### stylelint
40
43
 
44
+ - [stylelint-declaration-block-no-ignored-properties](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties)
41
45
  - [stylelint-high-performance-animation](https://www.npmjs.com/package/stylelint-high-performance-animation) (Forked version)
42
46
  - [stylelint-order](https://www.npmjs.com/package/stylelint-order)
43
47
  - [stylelint-scss](https://www.npmjs.com/package/stylelint-scss)
44
48
  - [stylelint-selector-no-empty](https://www.npmjs.com/package/stylelint-selector-no-empty)
45
- - [stylelint-use-logical-spec](https://www.npmjs.com/package/stylelint-use-logical-spec)
46
49
  - [stylelint-selector-tag-no-without-class](https://www.npmjs.com/package/stylelint-selector-tag-no-without-class) (Forked version)
50
+ - [stylelint-use-logical-spec](https://www.npmjs.com/package/stylelint-use-logical-spec)
47
51
 
48
52
  ### Previously used, but now unmaintained plugins
49
53
 
50
54
  Unfortunately a couple of previously used plugins are not regularly maintained or depend on unmaintained third-party code which blocks them from updating, so they don't provide updates for the major releases of the linters (ESLint and Stylelint).
51
55
  For that reason the following plugins are not used anymore:
52
56
 
53
- - [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) (removed on 2021-11-05)
54
- - [eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise) (removed on 2021-11-05)
55
- - [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) (removed on 2021-11-05)
56
- - [stylelint-declaration-block-no-ignored-properties](https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties) (removed on 2021-11-05)
57
57
  - [stylelint-use-nesting](https://www.npmjs.com/package/stylelint-use-nesting) (removed on 2021-11-05)
58
58
 
59
59
  If these plugins are maintained again, the plugins will also be used again.
@@ -318,7 +318,7 @@ This can be done by adding these options to your `.vscode/settings.json`:
318
318
  {
319
319
  "eslint.nodePath": "./node_modules/linter-bundle/node_modules/eslint",
320
320
  "eslint.options": {
321
- "configFile": "./.eslintrc.js",
321
+ "overrideConfigFile": "./.eslintrc.js",
322
322
  "resolvePluginsRelativeTo": "./node_modules/linter-bundle",
323
323
  "rulePaths": ["./node_modules/linter-bundle/eslint/rules"],
324
324
  "reportUnusedDisableDirectives": "error",
package/eslint/index.js CHANGED
@@ -22,7 +22,10 @@ module.exports = {
22
22
  'eslint-comments',
23
23
  'functional',
24
24
  'import',
25
+ 'jsx-a11y',
26
+ 'promise',
25
27
  'react-hooks',
28
+ 'react',
26
29
  'unicorn'
27
30
  ],
28
31
  extends: [
@@ -639,7 +642,10 @@ module.exports = {
639
642
  '@typescript-eslint/no-require-imports': 'error',
640
643
  '@typescript-eslint/no-shadow': 'error',
641
644
  '@typescript-eslint/no-this-alias': 'error',
642
- '@typescript-eslint/no-throw-literal': 'error',
645
+ '@typescript-eslint/no-throw-literal': ['error', {
646
+ allowThrowingAny: false,
647
+ allowThrowingUnknown: false
648
+ }],
643
649
  '@typescript-eslint/no-type-alias': ['off', { // @todo There should be an option like 'sub-in-unions-and-intersections', which allows `type A = (string | number)[];`
644
650
  allowAliases: 'always',
645
651
  allowCallbacks: 'always',
@@ -764,7 +770,7 @@ module.exports = {
764
770
  'workbox-window/utils/WorkboxEvent'
765
771
  ]
766
772
  }],
767
- 'import/no-import-module-exports': 'off', // @todo The rule reports files, which don't use `exports`. This must be a bug, report it!
773
+ 'import/no-import-module-exports': 'error',
768
774
  'import/no-mutable-exports': 'error',
769
775
  'import/no-named-as-default-member': 'error',
770
776
  'import/no-named-as-default': 'error',
@@ -809,6 +815,43 @@ module.exports = {
809
815
  'import/prefer-default-export': 'off',
810
816
  'import/unambiguous': 'off',
811
817
 
818
+ /**
819
+ * eslint-plugin-jsx-a11y
820
+ *
821
+ * @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
822
+ */
823
+ 'jsx-a11y/alt-text': 'error',
824
+ 'jsx-a11y/anchor-has-content': 'error',
825
+ 'jsx-a11y/anchor-is-valid': 'error',
826
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
827
+ 'jsx-a11y/aria-props': 'error',
828
+ 'jsx-a11y/aria-proptypes': 'error',
829
+ 'jsx-a11y/aria-role': 'error',
830
+ 'jsx-a11y/aria-unsupported-elements': 'error',
831
+ 'jsx-a11y/autocomplete-valid': 'error',
832
+ 'jsx-a11y/click-events-have-key-events': 'error',
833
+ 'jsx-a11y/heading-has-content': 'error',
834
+ 'jsx-a11y/html-has-lang': 'off', // <html> elements set by react-helmet automatically have a lang attribute set
835
+ 'jsx-a11y/iframe-has-title': 'error',
836
+ 'jsx-a11y/img-redundant-alt': 'error',
837
+ 'jsx-a11y/interactive-supports-focus': 'error',
838
+ 'jsx-a11y/label-has-associated-control': 'error',
839
+ 'jsx-a11y/media-has-caption': 'error',
840
+ 'jsx-a11y/mouse-events-have-key-events': 'error',
841
+ 'jsx-a11y/no-access-key': 'off', // If you explicitly specify an access key, you usually have a reason for this, so it should not be prevented by a rule
842
+ 'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
843
+ 'jsx-a11y/no-distracting-elements': 'error',
844
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
845
+ 'jsx-a11y/no-noninteractive-element-interactions': 'error',
846
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
847
+ 'jsx-a11y/no-noninteractive-tabindex': 'error',
848
+ 'jsx-a11y/no-redundant-roles': 'error',
849
+ 'jsx-a11y/no-static-element-interactions': 'error',
850
+ 'jsx-a11y/role-has-required-aria-props': 'error',
851
+ 'jsx-a11y/role-supports-aria-props': 'error',
852
+ 'jsx-a11y/scope': 'error',
853
+ 'jsx-a11y/tabindex-no-positive': 'error',
854
+
812
855
  /**
813
856
  * eslint-plugin-eslint-comments
814
857
  *
@@ -824,6 +867,26 @@ module.exports = {
824
867
  'eslint-comments/no-use': 'off',
825
868
  'eslint-comments/require-description': ['error', { ignore: ['eslint-enable'] }],
826
869
 
870
+ /**
871
+ * eslint-plugin-promise
872
+ *
873
+ * @see https://github.com/xjamundx/eslint-plugin-promise
874
+ */
875
+ 'promise/always-return': 'off', // If the result of an `.then()` is not used, there is no need to return something.
876
+ 'promise/avoid-new': 'off',
877
+ 'promise/catch-or-return': 'error',
878
+ 'promise/no-callback-in-promise': 'off',
879
+ 'promise/no-native': 'off',
880
+ 'promise/no-nesting': 'off',
881
+ 'promise/no-new-statics': 'error',
882
+ 'promise/no-promise-in-callback': 'off',
883
+ 'promise/no-return-in-finally': 'error',
884
+ 'promise/no-return-wrap': 'error',
885
+ 'promise/param-names': 'off', // @todo Disabled until this issue is fixed: https://github.com/xjamundx/eslint-plugin-promise/issues/206
886
+ 'promise/prefer-await-to-callbacks': 'off', // It's not always possible to use avoid callbacks.
887
+ 'promise/prefer-await-to-then': 'off', // Depending on the use-case `.then()`/`.catch()` might be easier to understand
888
+ 'promise/valid-params': 'off', // TypeScript ensures that
889
+
827
890
  /**
828
891
  * eslint-plugin-unicorn
829
892
  *
@@ -852,11 +915,12 @@ module.exports = {
852
915
  'unicorn/import-style': 'error',
853
916
  'unicorn/new-for-builtins': 'error',
854
917
  'unicorn/no-abusive-eslint-disable': 'error',
855
- 'unicorn/no-array-callback-reference': 'off', // If I use functions, they are specially developed for this use-case
918
+ 'unicorn/no-array-callback-reference': 'off', // If I use functions, they are the best option for this use-case
856
919
  'unicorn/no-array-for-each': 'error',
857
920
  'unicorn/no-array-method-this-argument': 'error',
858
921
  'unicorn/no-array-push-push': 'error',
859
922
  'unicorn/no-array-reduce': ['error', { allowSimpleOperations: true }],
923
+ 'unicorn/no-await-expression-member': 'error',
860
924
  'unicorn/no-console-spaces': 'error',
861
925
  'unicorn/no-document-cookie': 'error',
862
926
  'unicorn/no-empty-file': 'error',
@@ -872,11 +936,13 @@ module.exports = {
872
936
  'unicorn/no-object-as-default-parameter': 'error',
873
937
  'unicorn/no-process-exit': 'error',
874
938
  'unicorn/no-static-only-class': 'error',
939
+ 'unicorn/no-thenable': 'error',
875
940
  'unicorn/no-this-assignment': 'error',
876
941
  'unicorn/no-unreadable-array-destructuring': 'error',
877
942
  'unicorn/no-unsafe-regex': 'off',
878
943
  'unicorn/no-unused-properties': 'error',
879
944
  'unicorn/no-useless-fallback-in-spread': 'error',
945
+ 'unicorn/no-useless-promise-resolve-reject': 'error',
880
946
  'unicorn/no-invalid-remove-event-listener': 'error',
881
947
  'unicorn/no-useless-length-check': 'error',
882
948
  'unicorn/no-useless-spread': 'error',
@@ -891,6 +957,7 @@ module.exports = {
891
957
  'unicorn/prefer-array-index-of': 'error',
892
958
  'unicorn/prefer-array-some': 'error',
893
959
  'unicorn/prefer-at': 'off', // @todo Disabled for now, since `at` is not supported by TypeScript type definitions yet.
960
+ 'unicorn/prefer-code-point': 'error',
894
961
  'unicorn/prefer-date-now': 'error',
895
962
  'unicorn/prefer-default-parameters': 'error',
896
963
  'unicorn/prefer-dom-node-append': 'error',
@@ -899,13 +966,14 @@ module.exports = {
899
966
  'unicorn/prefer-dom-node-text-content': 'error',
900
967
  'unicorn/prefer-export-from': 'error',
901
968
  'unicorn/prefer-includes': 'error',
969
+ 'unicorn/prefer-json-parse-buffer': 'error',
902
970
  'unicorn/prefer-keyboard-event-key': 'error',
903
971
  'unicorn/prefer-math-trunc': 'error',
904
972
  'unicorn/prefer-modern-dom-apis': 'error',
905
973
  'unicorn/prefer-module': 'off',
906
974
  'unicorn/prefer-negative-index': 'error',
907
975
  'unicorn/prefer-number-properties': 'error',
908
- 'unicorn/prefer-object-has-own': 'error',
976
+ 'unicorn/prefer-object-has-own': 'off', // Not widely supported yet. Can be activated in 2024
909
977
  'unicorn/prefer-object-from-entries': 'error',
910
978
  'unicorn/prefer-optional-catch-binding': 'error',
911
979
  'unicorn/prefer-prototype-methods': 'error',
@@ -923,6 +991,7 @@ module.exports = {
923
991
  'unicorn/prefer-regexp-test': 'error',
924
992
  'unicorn/prefer-type-error': 'error',
925
993
  'unicorn/prevent-abbreviations': ['error', { ignore: ['args', 'i', 'j', 'i18n', 'ref', 'Ref', 'params', 'props', 'Props'] }],
994
+ 'unicorn/relative-url-style': 'error',
926
995
  'unicorn/require-array-join-separator': 'error',
927
996
  'unicorn/require-number-to-fixed-digits-argument': 'error',
928
997
  'unicorn/require-post-message-target-origin': 'off', // False-positive with Workers which don't support a `targetOrigin`
@@ -88,6 +88,8 @@ module.exports = {
88
88
  'jest/prefer-expect-resolves': 'off', // We prefer `expect(await promise)` enforced by 'jest/no-restricted-matchers'
89
89
  'jest/prefer-hooks-on-top': 'error',
90
90
  'jest/require-hook': 'error',
91
+ 'jest/prefer-comparison-matcher': 'error',
92
+ 'jest/prefer-equality-matcher': 'error',
91
93
  'jest/prefer-spy-on': 'error',
92
94
  'jest/prefer-strict-equal': 'error',
93
95
  'jest/prefer-to-be': 'error',
@@ -24,8 +24,8 @@ module.exports = {
24
24
  */
25
25
  'jsdoc/check-access': 'error',
26
26
  'jsdoc/check-alignment': 'error',
27
- 'jsdoc/check-examples': 'off', // @todo need to be configured to allow text-based examples
28
- 'jsdoc/check-indentation': ['off', { excludeTags: ['typedef'] }],
27
+ 'jsdoc/check-examples': 'off', // @todo Need to be configured to allow text-based examples
28
+ 'jsdoc/check-indentation': ['off', { excludeTags: ['typedef'] }], // @todo Why is this disabled?
29
29
  'jsdoc/check-param-names': 'error',
30
30
  'jsdoc/check-syntax': 'error',
31
31
  'jsdoc/check-line-alignment': 'error',
@@ -2,6 +2,8 @@
2
2
  * @file Settings for React code in TypeScript (TSX) files.
3
3
  */
4
4
 
5
+ const ensureType = require('../helper/ensure-type');
6
+
5
7
  module.exports = {
6
8
  overrides: [
7
9
  {
@@ -21,7 +23,143 @@ module.exports = {
21
23
  * @see https://reactjs.org/docs/hooks-rules.html
22
24
  */
23
25
  'react-hooks/rules-of-hooks': 'error',
24
- 'react-hooks/exhaustive-deps': 'error'
26
+ 'react-hooks/exhaustive-deps': 'error',
27
+
28
+ /**
29
+ * eslint-plugin-react
30
+ *
31
+ * @see https://github.com/yannickcr/eslint-plugin-react
32
+ */
33
+ 'react/boolean-prop-naming': 'error',
34
+ 'react/button-has-type': 'error',
35
+ 'react/default-props-match-prop-types': 'error',
36
+ 'react/destructuring-assignment': 'off', // Sometimes destructuring makes sense, sometimes it doesn't - that depends on the context.
37
+ 'react/display-name': 'error',
38
+ 'react/forbid-component-props': ['error', { forbid: [
39
+ {
40
+ propName: 'className',
41
+ allowedFor: ensureType.array(global.linterBundleSettings?.overrides?.react?.['react/forbid-component-props']?.allowClassNameFor)
42
+ },
43
+ {
44
+ propName: 'style',
45
+ allowedFor: ensureType.array(global.linterBundleSettings?.overrides?.react?.['react/forbid-component-props']?.allowStyleFor)
46
+ }
47
+ ] }],
48
+ 'react/forbid-dom-props': 'error',
49
+ 'react/forbid-elements': 'error',
50
+ 'react/forbid-prop-types': 'error',
51
+ 'react/forbid-foreign-prop-types': 'error',
52
+ 'react/function-component-definition': ['off', { // @todo Doesn't work with Component-Factories, which shall return named components `return function MyComponent () {}`, while in modules, `const MyComponent = () => {}` shall be used
53
+ namedComponents: 'arrow-function',
54
+ unnamedComponents: 'arrow-function'
55
+ }],
56
+ 'react/no-access-state-in-setstate': 'error',
57
+ 'react/no-array-index-key': 'error',
58
+ 'react/no-arrow-function-lifecycle': 'error',
59
+ 'react/no-children-prop': 'error',
60
+ 'react/no-danger': 'off',
61
+ 'react/no-danger-with-children': 'error',
62
+ 'react/no-deprecated': 'error',
63
+ 'react/no-did-mount-set-state': 'error',
64
+ 'react/no-did-update-set-state': 'error',
65
+ 'react/no-direct-mutation-state': 'error',
66
+ 'react/no-find-dom-node': 'error',
67
+ 'react/no-invalid-html-attribute': 'error',
68
+ 'react/no-is-mounted': 'error',
69
+ 'react/no-multi-comp': 'error',
70
+ 'react/no-namespace': 'error',
71
+ 'react/no-redundant-should-component-update': 'error',
72
+ 'react/no-render-return-value': 'error',
73
+ 'react/no-set-state': 'off',
74
+ 'react/no-typos': 'error',
75
+ 'react/no-string-refs': 'error',
76
+ 'react/no-this-in-sfc': 'error',
77
+ 'react/no-unescaped-entities': 'error',
78
+ 'react/no-unknown-property': 'error',
79
+ 'react/no-unsafe': 'error',
80
+ 'react/no-unstable-nested-components': 'error',
81
+ 'react/no-unused-class-component-methods': 'error',
82
+ 'react/no-unused-prop-types': 'error',
83
+ 'react/no-unused-state': 'error',
84
+ 'react/no-will-update-set-state': 'error',
85
+ 'react/prefer-es6-class': 'error',
86
+ 'react/prefer-exact-props': 'off', // With TypeScript interfaces, this rule is not required
87
+ 'react/prefer-read-only-props': 'error',
88
+ 'react/prefer-stateless-function': 'error',
89
+ 'react/prop-types': 'off',
90
+ '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
92
+ 'react/require-optimization': 'error',
93
+ 'react/require-render-return': 'error',
94
+ 'react/self-closing-comp': 'error',
95
+ 'react/sort-comp': ['error', {
96
+ order: [
97
+ 'type-annotations',
98
+ 'static-variables',
99
+ 'instance-variables',
100
+ 'getters',
101
+ 'setters',
102
+ 'lifecycle',
103
+ 'render',
104
+ '/^render.+$/',
105
+ '/^handle.+$/',
106
+ 'everything-else',
107
+ 'instance-methods',
108
+ 'static-methods'
109
+ ]
110
+ }],
111
+ 'react/sort-prop-types': 'error',
112
+ 'react/state-in-constructor': 'error',
113
+ 'react/static-property-placement': 'error',
114
+ 'react/style-prop-object': 'error',
115
+ 'react/void-dom-elements-no-children': 'error',
116
+
117
+ // JSX-specific rules
118
+ 'react/jsx-boolean-value': ['error', 'always'],
119
+ 'react/jsx-child-element-spacing': 'off', // @todo Why is this disabled? Could it be, that the faulty behaviour is fixed in the meantime?
120
+ 'react/jsx-closing-bracket-location': 'error',
121
+ 'react/jsx-closing-tag-location': 'error',
122
+ 'react/jsx-curly-newline': 'off',
123
+ 'react/jsx-curly-spacing': 'error',
124
+ 'react/jsx-equals-spacing': 'error',
125
+ 'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
126
+ 'react/jsx-first-prop-new-line': 'error',
127
+ 'react/jsx-handler-names': 'off', // @todo There should be an option which checks if the function is used multiple times in a class (like this.closeTooltip()) - in that case, the 'handle' prefix should not be mandatory
128
+ 'react/jsx-indent': ['error', 'tab', { checkAttributes: true, indentLogicalExpressions: true }],
129
+ 'react/jsx-indent-props': ['error', 'tab'],
130
+ 'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true }],
131
+ 'react/jsx-max-depth': ['error', { max: 8 }],
132
+ 'react/jsx-max-props-per-line': ['error', { maximum: { single: 5, multi: 1 } }],
133
+ 'react/no-adjacent-inline-elements': 'off', // @todo There is an issue if inline and block elements are mixed. Simple example: `<span>Text</span><br />` here, the space between the SPAN and BR should not be forced, because a space at the end of a line does not make sense.
134
+ 'react/jsx-newline': 'off',
135
+ 'react/jsx-no-bind': ['error', { ignoreDOMComponents: true }],
136
+ 'react/jsx-no-comment-textnodes': 'error',
137
+ 'react/jsx-no-constructed-context-values': 'error',
138
+ 'react/jsx-no-duplicate-props': 'error',
139
+ 'react/jsx-no-literals': 'off',
140
+ 'react/jsx-no-script-url': 'error',
141
+ 'react/jsx-no-target-blank': ['error', { allowReferrer: true, forms: true }],
142
+ 'react/jsx-no-undef': 'error',
143
+ 'react/jsx-no-useless-fragment': 'error',
144
+ 'react/jsx-one-expression-per-line': ['off', { allow: 'single-child' }], // @todo Doesn't work with something like "Text <a href="...">Link</a> More Text", which should be valid
145
+ 'react/jsx-curly-brace-presence': 'error',
146
+ 'react/jsx-fragments': ['error', 'element'],
147
+ 'react/jsx-pascal-case': ['error', { allowAllCaps: true }],
148
+ 'react/jsx-props-no-multi-spaces': 'error',
149
+ 'react/jsx-props-no-spreading': 'off',
150
+ 'react/jsx-sort-default-props': 'error',
151
+ 'react/jsx-sort-props': ['error', {
152
+ ignoreCase: true,
153
+ callbacksLast: true,
154
+ shorthandFirst: true,
155
+ shorthandLast: false,
156
+ noSortAlphabetically: true,
157
+ reservedFirst: true
158
+ }],
159
+ 'react/jsx-tag-spacing': 'error',
160
+ 'react/jsx-uses-react': 'error',
161
+ 'react/jsx-uses-vars': 'error',
162
+ 'react/jsx-wrap-multilines': 'error'
25
163
  }
26
164
  }
27
165
  ]
package/lint.js CHANGED
@@ -121,6 +121,7 @@ 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
124
125
  void (async () => {
125
126
  for (const { jobTitle, taskSetup, job } of jobs) {
126
127
  process.stdout.write(jobTitle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linter-bundle",
3
- "version": "2.1.0",
3
+ "version": "2.3.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,24 +39,28 @@
39
39
  "check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
40
40
  },
41
41
  "dependencies": {
42
- "@typescript-eslint/eslint-plugin": "5.3.0",
43
- "@typescript-eslint/parser": "5.3.0",
44
- "eslint": "8.2.0",
42
+ "@typescript-eslint/eslint-plugin": "5.10.1",
43
+ "@typescript-eslint/parser": "5.10.1",
44
+ "eslint": "8.7.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.0.2",
49
- "eslint-plugin-import": "2.25.2",
50
- "eslint-plugin-jest": "25.2.3",
51
- "eslint-plugin-jsdoc": "37.0.3",
48
+ "eslint-plugin-functional": "4.1.1",
49
+ "eslint-plugin-import": "2.25.4",
50
+ "eslint-plugin-jest": "26.0.0",
51
+ "eslint-plugin-jsdoc": "37.7.0",
52
+ "eslint-plugin-jsx-a11y": "6.5.1",
52
53
  "eslint-plugin-node": "11.1.0",
53
- "eslint-plugin-react-hooks": "4.2.1-alpha-13455d26d-20211104",
54
- "eslint-plugin-unicorn": "38.0.0",
55
- "markdownlint-cli": "0.29.0",
56
- "postcss-scss": "4.0.2",
57
- "stylelint": "14.0.1",
54
+ "eslint-plugin-promise": "6.0.0",
55
+ "eslint-plugin-react": "7.28.0",
56
+ "eslint-plugin-react-hooks": "4.3.0",
57
+ "eslint-plugin-unicorn": "40.1.0",
58
+ "markdownlint-cli": "0.30.0",
59
+ "postcss-scss": "4.0.3",
60
+ "stylelint": "14.3.0",
61
+ "stylelint-declaration-block-no-ignored-properties": "2.5.0",
58
62
  "stylelint-order": "5.0.0",
59
- "stylelint-scss": "4.0.0",
63
+ "stylelint-scss": "4.1.0",
60
64
  "stylelint-selector-no-empty": "1.0.8",
61
65
  "stylelint-use-logical-spec": "3.2.2"
62
66
  },
@@ -65,9 +69,9 @@
65
69
  "postcss-value-parser": "*"
66
70
  },
67
71
  "devDependencies": {
68
- "@types/eslint": "7.28.2",
69
- "@types/node": "16.11.6",
72
+ "@types/eslint": "8.4.1",
73
+ "@types/node": "17.0.12",
70
74
  "stylelint-find-new-rules": "^3.0.4",
71
- "typescript": "4.4.4"
75
+ "typescript": "4.5.5"
72
76
  }
73
77
  }
@@ -12,6 +12,7 @@ module.exports = {
12
12
  reportDescriptionlessDisables: true,
13
13
  customSyntax: 'postcss-scss',
14
14
  plugins: [
15
+ 'stylelint-declaration-block-no-ignored-properties',
15
16
  'stylelint-order',
16
17
  'stylelint-scss',
17
18
  'stylelint-selector-no-empty',
@@ -242,6 +243,7 @@ module.exports = {
242
243
  ],
243
244
  'property-no-unknown': true,
244
245
  'property-no-vendor-prefix': true,
246
+ 'rule-selector-property-disallowed-list': null,
245
247
  'rule-empty-line-before': [
246
248
  'always-multi-line',
247
249
  {
@@ -315,6 +317,13 @@ module.exports = {
315
317
  'value-list-max-empty-lines': 0,
316
318
  'value-no-vendor-prefix': true,
317
319
 
320
+ /**
321
+ * stylelint-declaration-block-no-ignored-properties
322
+ *
323
+ * @see https://www.npmjs.com/package/stylelint-declaration-block-no-ignored-properties
324
+ */
325
+ 'plugin/declaration-block-no-ignored-properties': true,
326
+
318
327
  /**
319
328
  * stylelint-high-performance-animation
320
329
  *
@@ -839,6 +848,7 @@ module.exports = {
839
848
  'scss/at-mixin-pattern': '^[a-z]+(-[a-z]+)*$',
840
849
  'scss/at-rule-conditional-no-parentheses': true,
841
850
  'scss/at-rule-no-unknown': true,
851
+ 'scss/at-use-no-unnamespaced': true,
842
852
  'scss/comment-no-empty': true,
843
853
  'scss/comment-no-loud': true,
844
854
  'scss/declaration-nested-properties-no-divided-groups': true,
@@ -862,6 +872,7 @@ module.exports = {
862
872
  ],
863
873
  'scss/dollar-variable-first-in-block': [true, { ignore: ['comments', 'imports'] }],
864
874
  'scss/dollar-variable-no-missing-interpolation': true,
875
+ 'scss/dollar-variable-no-namespaced-assignment': true,
865
876
  'scss/dollar-variable-pattern': '^[a-z]+(-[a-z]+)*$',
866
877
  'scss/double-slash-comment-empty-line-before': [
867
878
  'always',