@todesktop/dev-config 1.0.27 → 1.0.28
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/README.md +102 -33
- package/eslint/configs/base.js +39 -5
- package/eslint/configs/data/console.js +47 -0
- package/eslint/configs/react.js +26 -13
- package/eslint/configs/reactStrict.js +10 -2
- package/eslint/configs/strict.js +27 -2
- package/eslint/configs/ts.js +15 -0
- package/eslint/configs/tsStrict.js +0 -15
- package/eslint/index.js +0 -1
- package/oxlint/configs/base.ts +721 -0
- package/oxlint/configs/browser.ts +5 -0
- package/oxlint/configs/data/globals.ts +18 -0
- package/oxlint/configs/esm.ts +20 -0
- package/oxlint/configs/jest.ts +6 -0
- package/oxlint/configs/node.ts +33 -0
- package/oxlint/configs/nodeCommonJs.ts +14 -0
- package/oxlint/configs/perfectionist.ts +126 -0
- package/oxlint/configs/react.ts +220 -0
- package/oxlint/configs/reactStrict.ts +45 -0
- package/oxlint/configs/strict.ts +482 -0
- package/oxlint/configs/ts.ts +147 -0
- package/oxlint/configs/tsStrict.ts +35 -0
- package/oxlint/configs/unicorn.ts +365 -0
- package/oxlint/configs/vitest.ts +6 -0
- package/oxlint/index.ts +104 -0
- package/oxlint.config.ts +11 -0
- package/package.json +12 -22
- package/tsconfig.base.json +11 -0
- package/tsconfig.json +5 -5
- package/CHANGELOG.md +0 -163
- package/eslint.config.mjs +0 -8
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import type { OxlintGlobals } from 'oxlint';
|
|
3
|
+
|
|
4
|
+
const browser = mapValues(globals.browser, 'readonly') as OxlintGlobals;
|
|
5
|
+
const jest = mapValues(globals.jest, 'readonly') as OxlintGlobals;
|
|
6
|
+
const node = mapValues(globals.node, 'readonly') as OxlintGlobals;
|
|
7
|
+
const vitest = mapValues(globals.vitest, 'readonly') as OxlintGlobals;
|
|
8
|
+
|
|
9
|
+
export default { browser, jest, node, vitest };
|
|
10
|
+
|
|
11
|
+
function mapValues<T extends Record<string, unknown>, V>(
|
|
12
|
+
object: T,
|
|
13
|
+
value: V,
|
|
14
|
+
): { [K in keyof T]: V } {
|
|
15
|
+
return Object.fromEntries(Object.keys(object).map((key) => [key, value])) as {
|
|
16
|
+
[K in keyof T]: V;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// ESM files, *.js, *.mjs only.
|
|
2
|
+
export default {
|
|
3
|
+
plugins: ['node'],
|
|
4
|
+
rules: {
|
|
5
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/global-require.html
|
|
6
|
+
'node/global-require': 'error',
|
|
7
|
+
|
|
8
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-exports-assign.html
|
|
9
|
+
'node/no-exports-assign': 'error',
|
|
10
|
+
|
|
11
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-new-require.html
|
|
12
|
+
'node/no-new-require': 'error',
|
|
13
|
+
|
|
14
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-path-concat.html
|
|
15
|
+
'node/no-path-concat': 'error',
|
|
16
|
+
|
|
17
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-process-env.html
|
|
18
|
+
'node/no-process-env': 'off',
|
|
19
|
+
},
|
|
20
|
+
} as const;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import globals from './data/globals.ts';
|
|
2
|
+
|
|
3
|
+
// Node.js best practices
|
|
4
|
+
export default {
|
|
5
|
+
globals: globals.node,
|
|
6
|
+
plugins: ['node', 'unicorn'],
|
|
7
|
+
rules: {
|
|
8
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/global-require.html
|
|
9
|
+
'node/global-require': 'error',
|
|
10
|
+
|
|
11
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-exports-assign.html
|
|
12
|
+
'node/no-exports-assign': 'error',
|
|
13
|
+
|
|
14
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-new-require.html
|
|
15
|
+
'node/no-new-require': 'error',
|
|
16
|
+
|
|
17
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-path-concat.html
|
|
18
|
+
'node/no-path-concat': 'error',
|
|
19
|
+
|
|
20
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-node-protocol.html
|
|
21
|
+
// Equivalent to n/prefer-node-protocol — use unicorn plugin in oxlint
|
|
22
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
23
|
+
|
|
24
|
+
// https://eslint.org/docs/latest/rules/no-console
|
|
25
|
+
// Stricter than base: only allow specific methods in Node context
|
|
26
|
+
'no-console': [
|
|
27
|
+
'error',
|
|
28
|
+
{
|
|
29
|
+
allow: ['debug', 'error', 'info', 'warn'],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
} as const;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import globals from './data/globals.ts';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
env: {
|
|
5
|
+
commonjs: true,
|
|
6
|
+
es2022: true,
|
|
7
|
+
},
|
|
8
|
+
files: ['**/*.js', '**/*.cjs'],
|
|
9
|
+
globals: globals.node,
|
|
10
|
+
rules: {
|
|
11
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-require-imports.html
|
|
12
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Perfectionist sorting rules
|
|
2
|
+
export default {
|
|
3
|
+
jsPlugins: ['eslint-plugin-perfectionist'],
|
|
4
|
+
rules: {
|
|
5
|
+
// https://perfectionist.dev/rules/sort-array-includes
|
|
6
|
+
'perfectionist/sort-array-includes': [
|
|
7
|
+
'error',
|
|
8
|
+
{
|
|
9
|
+
order: 'asc',
|
|
10
|
+
type: 'alphabetical',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
|
|
14
|
+
// https://perfectionist.dev/rules/sort-enums
|
|
15
|
+
'perfectionist/sort-enums': [
|
|
16
|
+
'error',
|
|
17
|
+
{
|
|
18
|
+
order: 'asc',
|
|
19
|
+
type: 'alphabetical',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
// https://perfectionist.dev/rules/sort-exports
|
|
24
|
+
'perfectionist/sort-exports': [
|
|
25
|
+
'error',
|
|
26
|
+
{
|
|
27
|
+
order: 'asc',
|
|
28
|
+
type: 'alphabetical',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
// https://perfectionist.dev/rules/sort-imports
|
|
33
|
+
'perfectionist/sort-imports': [
|
|
34
|
+
'error',
|
|
35
|
+
{
|
|
36
|
+
groups: ['import', 'parent', 'sibling', 'unknown'],
|
|
37
|
+
newlinesBetween: 0,
|
|
38
|
+
order: 'asc',
|
|
39
|
+
type: 'alphabetical',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
// https://perfectionist.dev/rules/sort-interfaces
|
|
44
|
+
'perfectionist/sort-interfaces': [
|
|
45
|
+
'error',
|
|
46
|
+
{
|
|
47
|
+
order: 'asc',
|
|
48
|
+
type: 'alphabetical',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
|
|
52
|
+
// https://perfectionist.dev/rules/sort-intersection-types
|
|
53
|
+
'perfectionist/sort-intersection-types': [
|
|
54
|
+
'error',
|
|
55
|
+
{
|
|
56
|
+
order: 'asc',
|
|
57
|
+
type: 'alphabetical',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
// https://perfectionist.dev/rules/sort-jsx-props
|
|
62
|
+
'perfectionist/sort-jsx-props': [
|
|
63
|
+
'error',
|
|
64
|
+
{
|
|
65
|
+
order: 'asc',
|
|
66
|
+
type: 'alphabetical',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
|
|
70
|
+
// https://perfectionist.dev/rules/sort-named-exports
|
|
71
|
+
'perfectionist/sort-named-exports': [
|
|
72
|
+
'error',
|
|
73
|
+
{
|
|
74
|
+
order: 'asc',
|
|
75
|
+
type: 'alphabetical',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
|
|
79
|
+
// https://perfectionist.dev/rules/sort-named-imports
|
|
80
|
+
'perfectionist/sort-named-imports': [
|
|
81
|
+
'error',
|
|
82
|
+
{
|
|
83
|
+
order: 'asc',
|
|
84
|
+
type: 'alphabetical',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
|
|
88
|
+
// https://perfectionist.dev/rules/sort-object-types
|
|
89
|
+
'perfectionist/sort-object-types': [
|
|
90
|
+
'error',
|
|
91
|
+
{
|
|
92
|
+
order: 'asc',
|
|
93
|
+
type: 'alphabetical',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
|
|
97
|
+
// https://perfectionist.dev/rules/sort-objects
|
|
98
|
+
'perfectionist/sort-objects': [
|
|
99
|
+
'error',
|
|
100
|
+
{
|
|
101
|
+
order: 'asc',
|
|
102
|
+
partitionByComment: true,
|
|
103
|
+
partitionByNewLine: true,
|
|
104
|
+
type: 'alphabetical',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
|
|
108
|
+
// https://perfectionist.dev/rules/sort-switch-case
|
|
109
|
+
'perfectionist/sort-switch-case': [
|
|
110
|
+
'error',
|
|
111
|
+
{
|
|
112
|
+
order: 'asc',
|
|
113
|
+
type: 'alphabetical',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
|
|
117
|
+
// https://perfectionist.dev/rules/sort-union-types
|
|
118
|
+
'perfectionist/sort-union-types': [
|
|
119
|
+
'error',
|
|
120
|
+
{
|
|
121
|
+
order: 'asc',
|
|
122
|
+
type: 'alphabetical',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
} as const;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// React + React Hooks rules
|
|
2
|
+
export default {
|
|
3
|
+
plugins: ['react'],
|
|
4
|
+
rules: {
|
|
5
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/exhaustive-deps.html
|
|
6
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
7
|
+
|
|
8
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/rules-of-hooks.html
|
|
9
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
10
|
+
|
|
11
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/button-has-type.html
|
|
12
|
+
'react/button-has-type': 'error',
|
|
13
|
+
|
|
14
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/destructuring-assignment.html
|
|
15
|
+
'react/destructuring-assignment': 'warn',
|
|
16
|
+
|
|
17
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/forward-ref-uses-ref.html
|
|
18
|
+
'react/forward-ref-uses-ref': 'error',
|
|
19
|
+
|
|
20
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-boolean-value.html
|
|
21
|
+
'react/jsx-boolean-value': [
|
|
22
|
+
'error',
|
|
23
|
+
'never',
|
|
24
|
+
{
|
|
25
|
+
always: [],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-curly-brace-presence.html
|
|
30
|
+
'react/jsx-curly-brace-presence': [
|
|
31
|
+
'error',
|
|
32
|
+
{
|
|
33
|
+
children: 'never',
|
|
34
|
+
props: 'never',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-filename-extension.html
|
|
39
|
+
'react/jsx-filename-extension': [
|
|
40
|
+
'error',
|
|
41
|
+
{
|
|
42
|
+
extensions: ['.jsx', '.tsx'],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-fragments.html
|
|
47
|
+
'react/jsx-fragments': ['error', 'syntax'],
|
|
48
|
+
|
|
49
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-comment-textnodes.html
|
|
50
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
51
|
+
|
|
52
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-constructed-context-values.html
|
|
53
|
+
'react/jsx-no-constructed-context-values': 'error',
|
|
54
|
+
|
|
55
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-duplicate-props.html
|
|
56
|
+
'react/jsx-no-duplicate-props': 'error',
|
|
57
|
+
|
|
58
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-script-url.html
|
|
59
|
+
'react/jsx-no-script-url': [
|
|
60
|
+
'error',
|
|
61
|
+
[
|
|
62
|
+
{
|
|
63
|
+
name: 'Link',
|
|
64
|
+
props: ['to', 'href'],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'NavLink',
|
|
68
|
+
props: ['to'],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'NextLink',
|
|
72
|
+
props: ['to', 'href'],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
{
|
|
76
|
+
includeFromSettings: true,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
|
|
80
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-target-blank.html
|
|
81
|
+
'react/jsx-no-target-blank': [
|
|
82
|
+
'error',
|
|
83
|
+
{
|
|
84
|
+
allowReferrer: false,
|
|
85
|
+
enforceDynamicLinks: 'always',
|
|
86
|
+
forms: false,
|
|
87
|
+
links: true,
|
|
88
|
+
warnOnSpreadAttributes: false,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
|
|
92
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-undef.html
|
|
93
|
+
'react/jsx-no-undef': 'error',
|
|
94
|
+
|
|
95
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-useless-fragment.html
|
|
96
|
+
'react/jsx-no-useless-fragment': [
|
|
97
|
+
'error',
|
|
98
|
+
{
|
|
99
|
+
allowExpressions: true,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
|
|
103
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-pascal-case.html
|
|
104
|
+
'react/jsx-pascal-case': [
|
|
105
|
+
'error',
|
|
106
|
+
{
|
|
107
|
+
allowAllCaps: true,
|
|
108
|
+
allowLeadingUnderscore: false,
|
|
109
|
+
allowNamespace: true,
|
|
110
|
+
ignore: [],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
|
|
114
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-props-no-spread-multi.html
|
|
115
|
+
'react/jsx-props-no-spread-multi': 'error',
|
|
116
|
+
|
|
117
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-array-index-key.html
|
|
118
|
+
'react/no-array-index-key': 'error',
|
|
119
|
+
|
|
120
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-children-prop.html
|
|
121
|
+
'react/no-children-prop': 'error',
|
|
122
|
+
|
|
123
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-danger.html
|
|
124
|
+
'react/no-danger': 'warn',
|
|
125
|
+
|
|
126
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-danger-with-children.html
|
|
127
|
+
'react/no-danger-with-children': 'error',
|
|
128
|
+
|
|
129
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-deprecated.html
|
|
130
|
+
'react/no-deprecated': 'error',
|
|
131
|
+
|
|
132
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-did-update-set-state.html
|
|
133
|
+
'react/no-did-update-set-state': 'error',
|
|
134
|
+
|
|
135
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-direct-mutation-state.html
|
|
136
|
+
'react/no-direct-mutation-state': 'error',
|
|
137
|
+
|
|
138
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-find-dom-node.html
|
|
139
|
+
'react/no-find-dom-node': 'error',
|
|
140
|
+
|
|
141
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-invalid-html-attribute.html
|
|
142
|
+
'react/no-invalid-html-attribute': 'error',
|
|
143
|
+
|
|
144
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-is-mounted.html
|
|
145
|
+
'react/no-is-mounted': 'error',
|
|
146
|
+
|
|
147
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-namespace.html
|
|
148
|
+
'react/no-namespace': 'error',
|
|
149
|
+
|
|
150
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-redundant-should-component-update.html
|
|
151
|
+
'react/no-redundant-should-component-update': 'error',
|
|
152
|
+
|
|
153
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-render-return-value.html
|
|
154
|
+
'react/no-render-return-value': 'error',
|
|
155
|
+
|
|
156
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-string-refs.html
|
|
157
|
+
'react/no-string-refs': [
|
|
158
|
+
'error',
|
|
159
|
+
{
|
|
160
|
+
noTemplateLiterals: true,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
|
|
164
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-this-in-sfc.html
|
|
165
|
+
'react/no-this-in-sfc': 'error',
|
|
166
|
+
|
|
167
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-unescaped-entities.html
|
|
168
|
+
'react/no-unescaped-entities': 'warn',
|
|
169
|
+
|
|
170
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-unknown-property.html
|
|
171
|
+
'react/no-unknown-property': [
|
|
172
|
+
'error',
|
|
173
|
+
{
|
|
174
|
+
ignore: [],
|
|
175
|
+
requireDataLowercase: false,
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
|
|
179
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-unstable-nested-components.html
|
|
180
|
+
'react/no-unstable-nested-components': 'error',
|
|
181
|
+
|
|
182
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-unused-state.html
|
|
183
|
+
'react/no-unused-state': 'error',
|
|
184
|
+
|
|
185
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-will-update-set-state.html
|
|
186
|
+
'react/no-will-update-set-state': 'error',
|
|
187
|
+
|
|
188
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/prefer-es6-class.html
|
|
189
|
+
'react/prefer-es6-class': ['error', 'always'],
|
|
190
|
+
|
|
191
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/self-closing-comp.html
|
|
192
|
+
'react/self-closing-comp': [
|
|
193
|
+
'error',
|
|
194
|
+
{
|
|
195
|
+
component: true,
|
|
196
|
+
html: true,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
|
|
200
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/state-in-constructor.html
|
|
201
|
+
'react/state-in-constructor': ['error', 'always'],
|
|
202
|
+
|
|
203
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/style-prop-object.html
|
|
204
|
+
'react/style-prop-object': [
|
|
205
|
+
'error',
|
|
206
|
+
{
|
|
207
|
+
allow: [],
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
|
|
211
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/require-render-return.html
|
|
212
|
+
'react/require-render-return': 'error',
|
|
213
|
+
|
|
214
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/sort-comp.html
|
|
215
|
+
'react/sort-comp': 'error',
|
|
216
|
+
|
|
217
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/void-dom-elements-no-children.html
|
|
218
|
+
'react/void-dom-elements-no-children': 'error',
|
|
219
|
+
},
|
|
220
|
+
} as const;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Strict React rules — extends react, enables stricter checks.
|
|
2
|
+
// Spread on top of react for packages with strict React requirements.
|
|
3
|
+
export default {
|
|
4
|
+
plugins: ['react'],
|
|
5
|
+
rules: {
|
|
6
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/exhaustive-deps.html
|
|
7
|
+
// Upgrade from react: error in strict context
|
|
8
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
9
|
+
|
|
10
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/checked-requires-onchange-or-readonly.html
|
|
11
|
+
'react/checked-requires-onchange-or-readonly': 'error',
|
|
12
|
+
|
|
13
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/destructuring-assignment.html
|
|
14
|
+
// Upgrade from react warn to strict error
|
|
15
|
+
'react/destructuring-assignment': 'error',
|
|
16
|
+
|
|
17
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/function-component-definition.html
|
|
18
|
+
'react/function-component-definition': [
|
|
19
|
+
'error',
|
|
20
|
+
{
|
|
21
|
+
namedComponents: ['function-declaration', 'function-expression'],
|
|
22
|
+
unnamedComponents: 'function-expression',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/hook-use-state.html
|
|
27
|
+
'react/hook-use-state': 'error',
|
|
28
|
+
|
|
29
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-key.html
|
|
30
|
+
'react/jsx-key': 'error',
|
|
31
|
+
|
|
32
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-leaked-render.html
|
|
33
|
+
'react/jsx-no-leaked-render': 'error',
|
|
34
|
+
|
|
35
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-unescaped-entities.html
|
|
36
|
+
// Upgrade from react warn to strict error
|
|
37
|
+
'react/no-unescaped-entities': 'error',
|
|
38
|
+
|
|
39
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-unsafe.html
|
|
40
|
+
'react/no-unsafe': 'error',
|
|
41
|
+
|
|
42
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/prefer-stateless-function.html
|
|
43
|
+
'react/prefer-stateless-function': 'error',
|
|
44
|
+
},
|
|
45
|
+
} as const;
|