linter-bundle 6.3.0 → 7.1.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/.linter-bundle.js +27 -17
- package/.linter-bundle.schema.json +45 -0
- package/CHANGELOG.md +146 -3
- package/README.md +56 -63
- package/TODO.md +0 -58
- package/eslint/gatsby.mjs +95 -0
- package/eslint/index.mjs +1146 -0
- package/eslint/javascript-lazy.mjs +24 -0
- package/eslint/javascript.mjs +126 -0
- package/eslint/jest.mjs +175 -0
- package/eslint/jsdoc.mjs +103 -0
- package/eslint/react.mjs +244 -0
- package/eslint/rules/enforce-logical-expression-parens.md +31 -0
- package/eslint/rules/enforce-logical-expression-parens.mjs +39 -0
- package/eslint/rules/enforce-ternary-parens.md +29 -0
- package/eslint/rules/enforce-ternary-parens.mjs +39 -0
- package/eslint/rules/ensure-lucide-import-consistency.md +38 -0
- package/eslint/rules/ensure-lucide-import-consistency.mjs +112 -0
- package/eslint/rules/helper/is-parenthesized.mjs +40 -0
- package/eslint/rules/no-extra-spaces-in-generics.md +25 -0
- package/eslint/rules/no-extra-spaces-in-generics.mjs +55 -0
- package/eslint/rules/no-ternary-return.md +29 -0
- package/eslint/rules/no-ternary-return.mjs +50 -0
- package/eslint/rules/no-unnecessary-typeof.md +1 -1
- package/eslint/rules/{no-unnecessary-typeof.js → no-unnecessary-typeof.mjs} +14 -21
- package/eslint/rules/restricted-filenames.md +4 -4
- package/eslint/rules/{restricted-filenames.js → restricted-filenames.mjs} +7 -7
- package/eslint/storybook.mjs +42 -0
- package/eslint/type-declarations.mjs +49 -0
- package/eslint/{overrides-worker.cjs → worker.mjs} +12 -14
- package/eslint.mjs +5 -0
- package/files/index.js +3 -3
- package/helper/{ensure-type.cjs → ensure-type.mjs} +7 -6
- package/helper/get-git-files.js +1 -1
- package/helper/get-outdated-dependencies.js +4 -4
- package/helper/get-outdated-overrides.js +2 -2
- package/helper/get-stylelint-path.js +4 -3
- package/helper/is-npm-or-yarn.js +2 -2
- package/helper/linter-bundle-config.js +9 -14
- package/helper/run-process.js +6 -4
- package/lint.js +33 -24
- package/package.json +32 -29
- package/stylelint/index.mjs +1111 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/{index.cjs → index.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/{selectors.cjs → selectors.mjs} +15 -31
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/{index.cjs → index.mjs} +6 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/{index.cjs → index.mjs} +11 -13
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/{index.cjs → index.mjs} +18 -22
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/{index.cjs → index.mjs} +10 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{atRuleNameSpaceChecker.cjs → atRuleNameSpaceChecker.mjs} +4 -3
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/{index.cjs → index.mjs} +16 -30
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/{index.cjs → index.mjs} +13 -35
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/{index.cjs → index.mjs} +11 -40
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/{index.cjs → index.mjs} +10 -27
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/{index.cjs → index.mjs} +14 -65
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/{index.cjs → index.mjs} +13 -30
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/{index.cjs → index.mjs} +14 -27
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/{index.cjs → index.mjs} +10 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +93 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/{index.cjs → index.mjs} +11 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/{index.cjs → index.mjs} +11 -29
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/{index.cjs → index.mjs} +9 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/{index.cjs → index.mjs} +10 -23
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/{index.cjs → index.mjs} +11 -36
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/{index.cjs → index.mjs} +9 -27
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/{index.cjs → index.mjs} +9 -25
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationBangSpaceChecker.cjs → declarationBangSpaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationColonSpaceChecker.cjs → declarationColonSpaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{findMediaOperator.cjs → findMediaOperator.mjs} +2 -2
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/{index.cjs → index.mjs} +19 -39
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/{index.cjs → index.mjs} +19 -54
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/{index.cjs → index.mjs} +21 -68
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/{index.cjs → index.mjs} +16 -31
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceChecker.cjs → functionCommaSpaceChecker.mjs} +8 -7
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceFix.cjs → functionCommaSpaceFix.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/{index.cjs → index.mjs} +39 -64
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/{index.cjs → index.mjs} +15 -44
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/{index.cjs → index.mjs} +10 -49
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/{index.cjs → index.mjs} +10 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/{index.cjs → index.mjs} +9 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/{index.cjs → index.mjs} +8 -21
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/{index.cjs → index.mjs} +8 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaFeatureColonSpaceChecker.cjs → mediaFeatureColonSpaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaQueryListCommaWhitespaceChecker.cjs → mediaQueryListCommaWhitespaceChecker.mjs} +6 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/{index.cjs → index.mjs} +6 -20
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/{index.cjs → index.mjs} +13 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/{index.cjs → index.mjs} +10 -33
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/{index.cjs → index.mjs} +7 -13
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/{index.cjs → index.mjs} +13 -31
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/{index.cjs → index.mjs} +9 -18
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/{index.cjs → index.mjs} +10 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/{index.cjs → index.mjs} +9 -36
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/{index.cjs → index.mjs} +9 -20
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/{index.cjs → index.mjs} +9 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/{index.cjs → index.mjs} +7 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/{index.cjs → index.mjs} +10 -21
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/{index.cjs → index.mjs} +10 -24
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/{index.cjs → index.mjs} +12 -35
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/{index.cjs → index.mjs} +10 -15
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorAttributeOperatorSpaceChecker.cjs → selectorAttributeOperatorSpaceChecker.mjs} +6 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorCombinatorSpaceChecker.cjs → selectorCombinatorSpaceChecker.mjs} +12 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorListCommaWhitespaceChecker.cjs → selectorListCommaWhitespaceChecker.mjs} +5 -4
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/{index.cjs → index.mjs} +43 -65
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/{index.cjs → index.mjs} +5 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/{index.cjs → index.mjs} +17 -34
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/{index.cjs → index.mjs} +11 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/{index.cjs → index.mjs} +10 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/{index.cjs → index.mjs} +12 -18
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{valueListCommaWhitespaceChecker.cjs → valueListCommaWhitespaceChecker.mjs} +6 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/{index.cjs → index.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{addEmptyLineAfter.cjs → addEmptyLineAfter.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{hasEmptyBlock.cjs → hasEmptyBlock.mjs} +2 -2
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{nextNonCommentNode.cjs → nextNonCommentNode.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{removeEmptyLinesAfter.cjs → removeEmptyLinesAfter.mjs} +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/transformSelector.mjs +19 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{whitespaceChecker.cjs → whitespaceChecker.mjs} +5 -5
- package/stylelint/plugins/stylelint-selector-no-empty.js +2 -0
- package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +2 -2
- package/stylelint.mjs +6 -0
- package/eslint/index.cjs +0 -1071
- package/eslint/overrides-gatsby.cjs +0 -108
- package/eslint/overrides-javascript-lazy.cjs +0 -27
- package/eslint/overrides-javascript.cjs +0 -121
- package/eslint/overrides-jest.cjs +0 -144
- package/eslint/overrides-jsdoc.cjs +0 -94
- package/eslint/overrides-react.cjs +0 -220
- package/eslint/overrides-storybook.cjs +0 -44
- package/eslint/overrides-type-declarations.cjs +0 -51
- package/eslint/rules/no-global-undefined-check.js +0 -85
- package/eslint/rules/no-global-undefined-check.md +0 -34
- package/eslint/rules/package.json +0 -8
- package/eslint.cjs +0 -5
- package/stylelint/index.cjs +0 -1104
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +0 -95
- package/stylelint.cjs +0 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Extends `./javascript` but ignores unsafe types.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import javascriptExtends from './javascript.mjs';
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
...javascriptExtends,
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
11
|
+
rules: {
|
|
12
|
+
/**
|
|
13
|
+
* typescript-eslint
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules
|
|
16
|
+
*/
|
|
17
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
18
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
19
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
20
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
21
|
+
'@typescript-eslint/no-unsafe-return': 'off'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
];
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Settings for JavaScript (Node.js) files.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import nPlugin from 'eslint-plugin-n';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
globals: {
|
|
13
|
+
...globals.es2015,
|
|
14
|
+
...globals.node
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
plugins: {
|
|
18
|
+
n: nPlugin
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
/**
|
|
22
|
+
* eslint
|
|
23
|
+
*
|
|
24
|
+
* @see https://eslint.org/docs/rules/
|
|
25
|
+
*/
|
|
26
|
+
'max-lines-per-function': 'off',
|
|
27
|
+
'no-undef': 'error',
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* typescript-eslint
|
|
31
|
+
*
|
|
32
|
+
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules
|
|
33
|
+
*/
|
|
34
|
+
'@typescript-eslint/explicit-function-return-type': 'off', // Requires type information (@see https://github.com/typescript-eslint/typescript-eslint/issues/906)
|
|
35
|
+
'@typescript-eslint/explicit-member-accessibility': 'off', // @todo This function should also consider JSDoc @public/@private, but it doesn't do that yet, so create an ticket.
|
|
36
|
+
'@typescript-eslint/naming-convention': 'off', // Requires type information
|
|
37
|
+
'@typescript-eslint/no-implicit-any-catch': 'off', // @todo What's the correct way to define the type of the error-parameter in js files?
|
|
38
|
+
'@typescript-eslint/no-require-imports': 'off', // Requires type information
|
|
39
|
+
'@typescript-eslint/no-unsafe-assignment': 'off', // @todo Reactivate after bug in @typescript-eslint is fixed (@see https://github.com/typescript-eslint/typescript-eslint/issues/1943)
|
|
40
|
+
'@typescript-eslint/no-var-requires': 'off', // Requires type information
|
|
41
|
+
'@typescript-eslint/triple-slash-reference': 'off', // Required to make use of *.d.ts files
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* eslint-plugin-import
|
|
45
|
+
*
|
|
46
|
+
* @see https://github.com/import-js/eslint-plugin-import
|
|
47
|
+
*/
|
|
48
|
+
'import/no-commonjs': 'off',
|
|
49
|
+
'import/no-import-module-exports': 'error',
|
|
50
|
+
'import/no-internal-modules': 'off',
|
|
51
|
+
'import/no-nodejs-modules': 'off',
|
|
52
|
+
'import/dynamic-import-chunkname': 'off',
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* eslint-plugin-n
|
|
56
|
+
*
|
|
57
|
+
* @see https://github.com/eslint-community/eslint-plugin-n
|
|
58
|
+
*/
|
|
59
|
+
'n/callback-return': 'error',
|
|
60
|
+
'n/exports-style': 'error',
|
|
61
|
+
'n/file-extension-in-import': 'error',
|
|
62
|
+
'n/global-require': 'off',
|
|
63
|
+
'n/handle-callback-err': 'error',
|
|
64
|
+
'n/no-callback-literal': 'error',
|
|
65
|
+
'n/no-deprecated-api': 'error',
|
|
66
|
+
'n/no-exports-assign': 'error',
|
|
67
|
+
'n/no-extraneous-import': 'error',
|
|
68
|
+
'n/no-extraneous-require': 'error',
|
|
69
|
+
'n/no-missing-import': 'error',
|
|
70
|
+
'n/no-missing-require': 'error',
|
|
71
|
+
'n/no-mixed-requires': 'error',
|
|
72
|
+
'n/no-new-require': 'error',
|
|
73
|
+
'n/no-path-concat': 'error',
|
|
74
|
+
'n/no-process-env': 'error',
|
|
75
|
+
'n/no-process-exit': 'error',
|
|
76
|
+
'n/no-restricted-import': 'error',
|
|
77
|
+
'n/no-restricted-require': 'error',
|
|
78
|
+
'n/no-sync': 'off', // Since the .js files are used in the CLI, preventing the use of sync functions is not required
|
|
79
|
+
'n/no-unpublished-bin': 'error',
|
|
80
|
+
'n/no-unpublished-import': 'error',
|
|
81
|
+
'n/no-unpublished-require': 'off', // Since we use .js files only for the dev-environment, we don't need this rule
|
|
82
|
+
'n/no-unsupported-features/es-builtins': 'error',
|
|
83
|
+
'n/no-unsupported-features/es-syntax': 'error',
|
|
84
|
+
'n/no-unsupported-features/node-builtins': 'error',
|
|
85
|
+
'n/prefer-global/buffer': 'error',
|
|
86
|
+
'n/prefer-global/console': 'error',
|
|
87
|
+
'n/prefer-global/process': 'error',
|
|
88
|
+
'n/prefer-global/text-decoder': 'error',
|
|
89
|
+
'n/prefer-global/text-encoder': 'error',
|
|
90
|
+
'n/prefer-global/url-search-params': 'error',
|
|
91
|
+
'n/prefer-global/url': 'error',
|
|
92
|
+
'n/prefer-promises/dns': 'error',
|
|
93
|
+
'n/prefer-promises/fs': 'error',
|
|
94
|
+
'n/process-exit-as-throw': 'error',
|
|
95
|
+
'n/shebang': 'error',
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* eslint-plugin-unicorn
|
|
99
|
+
*
|
|
100
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
101
|
+
*/
|
|
102
|
+
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
103
|
+
cases: {
|
|
104
|
+
kebabCase: true
|
|
105
|
+
}
|
|
106
|
+
}],
|
|
107
|
+
'unicorn/no-process-exit': 'off', // n/no-process-exit
|
|
108
|
+
'unicorn/prefer-module': 'error',
|
|
109
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
110
|
+
'unicorn/prevent-abbreviations': ['error', { ignore: ['args', 'dev', 'env', 'i', 'j', 'i18n', 'pkg', /[Rr]ef/u, 'req', 'res', 'setupDevServerMiddleware'] }],
|
|
111
|
+
'unicorn/text-encoding-identifier-case': 'off'
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
files: ['**/*.mjs'],
|
|
116
|
+
rules: {
|
|
117
|
+
'unicorn/prefer-top-level-await': 'error'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
files: ['**/*.js'],
|
|
122
|
+
rules: {
|
|
123
|
+
'unicorn/prefer-module': 'off'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
];
|
package/eslint/jest.mjs
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Settings for Jest based unit tests.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
6
|
+
|
|
7
|
+
import jestPlugin from 'eslint-plugin-jest';
|
|
8
|
+
import globals from 'globals';
|
|
9
|
+
|
|
10
|
+
const jestVersion = await getJestVersion();
|
|
11
|
+
|
|
12
|
+
export default [
|
|
13
|
+
{
|
|
14
|
+
files: ['**/__tests__/**/*.[jt]s', '**/?(*.)+(spec|test).[jt]s'],
|
|
15
|
+
languageOptions: {
|
|
16
|
+
globals: {
|
|
17
|
+
...globals.jest
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
settings: {
|
|
21
|
+
jest: {
|
|
22
|
+
version: jestVersion
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
plugins: {
|
|
26
|
+
jest: jestPlugin
|
|
27
|
+
},
|
|
28
|
+
rules: {
|
|
29
|
+
/**
|
|
30
|
+
* eslint
|
|
31
|
+
*
|
|
32
|
+
* @see https://eslint.org/docs/rules/
|
|
33
|
+
*/
|
|
34
|
+
'max-lines': 'off',
|
|
35
|
+
'max-lines-per-function': 'off',
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* typescript-eslint
|
|
39
|
+
*
|
|
40
|
+
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules
|
|
41
|
+
*/
|
|
42
|
+
'@typescript-eslint/ban-ts-comment': ['error', {
|
|
43
|
+
'ts-expect-error': false
|
|
44
|
+
}],
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* eslint-plugin-import
|
|
48
|
+
*
|
|
49
|
+
* @see https://github.com/import-js/eslint-plugin-import
|
|
50
|
+
*/
|
|
51
|
+
'import/no-unassigned-import': 'error',
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* eslint-plugin-jest
|
|
55
|
+
*
|
|
56
|
+
* @see https://github.com/jest-community/eslint-plugin-jest/tree/master/docs/rules
|
|
57
|
+
*/
|
|
58
|
+
'jest/consistent-test-it': 'error',
|
|
59
|
+
'jest/expect-expect': 'error',
|
|
60
|
+
'jest/prefer-lowercase-title': ['error', { ignore: ['describe'] }],
|
|
61
|
+
'jest/max-expects': 'error',
|
|
62
|
+
'jest/max-nested-describe': 'error',
|
|
63
|
+
'jest/no-alias-methods': 'error',
|
|
64
|
+
'jest/no-commented-out-tests': 'error',
|
|
65
|
+
'jest/no-conditional-expect': 'error',
|
|
66
|
+
'jest/no-conditional-in-test': 'error',
|
|
67
|
+
'jest/no-confusing-set-timeout': 'error',
|
|
68
|
+
'jest/no-deprecated-functions': 'error',
|
|
69
|
+
'jest/no-disabled-tests': 'error',
|
|
70
|
+
'jest/no-done-callback': 'error',
|
|
71
|
+
'jest/no-duplicate-hooks': 'error',
|
|
72
|
+
'jest/no-export': 'error',
|
|
73
|
+
'jest/no-focused-tests': 'error',
|
|
74
|
+
'jest/no-hooks': ['error', { allow: ['beforeEach', 'afterEach', 'afterAll'] }],
|
|
75
|
+
'jest/no-identical-title': 'error',
|
|
76
|
+
'jest/no-interpolation-in-snapshots': 'error',
|
|
77
|
+
'jest/no-jasmine-globals': 'error',
|
|
78
|
+
'jest/no-large-snapshots': 'error',
|
|
79
|
+
'jest/no-mocks-import': 'error',
|
|
80
|
+
'jest/no-restricted-jest-methods': 'off', // Right now, there are no specific restrictions
|
|
81
|
+
'jest/no-restricted-matchers': ['error', {
|
|
82
|
+
resolves: 'Use `expect(await promise)` instead.',
|
|
83
|
+
toBeFalsy: 'Avoid `toBeFalsy`',
|
|
84
|
+
toBeTruthy: 'Avoid `toBeTruthy`',
|
|
85
|
+
toMatchSnapshot: 'Use `toMatchInlineSnapshot()` instead',
|
|
86
|
+
toThrowErrorMatchingSnapshot: 'Use `toThrowErrorMatchingInlineSnapshot()` instead'
|
|
87
|
+
}],
|
|
88
|
+
'jest/no-standalone-expect': 'error',
|
|
89
|
+
'jest/no-test-prefixes': 'error',
|
|
90
|
+
'jest/no-test-return-statement': 'error',
|
|
91
|
+
'jest/prefer-called-with': 'error',
|
|
92
|
+
'jest/prefer-expect-assertions': ['error', { onlyFunctionsWithAsyncKeyword: true }],
|
|
93
|
+
'jest/prefer-expect-resolves': 'off', // We prefer `expect(await promise)` enforced by 'jest/no-restricted-matchers'
|
|
94
|
+
'jest/prefer-hooks-in-order': 'error',
|
|
95
|
+
'jest/prefer-hooks-on-top': 'error',
|
|
96
|
+
'jest/prefer-comparison-matcher': 'error',
|
|
97
|
+
'jest/prefer-each': 'error',
|
|
98
|
+
'jest/prefer-equality-matcher': 'error',
|
|
99
|
+
'jest/prefer-importing-jest-globals': 'error',
|
|
100
|
+
'jest/prefer-jest-mocked': 'error',
|
|
101
|
+
'jest/prefer-mock-promise-shorthand': 'error',
|
|
102
|
+
'jest/prefer-snapshot-hint': 'error',
|
|
103
|
+
'jest/prefer-spy-on': 'error',
|
|
104
|
+
'jest/prefer-strict-equal': 'error',
|
|
105
|
+
'jest/prefer-to-be': 'error',
|
|
106
|
+
'jest/prefer-to-contain': 'error',
|
|
107
|
+
'jest/prefer-to-have-length': 'error',
|
|
108
|
+
'jest/prefer-todo': 'error',
|
|
109
|
+
'jest/require-hook': 'error',
|
|
110
|
+
'jest/require-top-level-describe': 'error',
|
|
111
|
+
'jest/require-to-throw-message': 'error',
|
|
112
|
+
'jest/unbound-method': 'error',
|
|
113
|
+
'jest/valid-describe-callback': 'error',
|
|
114
|
+
'jest/valid-expect-in-promise': 'error',
|
|
115
|
+
'jest/valid-expect': 'error',
|
|
116
|
+
'jest/valid-title': 'error'
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
files: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
|
|
121
|
+
languageOptions: {
|
|
122
|
+
globals: {
|
|
123
|
+
...globals.jest
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
settings: {
|
|
127
|
+
jest: {
|
|
128
|
+
version: jestVersion
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
plugins: {
|
|
132
|
+
jest: jestPlugin
|
|
133
|
+
},
|
|
134
|
+
rules: {
|
|
135
|
+
/**
|
|
136
|
+
* eslint-plugin-jest
|
|
137
|
+
*
|
|
138
|
+
* @see https://github.com/jest-community/eslint-plugin-jest/tree/master/docs/rules
|
|
139
|
+
*/
|
|
140
|
+
'jest/no-untyped-mock-factory': 'error'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Detects and retrieves the major version number of Jest installed in the project.
|
|
147
|
+
*
|
|
148
|
+
* This function attempts to dynamically import Jest using Node.js's module resolution
|
|
149
|
+
* system. It extracts just the major version number (e.g., "29" from "29.3.1") and
|
|
150
|
+
* logs the detected version to stdout. If Jest cannot be found or an error occurs,
|
|
151
|
+
* it returns the fallback value "detect".
|
|
152
|
+
*
|
|
153
|
+
* @returns {Promise<string>} A promise that resolves to the major version number of Jest
|
|
154
|
+
*/
|
|
155
|
+
async function getJestVersion () {
|
|
156
|
+
try {
|
|
157
|
+
const require = createRequire(import.meta.url);
|
|
158
|
+
const fileUrl = new URL('file:');
|
|
159
|
+
|
|
160
|
+
fileUrl.pathname = require.resolve('jest', { paths: [process.cwd()] });
|
|
161
|
+
|
|
162
|
+
const jestModule = await import(fileUrl.toString());
|
|
163
|
+
const jest = ('default' in jestModule ? jestModule.default : jestModule);
|
|
164
|
+
const version = jest.getVersion().split('.')[0];
|
|
165
|
+
|
|
166
|
+
process.stdout.write(`Detected Jest version: ${version}\n\n`);
|
|
167
|
+
|
|
168
|
+
return version;
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
process.stderr.write('No Jest version detected\n\n');
|
|
172
|
+
|
|
173
|
+
return 'detect';
|
|
174
|
+
}
|
|
175
|
+
}
|
package/eslint/jsdoc.mjs
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Settings for JSDoc comments in JavaScript (Node.js) files.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
globals: {
|
|
13
|
+
...globals.es2015,
|
|
14
|
+
...globals.node
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
plugins: {
|
|
18
|
+
jsdoc: jsdocPlugin
|
|
19
|
+
},
|
|
20
|
+
settings: {
|
|
21
|
+
jsdoc: {
|
|
22
|
+
mode: 'typescript',
|
|
23
|
+
exemptDestructuredRootsFromChecks: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
/**
|
|
28
|
+
* "eslint-plugin-jsdoc" rules
|
|
29
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc
|
|
30
|
+
*/
|
|
31
|
+
'jsdoc/check-access': 'error',
|
|
32
|
+
'jsdoc/check-alignment': 'error',
|
|
33
|
+
'jsdoc/check-examples': 'off', // @todo Need to be configured to allow text-based examples
|
|
34
|
+
'jsdoc/check-indentation': ['off', { excludeTags: ['typedef'] }], // @todo Why is this disabled?
|
|
35
|
+
'jsdoc/check-param-names': 'error',
|
|
36
|
+
'jsdoc/check-syntax': 'error',
|
|
37
|
+
'jsdoc/check-line-alignment': ['error', 'never'],
|
|
38
|
+
'jsdoc/check-tag-names': 'error',
|
|
39
|
+
'jsdoc/check-template-names': 'error',
|
|
40
|
+
'jsdoc/check-types': 'error',
|
|
41
|
+
'jsdoc/check-values': 'error',
|
|
42
|
+
'jsdoc/convert-to-jsdoc-comments': 'off',
|
|
43
|
+
'jsdoc/empty-tags': 'error',
|
|
44
|
+
'jsdoc/implements-on-classes': 'error',
|
|
45
|
+
'jsdoc/imports-as-dependencies': 'off', // @todo Doesn't cover `peerDependencies` yet. As of v46.2.5 it should cover Node.js modules (like `child_process`), which must be checked, before activation.
|
|
46
|
+
'jsdoc/informative-docs': 'error',
|
|
47
|
+
'jsdoc/lines-before-block': ['error', { ignoreSameLine: false }],
|
|
48
|
+
'jsdoc/match-description': 'error',
|
|
49
|
+
'jsdoc/match-name': 'off',
|
|
50
|
+
'jsdoc/multiline-blocks': ['error', { noSingleLineBlocks: true, singleLineTags: ['lends', 'type', 'typedef'], noFinalLineText: false }],
|
|
51
|
+
'jsdoc/no-bad-blocks': 'error',
|
|
52
|
+
'jsdoc/no-blank-blocks': 'error',
|
|
53
|
+
'jsdoc/no-defaults': 'off',
|
|
54
|
+
'jsdoc/no-missing-syntax': 'off',
|
|
55
|
+
'jsdoc/no-multi-asterisks': ['error', { preventAtEnd: false }],
|
|
56
|
+
'jsdoc/no-restricted-syntax': 'off',
|
|
57
|
+
'jsdoc/no-types': 'off',
|
|
58
|
+
'jsdoc/no-undefined-types': ['error', { definedTypes: ['void', 'never', 'Readonly'] }],
|
|
59
|
+
'jsdoc/require-description-complete-sentence': 'off',
|
|
60
|
+
'jsdoc/require-description': 'error',
|
|
61
|
+
'jsdoc/require-example': 'off',
|
|
62
|
+
'jsdoc/require-file-overview': 'error',
|
|
63
|
+
'jsdoc/require-hyphen-before-param-description': 'error',
|
|
64
|
+
'jsdoc/require-jsdoc': ['error', { minLineCount: 2 }],
|
|
65
|
+
'jsdoc/require-param-description': 'error',
|
|
66
|
+
'jsdoc/require-param-name': 'error',
|
|
67
|
+
'jsdoc/require-param-type': 'error',
|
|
68
|
+
'jsdoc/require-param': 'error',
|
|
69
|
+
'jsdoc/require-property': 'error',
|
|
70
|
+
'jsdoc/require-returns-check': 'error',
|
|
71
|
+
'jsdoc/require-returns-description': 'error',
|
|
72
|
+
'jsdoc/require-returns-type': 'error',
|
|
73
|
+
'jsdoc/require-returns': ['error', { forceReturnsWithAsync: true }],
|
|
74
|
+
'jsdoc/require-template': 'error',
|
|
75
|
+
'jsdoc/require-throws': 'error',
|
|
76
|
+
'jsdoc/require-yields': 'error',
|
|
77
|
+
'jsdoc/require-yields-check': 'error',
|
|
78
|
+
'jsdoc/tag-lines': ['error', 'always', {
|
|
79
|
+
tags: {
|
|
80
|
+
example: { lines: 'always' },
|
|
81
|
+
file: { lines: 'always' },
|
|
82
|
+
fileOverview: { lines: 'always' },
|
|
83
|
+
license: { lines: 'always' },
|
|
84
|
+
param: { lines: 'never' },
|
|
85
|
+
private: { lines: 'never' },
|
|
86
|
+
property: { lines: 'never' },
|
|
87
|
+
protected: { lines: 'never' },
|
|
88
|
+
public: { lines: 'never' },
|
|
89
|
+
returns: { lines: 'never' },
|
|
90
|
+
see: { lines: 'any' },
|
|
91
|
+
template: { lines: 'never' },
|
|
92
|
+
throws: { lines: 'never' },
|
|
93
|
+
typedef: { lines: 'never' }
|
|
94
|
+
},
|
|
95
|
+
startLines: null,
|
|
96
|
+
endLines: null,
|
|
97
|
+
applyToEndTag: false
|
|
98
|
+
}],
|
|
99
|
+
'jsdoc/text-escaping': 'off', // Right now, there is no description of this rule available on the page. Only the discussion here: https://github.com/gajus/eslint-plugin-jsdoc/issues/864
|
|
100
|
+
'jsdoc/valid-types': 'off' // Checked by TypeScript
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
];
|
package/eslint/react.mjs
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Settings for React code in TypeScript (TSX) files.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import stylisticJSXPlugin from '@stylistic/eslint-plugin-jsx';
|
|
6
|
+
import reactPlugin from 'eslint-plugin-react';
|
|
7
|
+
import * as reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
8
|
+
|
|
9
|
+
import * as ensureType from '../helper/ensure-type.mjs';
|
|
10
|
+
import { linterBundleConfig } from '../helper/linter-bundle-config.js';
|
|
11
|
+
|
|
12
|
+
import ensureLucideImportConsistencyRule from './rules/ensure-lucide-import-consistency.mjs';
|
|
13
|
+
|
|
14
|
+
export default [
|
|
15
|
+
{
|
|
16
|
+
plugins: {
|
|
17
|
+
'react-hooks': reactHooksPlugin,
|
|
18
|
+
'react': reactPlugin,
|
|
19
|
+
'@stylistic/jsx': stylisticJSXPlugin,
|
|
20
|
+
'linter-bundle': {
|
|
21
|
+
rules: {
|
|
22
|
+
'ensure-lucide-import-consistency': ensureLucideImportConsistencyRule
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
files: ['**/*.tsx'],
|
|
29
|
+
rules: {
|
|
30
|
+
/**
|
|
31
|
+
* ./rules
|
|
32
|
+
*/
|
|
33
|
+
'linter-bundle/ensure-lucide-import-consistency': 'error',
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* typescript-eslint
|
|
37
|
+
*
|
|
38
|
+
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules
|
|
39
|
+
*/
|
|
40
|
+
'@typescript-eslint/member-ordering': 'off', // For React components we are using react/sort-comp
|
|
41
|
+
'@typescript-eslint/explicit-function-return-type': ['error', {
|
|
42
|
+
allowedNames: [
|
|
43
|
+
'componentDidCatch',
|
|
44
|
+
'componentDidMount',
|
|
45
|
+
'componentDidUpdate',
|
|
46
|
+
'componentWillUnmount',
|
|
47
|
+
'getDerivedStateFromError',
|
|
48
|
+
'getDerivedStateFromProps',
|
|
49
|
+
'getSnapshotBeforeUpdate',
|
|
50
|
+
'render',
|
|
51
|
+
'shouldComponentUpdate'
|
|
52
|
+
]
|
|
53
|
+
}],
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* eslint-plugin-jsx-a11y
|
|
57
|
+
*
|
|
58
|
+
* @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
|
|
59
|
+
*/
|
|
60
|
+
'jsx-a11y/alt-text': 'error',
|
|
61
|
+
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
62
|
+
'jsx-a11y/anchor-has-content': 'error',
|
|
63
|
+
'jsx-a11y/anchor-is-valid': 'error',
|
|
64
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
65
|
+
'jsx-a11y/aria-props': 'error',
|
|
66
|
+
'jsx-a11y/aria-proptypes': 'error',
|
|
67
|
+
'jsx-a11y/aria-role': 'error',
|
|
68
|
+
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
69
|
+
'jsx-a11y/autocomplete-valid': 'error',
|
|
70
|
+
'jsx-a11y/click-events-have-key-events': 'error',
|
|
71
|
+
'jsx-a11y/heading-has-content': 'error',
|
|
72
|
+
'jsx-a11y/html-has-lang': 'off', // <html> elements set by react-helmet automatically have a lang attribute set
|
|
73
|
+
'jsx-a11y/iframe-has-title': 'error',
|
|
74
|
+
'jsx-a11y/img-redundant-alt': 'error',
|
|
75
|
+
'jsx-a11y/interactive-supports-focus': 'error',
|
|
76
|
+
'jsx-a11y/label-has-associated-control': 'error',
|
|
77
|
+
'jsx-a11y/media-has-caption': 'error',
|
|
78
|
+
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
79
|
+
'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
|
|
80
|
+
'jsx-a11y/no-aria-hidden-on-focusable': 'error',
|
|
81
|
+
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
|
|
82
|
+
'jsx-a11y/no-distracting-elements': 'error',
|
|
83
|
+
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
|
|
84
|
+
'jsx-a11y/no-noninteractive-element-interactions': 'error',
|
|
85
|
+
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
|
|
86
|
+
'jsx-a11y/no-noninteractive-tabindex': 'error',
|
|
87
|
+
'jsx-a11y/no-redundant-roles': 'error',
|
|
88
|
+
'jsx-a11y/no-static-element-interactions': 'error',
|
|
89
|
+
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
90
|
+
'jsx-a11y/role-supports-aria-props': 'error',
|
|
91
|
+
'jsx-a11y/scope': 'error',
|
|
92
|
+
'jsx-a11y/tabindex-no-positive': 'error',
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* eslint-plugin-react-hooks
|
|
96
|
+
*
|
|
97
|
+
* @see https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks
|
|
98
|
+
* @see https://reactjs.org/docs/hooks-rules.html
|
|
99
|
+
*/
|
|
100
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
101
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* eslint-plugin-react
|
|
105
|
+
*
|
|
106
|
+
* @see https://github.com/yannickcr/eslint-plugin-react
|
|
107
|
+
*/
|
|
108
|
+
'react/boolean-prop-naming': 'error',
|
|
109
|
+
'react/button-has-type': 'error',
|
|
110
|
+
'react/checked-requires-onchange-or-readonly': 'error',
|
|
111
|
+
'react/default-props-match-prop-types': 'error',
|
|
112
|
+
'react/destructuring-assignment': 'off', // Sometimes destructuring makes sense, sometimes it doesn't - that depends on the context.
|
|
113
|
+
'react/display-name': ['error', { ignoreTranspilerName: true }],
|
|
114
|
+
'react/forbid-component-props': ['error', { forbid: [
|
|
115
|
+
{
|
|
116
|
+
propName: 'className',
|
|
117
|
+
allowedFor: ensureType.array(linterBundleConfig.ts?.overrides?.react?.['react/forbid-component-props']?.allowClassNameFor)
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
propName: 'style',
|
|
121
|
+
allowedFor: ensureType.array(linterBundleConfig.ts?.overrides?.react?.['react/forbid-component-props']?.allowStyleFor)
|
|
122
|
+
}
|
|
123
|
+
] }],
|
|
124
|
+
'react/forbid-dom-props': 'error',
|
|
125
|
+
'react/forbid-elements': 'error',
|
|
126
|
+
'react/forbid-foreign-prop-types': 'error',
|
|
127
|
+
'react/forbid-prop-types': 'error',
|
|
128
|
+
'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
|
|
129
|
+
namedComponents: 'arrow-function',
|
|
130
|
+
unnamedComponents: 'arrow-function'
|
|
131
|
+
}],
|
|
132
|
+
'react/hook-use-state': ['error', { allowDestructuredState: true }],
|
|
133
|
+
'react/jsx-boolean-value': ['error', 'always'],
|
|
134
|
+
'react/jsx-child-element-spacing': 'off', // @todo Why is this disabled? Could it be, that the faulty behavior is fixed in the meantime?
|
|
135
|
+
'react/jsx-closing-bracket-location': 'error',
|
|
136
|
+
'react/jsx-closing-tag-location': 'error',
|
|
137
|
+
'react/jsx-curly-brace-presence': ['error', { propElementValues: 'always' }],
|
|
138
|
+
'react/jsx-curly-newline': 'off',
|
|
139
|
+
'react/jsx-curly-spacing': 'error',
|
|
140
|
+
'react/jsx-equals-spacing': 'error',
|
|
141
|
+
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
|
|
142
|
+
'react/jsx-first-prop-new-line': 'error',
|
|
143
|
+
'react/forward-ref-uses-ref': 'error',
|
|
144
|
+
'react/jsx-fragments': ['error', 'element'],
|
|
145
|
+
'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
|
|
146
|
+
'react/jsx-indent-props': ['error', 'tab'],
|
|
147
|
+
'react/jsx-indent': ['error', 'tab', { checkAttributes: true, indentLogicalExpressions: true }],
|
|
148
|
+
'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],
|
|
149
|
+
'react/jsx-max-depth': ['error', { max: 8 }],
|
|
150
|
+
'react/jsx-max-props-per-line': ['error', { maximum: { single: 5, multi: 1 } }],
|
|
151
|
+
'react/jsx-newline': 'off', // @todo Why is this rule deactivated?
|
|
152
|
+
'react/jsx-no-bind': ['error', { ignoreDOMComponents: true }],
|
|
153
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
154
|
+
'react/jsx-no-constructed-context-values': 'error',
|
|
155
|
+
'react/jsx-no-duplicate-props': 'error',
|
|
156
|
+
'react/jsx-no-leaked-render': 'off', // Should be covered by boolean-types in TypeScript, otherwise unnecessary type-castings from boolean to boolean would be required
|
|
157
|
+
'react/jsx-no-literals': 'off',
|
|
158
|
+
'react/jsx-no-script-url': 'error',
|
|
159
|
+
'react/jsx-no-target-blank': ['error', { allowReferrer: true, forms: true }],
|
|
160
|
+
'react/jsx-no-undef': 'error',
|
|
161
|
+
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
|
|
162
|
+
'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
|
|
163
|
+
'react/jsx-pascal-case': ['error', { allowAllCaps: true }],
|
|
164
|
+
'react/jsx-props-no-multi-spaces': 'error',
|
|
165
|
+
'react/jsx-props-no-spread-multi': 'error',
|
|
166
|
+
'react/jsx-props-no-spreading': 'off',
|
|
167
|
+
'react/jsx-sort-props': ['error', {
|
|
168
|
+
ignoreCase: true,
|
|
169
|
+
callbacksLast: true,
|
|
170
|
+
shorthandFirst: true,
|
|
171
|
+
shorthandLast: false,
|
|
172
|
+
noSortAlphabetically: true,
|
|
173
|
+
reservedFirst: true
|
|
174
|
+
}],
|
|
175
|
+
'react/jsx-tag-spacing': 'error',
|
|
176
|
+
'react/jsx-uses-react': 'error',
|
|
177
|
+
'react/jsx-uses-vars': 'error',
|
|
178
|
+
'react/jsx-wrap-multilines': 'error',
|
|
179
|
+
'react/no-access-state-in-setstate': 'error',
|
|
180
|
+
'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.
|
|
181
|
+
'react/no-array-index-key': 'error',
|
|
182
|
+
'react/no-arrow-function-lifecycle': 'error',
|
|
183
|
+
'react/no-children-prop': 'error',
|
|
184
|
+
'react/no-danger-with-children': 'error',
|
|
185
|
+
'react/no-danger': 'off',
|
|
186
|
+
'react/no-deprecated': 'error',
|
|
187
|
+
'react/no-did-mount-set-state': 'error',
|
|
188
|
+
'react/no-did-update-set-state': 'error',
|
|
189
|
+
'react/no-direct-mutation-state': 'error',
|
|
190
|
+
'react/no-find-dom-node': 'error',
|
|
191
|
+
'react/no-invalid-html-attribute': 'error',
|
|
192
|
+
'react/no-is-mounted': 'error',
|
|
193
|
+
'react/no-multi-comp': 'error',
|
|
194
|
+
'react/no-namespace': 'error',
|
|
195
|
+
'react/no-object-type-as-default-prop': 'error',
|
|
196
|
+
'react/no-redundant-should-component-update': 'error',
|
|
197
|
+
'react/no-render-return-value': 'error',
|
|
198
|
+
'react/no-set-state': 'off',
|
|
199
|
+
'react/no-string-refs': 'error',
|
|
200
|
+
'react/no-this-in-sfc': 'error',
|
|
201
|
+
'react/no-typos': 'error',
|
|
202
|
+
'react/no-unescaped-entities': 'error',
|
|
203
|
+
'react/no-unknown-property': 'error',
|
|
204
|
+
'react/no-unsafe': 'error',
|
|
205
|
+
'react/no-unstable-nested-components': 'error',
|
|
206
|
+
'react/no-unused-class-component-methods': 'off', // @todo False-positives with public methods.
|
|
207
|
+
'react/no-unused-prop-types': 'error',
|
|
208
|
+
'react/no-unused-state': 'error',
|
|
209
|
+
'react/no-will-update-set-state': 'error',
|
|
210
|
+
'react/prefer-es6-class': 'error',
|
|
211
|
+
'react/prefer-exact-props': 'off', // With TypeScript interfaces, this rule is not required
|
|
212
|
+
'react/prefer-read-only-props': 'error',
|
|
213
|
+
'react/prefer-stateless-function': 'error',
|
|
214
|
+
'react/prop-types': 'off',
|
|
215
|
+
'react/react-in-jsx-scope': 'error',
|
|
216
|
+
'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 because of false-positive with React.forwardRef(), create bug report?
|
|
217
|
+
'react/require-optimization': 'error',
|
|
218
|
+
'react/require-render-return': 'error',
|
|
219
|
+
'react/self-closing-comp': 'error',
|
|
220
|
+
'react/sort-comp': ['error', {
|
|
221
|
+
order: [
|
|
222
|
+
'type-annotations',
|
|
223
|
+
'static-variables',
|
|
224
|
+
'instance-variables',
|
|
225
|
+
'getters',
|
|
226
|
+
'setters',
|
|
227
|
+
'lifecycle',
|
|
228
|
+
'render',
|
|
229
|
+
'/^render.+$/',
|
|
230
|
+
'/^handle.+$/',
|
|
231
|
+
'everything-else',
|
|
232
|
+
'instance-methods',
|
|
233
|
+
'static-methods'
|
|
234
|
+
]
|
|
235
|
+
}],
|
|
236
|
+
'react/sort-default-props': 'error',
|
|
237
|
+
'react/sort-prop-types': 'error',
|
|
238
|
+
'react/state-in-constructor': 'error',
|
|
239
|
+
'react/static-property-placement': 'error',
|
|
240
|
+
'react/style-prop-object': 'error',
|
|
241
|
+
'react/void-dom-elements-no-children': 'error'
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
];
|