@haltcase/style 6.2.1 → 7.0.0-canary.2
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/eslint/configs/browser.js +19 -0
- package/eslint/configs/cjs.js +1 -0
- package/eslint/configs/internal/base.js +180 -0
- package/eslint/configs/internal/commonjs.js +22 -0
- package/eslint/{rules → configs/internal}/es2015.js +14 -16
- package/eslint/configs/internal/simple-import-sort.js +24 -0
- package/eslint/configs/internal/tsdoc.js +17 -0
- package/eslint/{rules → configs/internal}/unicorn.js +116 -121
- package/eslint/configs/next.js +36 -0
- package/eslint/configs/node.js +19 -0
- package/eslint/configs/playwright-test.js +17 -0
- package/eslint/configs/react.js +54 -0
- package/eslint/configs/typescript.js +84 -0
- package/eslint/constants.js +12 -28
- package/eslint/index.js +27 -0
- package/eslint/rules/best-practice.js +250 -245
- package/eslint/rules/imports.js +94 -0
- package/eslint/rules/jsx-a11y.js +11 -10
- package/eslint/rules/playwright-test.js +25 -26
- package/eslint/rules/possible-errors.js +38 -45
- package/eslint/rules/react.js +105 -104
- package/eslint/rules/stylistic.js +83 -84
- package/eslint/rules/typescript/extension.js +55 -39
- package/eslint/rules/typescript/import.js +16 -15
- package/eslint/rules/typescript/index.js +109 -121
- package/eslint/rules/typescript/naming-convention.js +71 -0
- package/eslint/rules/variables.js +34 -34
- package/eslint/withFiles.js +15 -0
- package/package.json +58 -56
- package/prettier/index.js +4 -11
- package/readme.md +181 -98
- package/stylelint/_base.js +2 -4
- package/stylelint/index.js +6 -7
- package/stylelint/modules.js +7 -8
- package/stylelint/standard.js +2 -5
- package/typescript/tsconfig.base.json +2 -1
- package/typescript/tsconfig.bundler.json +7 -3
- package/typescript/tsconfig.next.json +14 -6
- package/typescript/tsconfig.node.json +1 -1
- package/typescript/tsconfig.node18.json +4 -7
- package/typescript/tsconfig.node20.json +4 -7
- package/typescript/tsconfig.node22.json +10 -0
- package/typescript/tsconfig.web.json +1 -1
- package/eslint/_base.js +0 -82
- package/eslint/astro.js +0 -40
- package/eslint/browser.js +0 -8
- package/eslint/cjs.js +0 -12
- package/eslint/jest.js +0 -28
- package/eslint/next.js +0 -38
- package/eslint/node.js +0 -8
- package/eslint/playwright-test.js +0 -8
- package/eslint/react.js +0 -18
- package/eslint/rules/import.js +0 -92
- package/eslint/rules/jest.js +0 -28
- package/eslint/rules/simple-import-sort.js +0 -23
- package/eslint/rules/tsdoc.js +0 -17
- package/eslint/rules/typescript/strict.js +0 -18
- package/eslint/typescript.js +0 -26
- package/eslint/utils/require-package.js +0 -44
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
"playwright/require-top-level-describe": error
|
|
27
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* @type {Linter.RulesRecord}
|
|
7
|
+
*/
|
|
8
|
+
export const playwrightTestRules = {
|
|
9
|
+
/**
|
|
10
|
+
* Require lowercase test names.
|
|
11
|
+
*
|
|
12
|
+
* 🔧 Fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
|
|
13
|
+
*/
|
|
14
|
+
"playwright/prefer-lowercase-title": "warn",
|
|
15
|
+
/**
|
|
16
|
+
* Require using `toHaveLength` over explicitly checking lengths.
|
|
17
|
+
*
|
|
18
|
+
* 🔧 Fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
|
|
19
|
+
*/
|
|
20
|
+
"playwright/prefer-to-have-length": "warn",
|
|
21
|
+
/**
|
|
22
|
+
* Require test cases and hooks to be inside a `test.describe` block.
|
|
23
|
+
*
|
|
24
|
+
* 🚫 Not fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
|
|
25
|
+
*/
|
|
26
|
+
"playwright/require-top-level-describe": "error"
|
|
28
27
|
};
|
|
@@ -1,47 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
"no-template-curly-in-string": error,
|
|
40
|
-
/**
|
|
41
|
-
* Disallow loops with a body that allows only one iteration.
|
|
42
|
-
*
|
|
43
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unreachable-loop
|
|
44
|
-
*/
|
|
45
|
-
"no-unreachable-loop": error
|
|
46
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* @type {Linter.RulesRecord}
|
|
7
|
+
*/
|
|
8
|
+
export const possibleErrorsRules = {
|
|
9
|
+
/**
|
|
10
|
+
* Disallow the use of console.
|
|
11
|
+
*
|
|
12
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-console
|
|
13
|
+
*/
|
|
14
|
+
"no-console": "error",
|
|
15
|
+
/**
|
|
16
|
+
* Disallow expressions where the operation doesn't affect the value.
|
|
17
|
+
*
|
|
18
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-console
|
|
19
|
+
*/
|
|
20
|
+
"no-constant-binary-expression": "error",
|
|
21
|
+
/**
|
|
22
|
+
* Disallow returning values from Promise executor functions.
|
|
23
|
+
*
|
|
24
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-promise-executor-return
|
|
25
|
+
*/
|
|
26
|
+
"no-promise-executor-return": "error",
|
|
27
|
+
/**
|
|
28
|
+
* Disallow template literal placeholder syntax in regular strings, as
|
|
29
|
+
* these are likely errors.
|
|
30
|
+
*
|
|
31
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-template-curly-in-string
|
|
32
|
+
*/
|
|
33
|
+
"no-template-curly-in-string": "error",
|
|
34
|
+
/**
|
|
35
|
+
* Disallow loops with a body that allows only one iteration.
|
|
36
|
+
*
|
|
37
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unreachable-loop
|
|
38
|
+
*/
|
|
39
|
+
"no-unreachable-loop": "error"
|
|
47
40
|
};
|
package/eslint/rules/react.js
CHANGED
|
@@ -1,117 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
levels: { off, warn, error }
|
|
5
|
-
} = require("../constants");
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* These are enabled by `react/recommended`, but we've made the decision to
|
|
9
7
|
* disable them.
|
|
8
|
+
*
|
|
9
|
+
* @type {Linter.RulesRecord}
|
|
10
10
|
*/
|
|
11
11
|
const disabledRules = {
|
|
12
12
|
// This is better handled by TypeScript.
|
|
13
|
-
"react/no-unknown-property": off,
|
|
13
|
+
"react/no-unknown-property": "off",
|
|
14
14
|
// This is better handled by TypeScript, and `prop-types` also bloats
|
|
15
15
|
// the project's build size.
|
|
16
|
-
"react/prop-types": off,
|
|
16
|
+
"react/prop-types": "off",
|
|
17
17
|
// Disable requiring React to be imported, as this is no longer required.
|
|
18
|
-
"react/react-in-jsx-scope": off
|
|
18
|
+
"react/react-in-jsx-scope": "off"
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @type {Linter.RulesRecord}
|
|
23
|
+
*/
|
|
24
|
+
export const reactRules = {
|
|
25
|
+
...disabledRules,
|
|
26
|
+
/**
|
|
27
|
+
* Require an explicit type when using button elements.
|
|
28
|
+
*
|
|
29
|
+
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
30
|
+
*/
|
|
31
|
+
"react/button-has-type": "warn",
|
|
32
|
+
/**
|
|
33
|
+
* Require consistent function type for function components.
|
|
34
|
+
*
|
|
35
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/HEAD/docs/rules/function-component-definition.md
|
|
36
|
+
*/
|
|
37
|
+
"react/function-component-definition": "warn",
|
|
38
|
+
/**
|
|
39
|
+
* Require destructuring and symmetric naming of `useState` hook value and setter variables.
|
|
40
|
+
*
|
|
41
|
+
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
42
|
+
*/
|
|
43
|
+
"react/hook-use-state": "warn",
|
|
44
|
+
/**
|
|
45
|
+
* Require consistent boolean attributes notation in JSX.
|
|
46
|
+
*
|
|
47
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
48
|
+
*/
|
|
49
|
+
"react/jsx-boolean-value": "warn",
|
|
50
|
+
/**
|
|
51
|
+
* Disallow unnecessary curly braces in JSX props and children.
|
|
52
|
+
*
|
|
53
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
54
|
+
*/
|
|
55
|
+
"react/jsx-curly-brace-presence": "warn",
|
|
56
|
+
/**
|
|
57
|
+
* Require using shorthand form for React fragments, unless required.
|
|
58
|
+
*
|
|
59
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
60
|
+
*/
|
|
61
|
+
"react/jsx-fragments": "warn",
|
|
62
|
+
/**
|
|
63
|
+
* Prevent problematic leaked values from being rendered.
|
|
64
|
+
*
|
|
65
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
|
|
66
|
+
*/
|
|
67
|
+
"react/jsx-no-leaked-render": "warn",
|
|
68
|
+
/**
|
|
69
|
+
* Prevents usage of unsafe `target='_blank'`.
|
|
70
|
+
*
|
|
71
|
+
* This rule is a part of `react/recommended`, but we've modified it to
|
|
72
|
+
* allow referrer.
|
|
73
|
+
*
|
|
74
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
75
|
+
*/
|
|
76
|
+
"react/jsx-no-target-blank": [
|
|
77
|
+
"error",
|
|
78
|
+
{
|
|
79
|
+
allowReferrer: true
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
/**
|
|
83
|
+
* Disallow empty React fragments.
|
|
84
|
+
*
|
|
85
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
86
|
+
*/
|
|
87
|
+
"react/jsx-no-useless-fragment": ["warn", { allowExpressions: true }],
|
|
88
|
+
/**
|
|
89
|
+
* Require the use of PascalCase for user-defined JSX components.
|
|
90
|
+
*
|
|
91
|
+
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
92
|
+
*/
|
|
93
|
+
"react/jsx-pascal-case": "warn",
|
|
94
|
+
/**
|
|
95
|
+
* Require props to be sorted alphabetically.
|
|
96
|
+
*
|
|
97
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
98
|
+
*/
|
|
99
|
+
"react/jsx-sort-props": "warn",
|
|
100
|
+
/**
|
|
101
|
+
* Disallow usage of Array index in keys.
|
|
102
|
+
*
|
|
103
|
+
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
104
|
+
*/
|
|
105
|
+
"react/no-array-index-key": "warn",
|
|
106
|
+
/**
|
|
107
|
+
* Disallow creating unstable components inside components.
|
|
108
|
+
*
|
|
109
|
+
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
110
|
+
*/
|
|
111
|
+
"react/no-unstable-nested-components": "error",
|
|
112
|
+
/**
|
|
113
|
+
* Disallow closing tags for components without children.
|
|
114
|
+
*
|
|
115
|
+
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
116
|
+
*/
|
|
117
|
+
"react/self-closing-comp": "warn"
|
|
117
118
|
};
|
|
@@ -1,86 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*/
|
|
84
|
-
"prefer-object-spread": warn
|
|
85
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* @type {Linter.RulesRecord}
|
|
7
|
+
*/
|
|
8
|
+
export const stylisticRules = {
|
|
9
|
+
/**
|
|
10
|
+
* Require camel case names.
|
|
11
|
+
*
|
|
12
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/camelcase
|
|
13
|
+
*/
|
|
14
|
+
camelcase: [
|
|
15
|
+
"error",
|
|
16
|
+
{ allow: ["^UNSAFE_"], ignoreDestructuring: false, properties: "never" }
|
|
17
|
+
],
|
|
18
|
+
/**
|
|
19
|
+
* Require function expressions to have a name.
|
|
20
|
+
*
|
|
21
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/func-names
|
|
22
|
+
*/
|
|
23
|
+
"func-names": ["error", "as-needed"],
|
|
24
|
+
/**
|
|
25
|
+
* Require a capital letter for constructors.
|
|
26
|
+
*
|
|
27
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/new-cap
|
|
28
|
+
*/
|
|
29
|
+
"new-cap": ["error", { capIsNew: false }],
|
|
30
|
+
/**
|
|
31
|
+
* Disallow the omission of parentheses when invoking a constructor with
|
|
32
|
+
* no arguments.
|
|
33
|
+
*
|
|
34
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/new-parens
|
|
35
|
+
*/
|
|
36
|
+
"new-parens": "warn",
|
|
37
|
+
/**
|
|
38
|
+
* Disallow use of the Array constructor.
|
|
39
|
+
*
|
|
40
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-array-constructor
|
|
41
|
+
*/
|
|
42
|
+
"no-array-constructor": "error",
|
|
43
|
+
/**
|
|
44
|
+
* Disallow use of bitwise operators.
|
|
45
|
+
*
|
|
46
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-bitwise
|
|
47
|
+
*/
|
|
48
|
+
"no-bitwise": "error",
|
|
49
|
+
/**
|
|
50
|
+
* Disallow if as the only statement in an else block.
|
|
51
|
+
*
|
|
52
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/no-lonely-if
|
|
53
|
+
*/
|
|
54
|
+
"no-lonely-if": "warn",
|
|
55
|
+
/**
|
|
56
|
+
* Disallow use of chained assignment expressions.
|
|
57
|
+
*
|
|
58
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-multi-assign
|
|
59
|
+
*/
|
|
60
|
+
"no-multi-assign": ["error"],
|
|
61
|
+
/**
|
|
62
|
+
* Disallow nested ternary expressions.
|
|
63
|
+
*
|
|
64
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-nested-ternary
|
|
65
|
+
*/
|
|
66
|
+
"no-nested-ternary": "error",
|
|
67
|
+
/**
|
|
68
|
+
* Disallow ternary operators when simpler alternatives exist.
|
|
69
|
+
*
|
|
70
|
+
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unneeded-ternary
|
|
71
|
+
*/
|
|
72
|
+
"no-unneeded-ternary": "error",
|
|
73
|
+
/**
|
|
74
|
+
* Require using arrow functions for callbacks.
|
|
75
|
+
*
|
|
76
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-arrow-callback
|
|
77
|
+
*/
|
|
78
|
+
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
|
|
79
|
+
/**
|
|
80
|
+
* Require use of an object spread over Object.assign.
|
|
81
|
+
*
|
|
82
|
+
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-object-spread
|
|
83
|
+
*/
|
|
84
|
+
"prefer-object-spread": "warn"
|
|
86
85
|
};
|
|
@@ -1,45 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import { Linter } from "eslint"
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
levels: { error }
|
|
5
|
-
} = require("../../constants");
|
|
5
|
+
import { variablesRules } from "../variables.js";
|
|
6
6
|
|
|
7
7
|
// These share identical configuration options, so we want to keep them in sync.
|
|
8
8
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
9
|
-
const
|
|
9
|
+
const noUnusedVarsOptions = variablesRules["no-unused-vars"];
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @type {Linter.RulesRecord}
|
|
13
|
+
*/
|
|
14
|
+
export const typescriptExtensionRules = {
|
|
15
|
+
/**
|
|
16
|
+
* Require default parameters to be last.
|
|
17
|
+
*
|
|
18
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/default-param-last/
|
|
19
|
+
*/
|
|
20
|
+
"@typescript-eslint/default-param-last": "error",
|
|
21
|
+
/**
|
|
22
|
+
* Disallow accidentally using the "empty object" type (`{}`).
|
|
23
|
+
*
|
|
24
|
+
* 🔧 Partially fixable - https://typescript-eslint.io/rules/no-empty-object-type/
|
|
25
|
+
*/
|
|
26
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
27
|
+
"error",
|
|
28
|
+
{
|
|
29
|
+
// allow "single-extends" interfaces as they are often useful for
|
|
30
|
+
// documentation purposes and future extensibility
|
|
31
|
+
allowInterfaces: "with-single-extends",
|
|
32
|
+
// allow React-like props types
|
|
33
|
+
allowWithName: "Props$"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
/**
|
|
37
|
+
* Disallow creation of functions within loops.
|
|
38
|
+
*
|
|
39
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-loop-func/
|
|
40
|
+
*/
|
|
41
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
42
|
+
/**
|
|
43
|
+
* Disallow variable declarations from shadowing variables declared in the
|
|
44
|
+
* outer scope.
|
|
45
|
+
*
|
|
46
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-shadow/
|
|
47
|
+
*/
|
|
48
|
+
"@typescript-eslint/no-shadow": "error",
|
|
49
|
+
/**
|
|
50
|
+
* Disallow unused variables.
|
|
51
|
+
*
|
|
52
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-unused-vars/
|
|
53
|
+
*/
|
|
54
|
+
"@typescript-eslint/no-unused-vars": noUnusedVarsOptions,
|
|
55
|
+
/**
|
|
56
|
+
* Disallow unnecessary constructors.
|
|
57
|
+
*
|
|
58
|
+
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-useless-constructor/
|
|
59
|
+
*/
|
|
60
|
+
"@typescript-eslint/no-useless-constructor": "error"
|
|
45
61
|
};
|