linter-bundle 6.2.2 → 7.0.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 +149 -4
- package/README.md +60 -63
- package/eslint/gatsby.mjs +95 -0
- package/eslint/index.mjs +1127 -0
- package/eslint/javascript-lazy.mjs +24 -0
- package/eslint/javascript.mjs +126 -0
- package/eslint/jest.mjs +172 -0
- package/eslint/jsdoc.mjs +103 -0
- package/eslint/react.mjs +232 -0
- package/eslint/rules/no-unnecessary-typeof.md +1 -1
- package/eslint/rules/{no-unnecessary-typeof.js → no-unnecessary-typeof.mjs} +9 -11
- package/eslint/rules/restricted-filenames.md +4 -4
- package/eslint/rules/{restricted-filenames.js → restricted-filenames.mjs} +7 -6
- 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} +1 -5
- 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.d.ts +24 -0
- package/helper/linter-bundle-config.js +9 -14
- package/helper/run-process.js +1 -1
- package/lint.js +21 -16
- package/package.json +31 -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/TODO.md +0 -58
- package/eslint/index.cjs +0 -1065
- 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.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
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Settings for React code in TypeScript (TSX) files.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const ensureType = require('../helper/ensure-type.cjs');
|
|
6
|
-
const { linterBundleConfig } = require('../helper/linter-bundle-config.cjs');
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
overrides: [
|
|
10
|
-
{
|
|
11
|
-
files: ['*.tsx'],
|
|
12
|
-
rules: {
|
|
13
|
-
/**
|
|
14
|
-
* typescript-eslint
|
|
15
|
-
*
|
|
16
|
-
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules
|
|
17
|
-
*/
|
|
18
|
-
'@typescript-eslint/member-ordering': 'off', // For React components we are using react/sort-comp
|
|
19
|
-
'@typescript-eslint/explicit-function-return-type': ['error', {
|
|
20
|
-
allowedNames: [
|
|
21
|
-
'componentDidCatch',
|
|
22
|
-
'componentDidMount',
|
|
23
|
-
'componentDidUpdate',
|
|
24
|
-
'componentWillUnmount',
|
|
25
|
-
'getDerivedStateFromError',
|
|
26
|
-
'getDerivedStateFromProps',
|
|
27
|
-
'getSnapshotBeforeUpdate',
|
|
28
|
-
'render',
|
|
29
|
-
'shouldComponentUpdate'
|
|
30
|
-
]
|
|
31
|
-
}],
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* eslint-plugin-jsx-a11y
|
|
35
|
-
*
|
|
36
|
-
* @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
|
|
37
|
-
*/
|
|
38
|
-
'jsx-a11y/alt-text': 'error',
|
|
39
|
-
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
40
|
-
'jsx-a11y/anchor-has-content': 'error',
|
|
41
|
-
'jsx-a11y/anchor-is-valid': 'error',
|
|
42
|
-
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
43
|
-
'jsx-a11y/aria-props': 'error',
|
|
44
|
-
'jsx-a11y/aria-proptypes': 'error',
|
|
45
|
-
'jsx-a11y/aria-role': 'error',
|
|
46
|
-
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
47
|
-
'jsx-a11y/autocomplete-valid': 'error',
|
|
48
|
-
'jsx-a11y/click-events-have-key-events': 'error',
|
|
49
|
-
'jsx-a11y/heading-has-content': 'error',
|
|
50
|
-
'jsx-a11y/html-has-lang': 'off', // <html> elements set by react-helmet automatically have a lang attribute set
|
|
51
|
-
'jsx-a11y/iframe-has-title': 'error',
|
|
52
|
-
'jsx-a11y/img-redundant-alt': 'error',
|
|
53
|
-
'jsx-a11y/interactive-supports-focus': 'error',
|
|
54
|
-
'jsx-a11y/label-has-associated-control': 'error',
|
|
55
|
-
'jsx-a11y/media-has-caption': 'error',
|
|
56
|
-
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
57
|
-
'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
|
|
58
|
-
'jsx-a11y/no-aria-hidden-on-focusable': 'error',
|
|
59
|
-
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
|
|
60
|
-
'jsx-a11y/no-distracting-elements': 'error',
|
|
61
|
-
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
|
|
62
|
-
'jsx-a11y/no-noninteractive-element-interactions': 'error',
|
|
63
|
-
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
|
|
64
|
-
'jsx-a11y/no-noninteractive-tabindex': 'error',
|
|
65
|
-
'jsx-a11y/no-redundant-roles': 'error',
|
|
66
|
-
'jsx-a11y/no-static-element-interactions': 'error',
|
|
67
|
-
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
68
|
-
'jsx-a11y/role-supports-aria-props': 'error',
|
|
69
|
-
'jsx-a11y/scope': 'error',
|
|
70
|
-
'jsx-a11y/tabindex-no-positive': 'error',
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* eslint-plugin-react-hooks
|
|
74
|
-
*
|
|
75
|
-
* @see https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks
|
|
76
|
-
* @see https://reactjs.org/docs/hooks-rules.html
|
|
77
|
-
*/
|
|
78
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
79
|
-
'react-hooks/exhaustive-deps': 'error',
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* eslint-plugin-react
|
|
83
|
-
*
|
|
84
|
-
* @see https://github.com/yannickcr/eslint-plugin-react
|
|
85
|
-
*/
|
|
86
|
-
'react/boolean-prop-naming': 'error',
|
|
87
|
-
'react/button-has-type': 'error',
|
|
88
|
-
'react/default-props-match-prop-types': 'error',
|
|
89
|
-
'react/destructuring-assignment': 'off', // Sometimes destructuring makes sense, sometimes it doesn't - that depends on the context.
|
|
90
|
-
'react/display-name': 'error',
|
|
91
|
-
'react/forbid-component-props': ['error', { forbid: [
|
|
92
|
-
{
|
|
93
|
-
propName: 'className',
|
|
94
|
-
allowedFor: ensureType.array(linterBundleConfig.ts?.overrides?.react?.['react/forbid-component-props']?.allowClassNameFor)
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
propName: 'style',
|
|
98
|
-
allowedFor: ensureType.array(linterBundleConfig.ts?.overrides?.react?.['react/forbid-component-props']?.allowStyleFor)
|
|
99
|
-
}
|
|
100
|
-
] }],
|
|
101
|
-
'react/forbid-dom-props': 'error',
|
|
102
|
-
'react/forbid-elements': 'error',
|
|
103
|
-
'react/forbid-foreign-prop-types': 'error',
|
|
104
|
-
'react/forbid-prop-types': 'error',
|
|
105
|
-
'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
|
|
106
|
-
namedComponents: 'arrow-function',
|
|
107
|
-
unnamedComponents: 'arrow-function'
|
|
108
|
-
}],
|
|
109
|
-
'react/hook-use-state': ['error', { allowDestructuredState: true }],
|
|
110
|
-
'react/jsx-boolean-value': ['error', 'always'],
|
|
111
|
-
'react/jsx-child-element-spacing': 'off', // @todo Why is this disabled? Could it be, that the faulty behavior is fixed in the meantime?
|
|
112
|
-
'react/jsx-closing-bracket-location': 'error',
|
|
113
|
-
'react/jsx-closing-tag-location': 'error',
|
|
114
|
-
'react/jsx-curly-brace-presence': ['error', { propElementValues: 'always' }],
|
|
115
|
-
'react/jsx-curly-newline': 'off',
|
|
116
|
-
'react/jsx-curly-spacing': 'error',
|
|
117
|
-
'react/jsx-equals-spacing': 'error',
|
|
118
|
-
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
|
|
119
|
-
'react/jsx-first-prop-new-line': 'error',
|
|
120
|
-
'react/jsx-fragments': ['error', 'element'],
|
|
121
|
-
'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
|
|
122
|
-
'react/jsx-indent-props': ['error', 'tab'],
|
|
123
|
-
'react/jsx-indent': ['error', 'tab', { checkAttributes: true, indentLogicalExpressions: true }],
|
|
124
|
-
'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],
|
|
125
|
-
'react/jsx-max-depth': ['error', { max: 8 }],
|
|
126
|
-
'react/jsx-max-props-per-line': ['error', { maximum: { single: 5, multi: 1 } }],
|
|
127
|
-
'react/jsx-newline': 'off', // @todo Why is this rule deactivated?
|
|
128
|
-
'react/jsx-no-bind': ['error', { ignoreDOMComponents: true }],
|
|
129
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
130
|
-
'react/jsx-no-constructed-context-values': 'error',
|
|
131
|
-
'react/jsx-no-duplicate-props': 'error',
|
|
132
|
-
'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
|
|
133
|
-
'react/jsx-no-literals': 'off',
|
|
134
|
-
'react/jsx-no-script-url': 'error',
|
|
135
|
-
'react/jsx-no-target-blank': ['error', { allowReferrer: true, forms: true }],
|
|
136
|
-
'react/jsx-no-undef': 'error',
|
|
137
|
-
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
|
|
138
|
-
'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
|
|
139
|
-
'react/jsx-pascal-case': ['error', { allowAllCaps: true }],
|
|
140
|
-
'react/jsx-props-no-multi-spaces': 'error',
|
|
141
|
-
'react/jsx-props-no-spreading': 'off',
|
|
142
|
-
'react/jsx-sort-props': ['error', {
|
|
143
|
-
ignoreCase: true,
|
|
144
|
-
callbacksLast: true,
|
|
145
|
-
shorthandFirst: true,
|
|
146
|
-
shorthandLast: false,
|
|
147
|
-
noSortAlphabetically: true,
|
|
148
|
-
reservedFirst: true
|
|
149
|
-
}],
|
|
150
|
-
'react/jsx-tag-spacing': 'error',
|
|
151
|
-
'react/jsx-uses-react': 'error',
|
|
152
|
-
'react/jsx-uses-vars': 'error',
|
|
153
|
-
'react/jsx-wrap-multilines': 'error',
|
|
154
|
-
'react/no-access-state-in-setstate': 'error',
|
|
155
|
-
'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.
|
|
156
|
-
'react/no-array-index-key': 'error',
|
|
157
|
-
'react/no-arrow-function-lifecycle': 'error',
|
|
158
|
-
'react/no-children-prop': 'error',
|
|
159
|
-
'react/no-danger-with-children': 'error',
|
|
160
|
-
'react/no-danger': 'off',
|
|
161
|
-
'react/no-deprecated': 'error',
|
|
162
|
-
'react/no-did-mount-set-state': 'error',
|
|
163
|
-
'react/no-did-update-set-state': 'error',
|
|
164
|
-
'react/no-direct-mutation-state': 'error',
|
|
165
|
-
'react/no-find-dom-node': 'error',
|
|
166
|
-
'react/no-invalid-html-attribute': 'error',
|
|
167
|
-
'react/no-is-mounted': 'error',
|
|
168
|
-
'react/no-multi-comp': 'error',
|
|
169
|
-
'react/no-namespace': 'error',
|
|
170
|
-
'react/no-object-type-as-default-prop': 'error',
|
|
171
|
-
'react/no-redundant-should-component-update': 'error',
|
|
172
|
-
'react/no-render-return-value': 'error',
|
|
173
|
-
'react/no-set-state': 'off',
|
|
174
|
-
'react/no-string-refs': 'error',
|
|
175
|
-
'react/no-this-in-sfc': 'error',
|
|
176
|
-
'react/no-typos': 'error',
|
|
177
|
-
'react/no-unescaped-entities': 'error',
|
|
178
|
-
'react/no-unknown-property': 'error',
|
|
179
|
-
'react/no-unsafe': 'error',
|
|
180
|
-
'react/no-unstable-nested-components': 'error',
|
|
181
|
-
'react/no-unused-class-component-methods': 'off', // @todo False-positives with public methods.
|
|
182
|
-
'react/no-unused-prop-types': 'error',
|
|
183
|
-
'react/no-unused-state': 'error',
|
|
184
|
-
'react/no-will-update-set-state': 'error',
|
|
185
|
-
'react/prefer-es6-class': 'error',
|
|
186
|
-
'react/prefer-exact-props': 'off', // With TypeScript interfaces, this rule is not required
|
|
187
|
-
'react/prefer-read-only-props': 'error',
|
|
188
|
-
'react/prefer-stateless-function': 'error',
|
|
189
|
-
'react/prop-types': 'off',
|
|
190
|
-
'react/react-in-jsx-scope': 'error',
|
|
191
|
-
'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?
|
|
192
|
-
'react/require-optimization': 'error',
|
|
193
|
-
'react/require-render-return': 'error',
|
|
194
|
-
'react/self-closing-comp': 'error',
|
|
195
|
-
'react/sort-comp': ['error', {
|
|
196
|
-
order: [
|
|
197
|
-
'type-annotations',
|
|
198
|
-
'static-variables',
|
|
199
|
-
'instance-variables',
|
|
200
|
-
'getters',
|
|
201
|
-
'setters',
|
|
202
|
-
'lifecycle',
|
|
203
|
-
'render',
|
|
204
|
-
'/^render.+$/',
|
|
205
|
-
'/^handle.+$/',
|
|
206
|
-
'everything-else',
|
|
207
|
-
'instance-methods',
|
|
208
|
-
'static-methods'
|
|
209
|
-
]
|
|
210
|
-
}],
|
|
211
|
-
'react/sort-default-props': 'error',
|
|
212
|
-
'react/sort-prop-types': 'error',
|
|
213
|
-
'react/state-in-constructor': 'error',
|
|
214
|
-
'react/static-property-placement': 'error',
|
|
215
|
-
'react/style-prop-object': 'error',
|
|
216
|
-
'react/void-dom-elements-no-children': 'error'
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
]
|
|
220
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Settings for Storybook configuration and stories.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
overrides: [
|
|
7
|
-
{
|
|
8
|
-
files: ['*.stories.[jt]s?(x)'],
|
|
9
|
-
rules: {
|
|
10
|
-
/**
|
|
11
|
-
* eslint-plugin-import
|
|
12
|
-
*
|
|
13
|
-
* @see https://github.com/import-js/eslint-plugin-import
|
|
14
|
-
*/
|
|
15
|
-
'import/no-default-export': 'off'
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
files: ['.storybook/main.ts'],
|
|
20
|
-
rules: {
|
|
21
|
-
/**
|
|
22
|
-
* eslint-plugin-import
|
|
23
|
-
*
|
|
24
|
-
* @see https://github.com/import-js/eslint-plugin-import
|
|
25
|
-
*/
|
|
26
|
-
'import/no-nodejs-modules': 'off'
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
files: ['.storybook/preview.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
31
|
-
rules: {
|
|
32
|
-
/**
|
|
33
|
-
* eslint
|
|
34
|
-
*
|
|
35
|
-
* @see https://eslint.org/docs/rules/
|
|
36
|
-
*/
|
|
37
|
-
'no-underscore-dangle': ['error', {
|
|
38
|
-
allow: ['__BASE_PATH__', '___loader', '___navigate'],
|
|
39
|
-
allowAfterThis: true
|
|
40
|
-
}]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Settings for TypeScript type definition files.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
overrides: [
|
|
7
|
-
{
|
|
8
|
-
files: ['*.d.ts'],
|
|
9
|
-
rules: {
|
|
10
|
-
/**
|
|
11
|
-
* eslint
|
|
12
|
-
*
|
|
13
|
-
* @see https://eslint.org/docs/rules/
|
|
14
|
-
*/
|
|
15
|
-
'max-classes-per-file': 'off',
|
|
16
|
-
'one-var': 'off',
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* eslint-plugin-import
|
|
20
|
-
*
|
|
21
|
-
* @see https://github.com/import-js/eslint-plugin-import
|
|
22
|
-
*/
|
|
23
|
-
'import/no-default-export': 'off',
|
|
24
|
-
'import/no-unused-modules': 'off',
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* eslint-plugin-unicorn
|
|
28
|
-
*
|
|
29
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
30
|
-
*/
|
|
31
|
-
'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
|
|
32
|
-
cases: {
|
|
33
|
-
kebabCase: true,
|
|
34
|
-
pascalCase: true
|
|
35
|
-
}
|
|
36
|
-
}]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
files: ['*.scss.d.ts'],
|
|
41
|
-
rules: {
|
|
42
|
-
/**
|
|
43
|
-
* eslint
|
|
44
|
-
*
|
|
45
|
-
* @see https://eslint.org/docs/rules/
|
|
46
|
-
*/
|
|
47
|
-
'linebreak-style': 'off' // Ignore for automatically generated .scss.d.ts files, since that does not affect the project.
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file ESLint rule which ensures that `typeof window === 'undefined'` is not used, since it's often the source of rehydration issues in Gatsby.
|
|
3
|
-
*
|
|
4
|
-
* @see https://www.joshwcomeau.com/react/the-perils-of-rehydration/
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/* eslint-disable unicorn/prefer-module -- For ESLint, we still need to rely on CommonJS modules */
|
|
8
|
-
|
|
9
|
-
const DISALLOWED_OBJECTS = new Set(['globalThis', 'window', 'self']);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @type {import('eslint').Rule.RuleModule}
|
|
13
|
-
*/
|
|
14
|
-
module.exports = {
|
|
15
|
-
meta: {
|
|
16
|
-
docs: {
|
|
17
|
-
description: 'Rendering different output, depending on whether it is SSR or CSR, can lead to hard-to-debug rehydration problems in Gatsby.',
|
|
18
|
-
recommended: true,
|
|
19
|
-
url: 'https://www.joshwcomeau.com/react/the-perils-of-rehydration/'
|
|
20
|
-
},
|
|
21
|
-
messages: {
|
|
22
|
-
text: 'Use `React.useEffect()`, or `componentDidMount` instead of checking if `{{ name }}` is `undefined`.'
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
create (context) {
|
|
26
|
-
return {
|
|
27
|
-
BinaryExpression (node) {
|
|
28
|
-
let expressionValue = getExpressionValue(node.left);
|
|
29
|
-
let isLiteral;
|
|
30
|
-
|
|
31
|
-
if (expressionValue !== null) {
|
|
32
|
-
isLiteral = checkLiteral(node.right);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
expressionValue = getExpressionValue(node.right);
|
|
36
|
-
|
|
37
|
-
if (expressionValue === null) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
isLiteral = checkLiteral(node.left);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!isLiteral) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
context.report({
|
|
49
|
-
node,
|
|
50
|
-
messageId: 'text',
|
|
51
|
-
data: {
|
|
52
|
-
name: expressionValue
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Get the name (identifier) of a global scope of an BinaryExpression operator.
|
|
62
|
-
*
|
|
63
|
-
* @param {import('estree').Expression} node - The node to check
|
|
64
|
-
* @returns {string | null} Returns the name of the `node`, or null if not compared with a global scope identifier
|
|
65
|
-
*/
|
|
66
|
-
function getExpressionValue (node) {
|
|
67
|
-
if (node.type === 'UnaryExpression' && node.operator === 'typeof' && node.argument.type === 'Identifier' && DISALLOWED_OBJECTS.has(node.argument.name)) {
|
|
68
|
-
return node.argument.name;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Check if a given `node` is a literal expression consisting of the text "undefined".
|
|
76
|
-
*
|
|
77
|
-
* @param {import('estree').Expression} node - The node to check
|
|
78
|
-
* @returns {boolean} `true` if the node is a literal expression consisting of the text "undefined", otherwise `false`
|
|
79
|
-
*/
|
|
80
|
-
function checkLiteral (node) {
|
|
81
|
-
return (
|
|
82
|
-
(node.type === 'Literal' && node.value === 'undefined') ||
|
|
83
|
-
(node.type === 'TemplateLiteral' && node.quasis.map((quasi) => quasi.value.cooked).join('') === 'undefined')
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Disallow check if `globalThis`/`window`/`self` is `undefined` (`no-global-undefined-check`)
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
Rendering different output, depending on whether it is SSR or CSR, can lead to hard-to-debug rehydration problems in Gatsby.
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
if ('undefined' === typeof window) {}
|
|
11
|
-
if ('undefined' == typeof window) {}
|
|
12
|
-
if (typeof window !== 'undefined') {}
|
|
13
|
-
if (typeof window != 'undefined') {}
|
|
14
|
-
|
|
15
|
-
if (typeof window != "undefined") {}
|
|
16
|
-
if (typeof window != `undefined`) {}
|
|
17
|
-
if (typeof window !== `undefined`) {}
|
|
18
|
-
|
|
19
|
-
if (typeof globalThis !== `undefined`) {}
|
|
20
|
-
if (typeof self !== `undefined`) {}
|
|
21
|
-
|
|
22
|
-
const a = typeof window !== 'undefined' ? 1 : 2;
|
|
23
|
-
const b = (typeof window !== 'undefined' ? 1 : 2);
|
|
24
|
-
|
|
25
|
-
(typeof window !== 'undefined' && window.innerWidth <= 1024);
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## When Not To Use It
|
|
29
|
-
|
|
30
|
-
If you've ensured that your check does not produce a different DOM structure for SSR and CSR, and that there is no other way to do it.
|
|
31
|
-
|
|
32
|
-
## Further Reading
|
|
33
|
-
|
|
34
|
-
See [The Perils of Rehydration](https://www.joshwcomeau.com/react/the-perils-of-rehydration/)
|