@newsteam/eslint-config 1.2.15 → 1.2.17
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -52
- package/dist/plugins/sort-react-dependency-arrays.d.ts +3 -2
- package/dist/plugins/sort-react-dependency-arrays.d.ts.map +1 -1
- package/dist/plugins/sort-react-dependency-arrays.js +95 -18
- package/dist/rules/array-function.d.ts +3 -0
- package/dist/rules/array-function.d.ts.map +1 -0
- package/dist/rules/array-function.js +56 -0
- package/dist/rules/css-modules.d.ts +3 -0
- package/dist/rules/css-modules.d.ts.map +1 -0
- package/dist/rules/css-modules.js +27 -0
- package/dist/rules/destructuring.d.ts +3 -0
- package/dist/rules/destructuring.d.ts.map +1 -0
- package/dist/rules/destructuring.js +39 -0
- package/dist/rules/eslint-comments.d.ts +3 -0
- package/dist/rules/eslint-comments.d.ts.map +1 -0
- package/dist/rules/eslint-comments.js +77 -0
- package/dist/rules/import-newlines.d.ts +3 -0
- package/dist/rules/import-newlines.d.ts.map +1 -0
- package/dist/rules/import-newlines.js +26 -0
- package/dist/rules/import-x.d.ts +3 -0
- package/dist/rules/import-x.d.ts.map +1 -0
- package/dist/rules/import-x.js +420 -0
- package/dist/{rules.d.ts → rules/index.d.ts} +1 -1
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/{rules.js → rules/index.js} +51 -1
- package/dist/rules/next.d.ts +3 -0
- package/dist/rules/next.d.ts.map +1 -0
- package/dist/rules/next.js +140 -0
- package/dist/rules/no-unsanitized.d.ts +3 -0
- package/dist/rules/no-unsanitized.d.ts.map +1 -0
- package/dist/rules/no-unsanitized.js +38 -0
- package/dist/rules/no-useless-assign.d.ts +3 -0
- package/dist/rules/no-useless-assign.d.ts.map +1 -0
- package/dist/rules/no-useless-assign.js +20 -0
- package/dist/rules/node.d.ts +3 -0
- package/dist/rules/node.d.ts.map +1 -0
- package/dist/rules/node.js +305 -0
- package/dist/rules/perfectionist.d.ts +3 -0
- package/dist/rules/perfectionist.d.ts.map +1 -0
- package/dist/rules/perfectionist.js +94 -0
- package/dist/rules/promise.d.ts +3 -0
- package/dist/rules/promise.d.ts.map +1 -0
- package/dist/rules/promise.js +123 -0
- package/dist/rules/react-19-upgrade.d.ts +3 -0
- package/dist/rules/react-19-upgrade.d.ts.map +1 -0
- package/dist/rules/react-19-upgrade.js +20 -0
- package/dist/rules/react-compiler.d.ts +3 -0
- package/dist/rules/react-compiler.d.ts.map +1 -0
- package/dist/{plugins → rules}/react-compiler.js +7 -9
- package/dist/rules/react-hooks.d.ts +3 -0
- package/dist/rules/react-hooks.d.ts.map +1 -0
- package/dist/rules/react-hooks.js +163 -0
- package/dist/rules/react-perf.d.ts +3 -0
- package/dist/rules/react-perf.d.ts.map +1 -0
- package/dist/rules/react-perf.js +47 -0
- package/dist/rules/react-refresh.d.ts +3 -0
- package/dist/rules/react-refresh.d.ts.map +1 -0
- package/dist/rules/react-refresh.js +19 -0
- package/dist/rules/react.d.ts +3 -0
- package/dist/rules/react.d.ts.map +1 -0
- package/dist/rules/react.js +740 -0
- package/dist/rules/security.d.ts +3 -0
- package/dist/rules/security.d.ts.map +1 -0
- package/dist/rules/security.js +112 -0
- package/dist/rules/sort-react-dependency-arrays.d.ts +3 -0
- package/dist/rules/sort-react-dependency-arrays.d.ts.map +1 -0
- package/dist/rules/sort-react-dependency-arrays.js +12 -0
- package/dist/rules/stylistic.d.ts +3 -0
- package/dist/rules/stylistic.d.ts.map +1 -0
- package/dist/rules/stylistic.js +916 -0
- package/dist/rules/typescript.d.ts +3 -0
- package/dist/rules/typescript.d.ts.map +1 -0
- package/dist/{plugins → rules}/typescript.js +2 -1
- package/dist/rules/unicorn.d.ts +3 -0
- package/dist/rules/unicorn.d.ts.map +1 -0
- package/dist/rules/unicorn.js +998 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/package.json +11 -13
- package/dist/plugins/array-function.d.ts +0 -3
- package/dist/plugins/array-function.d.ts.map +0 -1
- package/dist/plugins/array-function.js +0 -58
- package/dist/plugins/css-modules.d.ts +0 -3
- package/dist/plugins/css-modules.d.ts.map +0 -1
- package/dist/plugins/css-modules.js +0 -19
- package/dist/plugins/destructuring.d.ts +0 -3
- package/dist/plugins/destructuring.d.ts.map +0 -1
- package/dist/plugins/destructuring.js +0 -41
- package/dist/plugins/eslint-comments.d.ts +0 -3
- package/dist/plugins/eslint-comments.d.ts.map +0 -1
- package/dist/plugins/eslint-comments.js +0 -79
- package/dist/plugins/import-newlines.d.ts +0 -3
- package/dist/plugins/import-newlines.d.ts.map +0 -1
- package/dist/plugins/import-newlines.js +0 -28
- package/dist/plugins/import-x.d.ts +0 -3
- package/dist/plugins/import-x.d.ts.map +0 -1
- package/dist/plugins/import-x.js +0 -418
- package/dist/plugins/newline-destructuring.d.ts +0 -3
- package/dist/plugins/newline-destructuring.d.ts.map +0 -1
- package/dist/plugins/newline-destructuring.js +0 -26
- package/dist/plugins/next.d.ts +0 -3
- package/dist/plugins/next.d.ts.map +0 -1
- package/dist/plugins/next.js +0 -142
- package/dist/plugins/no-unsanitized.d.ts +0 -3
- package/dist/plugins/no-unsanitized.d.ts.map +0 -1
- package/dist/plugins/no-unsanitized.js +0 -40
- package/dist/plugins/no-useless-assign.d.ts +0 -3
- package/dist/plugins/no-useless-assign.d.ts.map +0 -1
- package/dist/plugins/no-useless-assign.js +0 -22
- package/dist/plugins/node.d.ts +0 -3
- package/dist/plugins/node.d.ts.map +0 -1
- package/dist/plugins/node.js +0 -307
- package/dist/plugins/perfectionist.d.ts +0 -3
- package/dist/plugins/perfectionist.d.ts.map +0 -1
- package/dist/plugins/perfectionist.js +0 -96
- package/dist/plugins/promise.d.ts +0 -3
- package/dist/plugins/promise.d.ts.map +0 -1
- package/dist/plugins/promise.js +0 -125
- package/dist/plugins/react-19-upgrade.d.ts +0 -3
- package/dist/plugins/react-19-upgrade.d.ts.map +0 -1
- package/dist/plugins/react-19-upgrade.js +0 -22
- package/dist/plugins/react-compiler.d.ts +0 -3
- package/dist/plugins/react-compiler.d.ts.map +0 -1
- package/dist/plugins/react-hooks.d.ts +0 -3
- package/dist/plugins/react-hooks.d.ts.map +0 -1
- package/dist/plugins/react-hooks.js +0 -165
- package/dist/plugins/react-perf.d.ts +0 -3
- package/dist/plugins/react-perf.d.ts.map +0 -1
- package/dist/plugins/react-perf.js +0 -49
- package/dist/plugins/react-refresh.d.ts +0 -3
- package/dist/plugins/react-refresh.d.ts.map +0 -1
- package/dist/plugins/react-refresh.js +0 -21
- package/dist/plugins/react.d.ts +0 -3
- package/dist/plugins/react.d.ts.map +0 -1
- package/dist/plugins/react.js +0 -738
- package/dist/plugins/security.d.ts +0 -3
- package/dist/plugins/security.d.ts.map +0 -1
- package/dist/plugins/security.js +0 -114
- package/dist/plugins/stylistic.d.ts +0 -3
- package/dist/plugins/stylistic.d.ts.map +0 -1
- package/dist/plugins/stylistic.js +0 -901
- package/dist/plugins/typescript.d.ts +0 -3
- package/dist/plugins/typescript.d.ts.map +0 -1
- package/dist/plugins/unicorn.d.ts +0 -3
- package/dist/plugins/unicorn.d.ts.map +0 -1
- package/dist/plugins/unicorn.js +0 -994
- package/dist/rules.d.ts.map +0 -1
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import eslintImportX from "eslint-plugin-import-x";
|
|
2
|
+
export const importXPluginConfig = {
|
|
3
|
+
plugins: {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- don't have a choice
|
|
5
|
+
"import-x": eslintImportX,
|
|
6
|
+
},
|
|
7
|
+
rules: {
|
|
8
|
+
/*
|
|
9
|
+
* In both Flow and TypeScript you can mark an import as a type-only
|
|
10
|
+
* import by adding a "kind" marker to the import. Both languages
|
|
11
|
+
* support two positions for marker.
|
|
12
|
+
*
|
|
13
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
|
|
14
|
+
*/
|
|
15
|
+
"import-x/consistent-type-specifier-style": [
|
|
16
|
+
"warn",
|
|
17
|
+
"prefer-top-level",
|
|
18
|
+
],
|
|
19
|
+
/*
|
|
20
|
+
* Ensure a default export is present, given a default import.
|
|
21
|
+
*
|
|
22
|
+
* BROKEN
|
|
23
|
+
*
|
|
24
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/default.md
|
|
25
|
+
*/
|
|
26
|
+
"import-x/default": "off",
|
|
27
|
+
/*
|
|
28
|
+
* Enforce a leading comment with the webpackChunkName for dynamic imports
|
|
29
|
+
*
|
|
30
|
+
* This is turned off for now because it doesn't work correctly. Says
|
|
31
|
+
* that valid comments are invalid. Likely a bug in the plugin.
|
|
32
|
+
*
|
|
33
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/dynamic-import-chunkname.md
|
|
34
|
+
*/
|
|
35
|
+
"import-x/dynamic-import-chunkname": "off",
|
|
36
|
+
/*
|
|
37
|
+
* Report any invalid exports, i.e. re-export of the same name
|
|
38
|
+
*
|
|
39
|
+
* BROKEN
|
|
40
|
+
*
|
|
41
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/export.md
|
|
42
|
+
*/
|
|
43
|
+
"import-x/export": "off",
|
|
44
|
+
/*
|
|
45
|
+
* Ensure all exports appear after other statements
|
|
46
|
+
*
|
|
47
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/exports-last.md
|
|
48
|
+
*/
|
|
49
|
+
"import-x/exports-last": "warn",
|
|
50
|
+
/*
|
|
51
|
+
* Ensure consistent use of file extension within the import path
|
|
52
|
+
*
|
|
53
|
+
* Turning this off since the future of node >= 16 requires extensions
|
|
54
|
+
*
|
|
55
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
|
|
56
|
+
*/
|
|
57
|
+
"import-x/extensions": "off",
|
|
58
|
+
/*
|
|
59
|
+
* Ensure all imports appear before other statements
|
|
60
|
+
*
|
|
61
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/first.md
|
|
62
|
+
*/
|
|
63
|
+
"import-x/first": "warn",
|
|
64
|
+
/*
|
|
65
|
+
* Prefer named exports to be grouped together in a single export declaration
|
|
66
|
+
*
|
|
67
|
+
* This is off for now because when you create anything that uses an interface
|
|
68
|
+
* in Typescript, you have to export that interface otherwise you'll get an error
|
|
69
|
+
* to the tune of:
|
|
70
|
+
*
|
|
71
|
+
* 'Default export of the module has or is using private name'
|
|
72
|
+
*
|
|
73
|
+
* As of the writing of this comment, you can't export your interface in the
|
|
74
|
+
* group, because the typescript parser sees that as an undefined variable.
|
|
75
|
+
* This means that the only option available is to export the interface and
|
|
76
|
+
* members separately instead of in a group.
|
|
77
|
+
*
|
|
78
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/group-exports.md
|
|
79
|
+
*/
|
|
80
|
+
"import-x/group-exports": "off",
|
|
81
|
+
/*
|
|
82
|
+
* Limit the maximum number of dependencies a module can have
|
|
83
|
+
*
|
|
84
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
|
|
85
|
+
*/
|
|
86
|
+
"import-x/max-dependencies": [
|
|
87
|
+
"warn",
|
|
88
|
+
{
|
|
89
|
+
max: 25,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
/*
|
|
93
|
+
* Ensure named imports correspond to a named export in the remote file.
|
|
94
|
+
*
|
|
95
|
+
* Typescript takes care of this for us already, and @react-email/components bugs this out
|
|
96
|
+
*
|
|
97
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/named.md
|
|
98
|
+
*/
|
|
99
|
+
"import-x/named": "off",
|
|
100
|
+
/*
|
|
101
|
+
* Ensure imported namespaces contain dereferenced properties as they are dereferenced.
|
|
102
|
+
*
|
|
103
|
+
* BROKEN
|
|
104
|
+
*
|
|
105
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/namespace.md
|
|
106
|
+
*/
|
|
107
|
+
"import-x/namespace": "off",
|
|
108
|
+
/*
|
|
109
|
+
* Enforce a newline after import statements
|
|
110
|
+
*
|
|
111
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/newline-after-import.md
|
|
112
|
+
*/
|
|
113
|
+
"import-x/newline-after-import": [
|
|
114
|
+
"warn",
|
|
115
|
+
{
|
|
116
|
+
count: 2,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
/*
|
|
120
|
+
* Forbid import of modules using absolute paths
|
|
121
|
+
*
|
|
122
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-absolute-path.md
|
|
123
|
+
*/
|
|
124
|
+
"import-x/no-absolute-path": "warn",
|
|
125
|
+
/*
|
|
126
|
+
* Report AMD require and define calls.
|
|
127
|
+
*
|
|
128
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-amd.md
|
|
129
|
+
*/
|
|
130
|
+
"import-x/no-amd": "warn",
|
|
131
|
+
/*
|
|
132
|
+
* Forbid anonymous values as default exports
|
|
133
|
+
*
|
|
134
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-anonymous-default-export.md
|
|
135
|
+
*/
|
|
136
|
+
"import-x/no-anonymous-default-export": [
|
|
137
|
+
"warn",
|
|
138
|
+
{
|
|
139
|
+
allowObject: true,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
/*
|
|
143
|
+
* Report CommonJS require calls and module.exports or exports.*.
|
|
144
|
+
*
|
|
145
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-commonjs.md
|
|
146
|
+
*/
|
|
147
|
+
"import-x/no-commonjs": "warn",
|
|
148
|
+
/*
|
|
149
|
+
* Forbid a module from importing a module with a dependency path back to itself
|
|
150
|
+
*
|
|
151
|
+
* This rule doesn't work correctly, off for now
|
|
152
|
+
*
|
|
153
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-cycle.md
|
|
154
|
+
*/
|
|
155
|
+
"import-x/no-cycle": "off",
|
|
156
|
+
/*
|
|
157
|
+
* Forbid default exports
|
|
158
|
+
*
|
|
159
|
+
* Broken in eslint 10
|
|
160
|
+
*
|
|
161
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-default-export.md
|
|
162
|
+
*/
|
|
163
|
+
"import-x/no-default-export": "off",
|
|
164
|
+
/*
|
|
165
|
+
* Report imported names marked with @deprecated documentation tag
|
|
166
|
+
*
|
|
167
|
+
* BROKEN
|
|
168
|
+
*
|
|
169
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-deprecated.md
|
|
170
|
+
*/
|
|
171
|
+
"import-x/no-deprecated": "off",
|
|
172
|
+
/*
|
|
173
|
+
* Report repeated import of the same module in multiple places
|
|
174
|
+
*
|
|
175
|
+
* BROKEN
|
|
176
|
+
*
|
|
177
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
|
|
178
|
+
*/
|
|
179
|
+
"import-x/no-duplicates": "warn",
|
|
180
|
+
/*
|
|
181
|
+
* Forbid require() calls with expressions
|
|
182
|
+
*
|
|
183
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-dynamic-require.md
|
|
184
|
+
*/
|
|
185
|
+
"import-x/no-dynamic-require": "warn",
|
|
186
|
+
/*
|
|
187
|
+
* Reports the use of empty named import blocks.
|
|
188
|
+
*
|
|
189
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-empty-named-blocks.md
|
|
190
|
+
*/
|
|
191
|
+
"import-x/no-empty-named-blocks": "warn",
|
|
192
|
+
/*
|
|
193
|
+
* Forbid the use of extraneous packages
|
|
194
|
+
*
|
|
195
|
+
* Taken care of by node/no-extraneous-import because it works better
|
|
196
|
+
*
|
|
197
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
198
|
+
*/
|
|
199
|
+
"import-x/no-extraneous-dependencies": "off",
|
|
200
|
+
/*
|
|
201
|
+
* Forbid imports with CommonJS exports
|
|
202
|
+
*
|
|
203
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-import-module-exports.md
|
|
204
|
+
*/
|
|
205
|
+
"import-x/no-import-module-exports": "warn",
|
|
206
|
+
/*
|
|
207
|
+
* Prevent importing the submodules of other modules
|
|
208
|
+
*
|
|
209
|
+
* Off for now because organizing internal modules in parent modules makes sense to me
|
|
210
|
+
*
|
|
211
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-internal-modules.md
|
|
212
|
+
*/
|
|
213
|
+
"import-x/no-internal-modules": "off",
|
|
214
|
+
/*
|
|
215
|
+
* Forbid the use of mutable exports with var or let.
|
|
216
|
+
*
|
|
217
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-mutable-exports.md
|
|
218
|
+
*/
|
|
219
|
+
"import-x/no-mutable-exports": "warn",
|
|
220
|
+
/*
|
|
221
|
+
* Report use of exported name as identifier of default export
|
|
222
|
+
*
|
|
223
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default.md
|
|
224
|
+
*/
|
|
225
|
+
"import-x/no-named-as-default": "off",
|
|
226
|
+
/*
|
|
227
|
+
* Report use of exported name as property of default export
|
|
228
|
+
*
|
|
229
|
+
* Think this is bombing eslint with "heap limit Allocation failed"
|
|
230
|
+
*
|
|
231
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default-member.md
|
|
232
|
+
*/
|
|
233
|
+
"import-x/no-named-as-default-member": "off",
|
|
234
|
+
/*
|
|
235
|
+
* Forbid named default exports
|
|
236
|
+
*
|
|
237
|
+
* This is off because named defaults are sometimes required in the new node >= 16 module system
|
|
238
|
+
*
|
|
239
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-default.md
|
|
240
|
+
*/
|
|
241
|
+
"import-x/no-named-default": "off",
|
|
242
|
+
/*
|
|
243
|
+
* Forbid named exports
|
|
244
|
+
*
|
|
245
|
+
* Off for now because named exports are fine
|
|
246
|
+
*
|
|
247
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-export.md
|
|
248
|
+
*/
|
|
249
|
+
"import-x/no-named-export": "off",
|
|
250
|
+
/*
|
|
251
|
+
* Report namespace imports
|
|
252
|
+
*
|
|
253
|
+
* Off for now because namespace imports are chilled
|
|
254
|
+
*
|
|
255
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-namespace.md
|
|
256
|
+
*/
|
|
257
|
+
"import-x/no-namespace": "off",
|
|
258
|
+
/*
|
|
259
|
+
* No Node.js builtin modules.
|
|
260
|
+
*
|
|
261
|
+
* Off for now since we're assuming that most code is nodejs code
|
|
262
|
+
*
|
|
263
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-nodejs-modules.md
|
|
264
|
+
*/
|
|
265
|
+
"import-x/no-nodejs-modules": "off",
|
|
266
|
+
/*
|
|
267
|
+
* Prevent importing packages through relative paths
|
|
268
|
+
*
|
|
269
|
+
* Off for now because we use relative imports
|
|
270
|
+
*
|
|
271
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-packages.md
|
|
272
|
+
*/
|
|
273
|
+
"import-x/no-relative-packages": "off",
|
|
274
|
+
/*
|
|
275
|
+
* Forbid importing modules from parent directories
|
|
276
|
+
*
|
|
277
|
+
* Off for now because doing something like a utils collection would become impossible
|
|
278
|
+
*
|
|
279
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-parent-imports.md
|
|
280
|
+
*/
|
|
281
|
+
"import-x/no-relative-parent-imports": "off",
|
|
282
|
+
/*
|
|
283
|
+
* Forbid importing a default export by a different name.
|
|
284
|
+
*
|
|
285
|
+
* BROKEN
|
|
286
|
+
*
|
|
287
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-rename-default.md
|
|
288
|
+
*/
|
|
289
|
+
"import-x/no-rename-default": "off",
|
|
290
|
+
/*
|
|
291
|
+
* Restrict which files can be imported in a given folder
|
|
292
|
+
*
|
|
293
|
+
* BROKEN
|
|
294
|
+
*
|
|
295
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-restricted-paths.md
|
|
296
|
+
*/
|
|
297
|
+
"import-x/no-restricted-paths": "off",
|
|
298
|
+
/*
|
|
299
|
+
* Forbid a module from importing itself
|
|
300
|
+
*
|
|
301
|
+
* BROKEN
|
|
302
|
+
*
|
|
303
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-self-import.md
|
|
304
|
+
*/
|
|
305
|
+
"import-x/no-self-import": "off",
|
|
306
|
+
/*
|
|
307
|
+
* Forbid unassigned imports
|
|
308
|
+
*
|
|
309
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unassigned-import.md
|
|
310
|
+
*/
|
|
311
|
+
"import-x/no-unassigned-import": [
|
|
312
|
+
"warn",
|
|
313
|
+
{
|
|
314
|
+
allow: [
|
|
315
|
+
"**/*.css",
|
|
316
|
+
"**/*.scss",
|
|
317
|
+
"@babel/polyfill",
|
|
318
|
+
"@babel/register",
|
|
319
|
+
"@total-typescript/ts-reset",
|
|
320
|
+
"core-js/stable",
|
|
321
|
+
"dotenv/config",
|
|
322
|
+
"jasmine",
|
|
323
|
+
"reflect-metadata",
|
|
324
|
+
"regenerator-runtime/runtime",
|
|
325
|
+
"server-only",
|
|
326
|
+
],
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
/*
|
|
330
|
+
* Ensure imports point to a file/module that can be resolved.
|
|
331
|
+
*
|
|
332
|
+
* This rule has no way to resolve aliases of any kind - off for now
|
|
333
|
+
*
|
|
334
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
|
|
335
|
+
*/
|
|
336
|
+
"import-x/no-unresolved": "off",
|
|
337
|
+
/*
|
|
338
|
+
* Forbid modules without any export, and exports not imported by any modules
|
|
339
|
+
*
|
|
340
|
+
* Off because it doesn't currently support dynamic imports
|
|
341
|
+
*
|
|
342
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unused-modules.md
|
|
343
|
+
*/
|
|
344
|
+
"import-x/no-unused-modules": "off",
|
|
345
|
+
/*
|
|
346
|
+
* Prevent unnecessary path segments in import and require statements
|
|
347
|
+
*
|
|
348
|
+
* BROKEN
|
|
349
|
+
*
|
|
350
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
|
|
351
|
+
*/
|
|
352
|
+
"import-x/no-useless-path-segments": "off",
|
|
353
|
+
/*
|
|
354
|
+
* Forbid webpack loader syntax in imports
|
|
355
|
+
*
|
|
356
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-webpack-loader-syntax.md
|
|
357
|
+
*/
|
|
358
|
+
"import-x/no-webpack-loader-syntax": "warn",
|
|
359
|
+
/*
|
|
360
|
+
* Enforce a convention in module import order
|
|
361
|
+
*
|
|
362
|
+
* Leaving this to eslint-plugin-perfectionist
|
|
363
|
+
*
|
|
364
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
|
|
365
|
+
*/
|
|
366
|
+
"import-x/order": [
|
|
367
|
+
"off",
|
|
368
|
+
{
|
|
369
|
+
groups: [
|
|
370
|
+
"builtin",
|
|
371
|
+
"external",
|
|
372
|
+
"internal",
|
|
373
|
+
"parent",
|
|
374
|
+
"sibling",
|
|
375
|
+
"index",
|
|
376
|
+
"object",
|
|
377
|
+
"type",
|
|
378
|
+
],
|
|
379
|
+
"newlines-between": "always",
|
|
380
|
+
pathGroups: [
|
|
381
|
+
{
|
|
382
|
+
group: "internal",
|
|
383
|
+
pattern: "@src/**",
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
pathGroupsExcludedImportTypes: ["builtin"],
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
/*
|
|
390
|
+
* Prefer a default export if module exports a single name
|
|
391
|
+
*
|
|
392
|
+
* Off for now because we don't prefer this
|
|
393
|
+
*
|
|
394
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-default-export.md
|
|
395
|
+
*/
|
|
396
|
+
"import-x/prefer-default-export": "off",
|
|
397
|
+
/*
|
|
398
|
+
* Enforce using namespace imports for specific modules, like react/react-dom, etc.
|
|
399
|
+
*
|
|
400
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-namespace-import.md
|
|
401
|
+
*/
|
|
402
|
+
"import-x/prefer-namespace-import": [
|
|
403
|
+
"warn",
|
|
404
|
+
{
|
|
405
|
+
patterns: [
|
|
406
|
+
"react",
|
|
407
|
+
"react-dom",
|
|
408
|
+
],
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
/*
|
|
412
|
+
* Report potentially ambiguous parse goal (script vs. module)
|
|
413
|
+
*
|
|
414
|
+
* Broken in eslint 10
|
|
415
|
+
*
|
|
416
|
+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/unambiguous.md
|
|
417
|
+
*/
|
|
418
|
+
"import-x/unambiguous": "off",
|
|
419
|
+
},
|
|
420
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAgCrC,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAgmDhC,CAAC"}
|
|
@@ -15,7 +15,56 @@
|
|
|
15
15
|
* https://eslint.org/docs/latest/rules/#best-practices
|
|
16
16
|
*/
|
|
17
17
|
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
18
|
-
import { MAX_FUNCTION_PARAMETERS, MAXIMUM_CYCLOMATIC_COMPLEXITY, MAXIMUM_FILE_LINE_COUNT, NO_MAGIC_NUMBERS_CONFIG, } from "
|
|
18
|
+
import { MAX_FUNCTION_PARAMETERS, MAXIMUM_CYCLOMATIC_COMPLEXITY, MAXIMUM_FILE_LINE_COUNT, NO_MAGIC_NUMBERS_CONFIG, } from "../settings.js";
|
|
19
|
+
import { arrayFuncPluginConfig } from "./array-function.js";
|
|
20
|
+
import { cssModulesPluginConfig } from "./css-modules.js";
|
|
21
|
+
import { destructuringPluginConfig } from "./destructuring.js";
|
|
22
|
+
import { eslintCommentsPluginConfig } from "./eslint-comments.js";
|
|
23
|
+
import { importNewlinesPluginConfig } from "./import-newlines.js";
|
|
24
|
+
import { importXPluginConfig } from "./import-x.js";
|
|
25
|
+
import { noUnsanitizedPluginConfig } from "./no-unsanitized.js";
|
|
26
|
+
import { noUselessAssignPluginConfig } from "./no-useless-assign.js";
|
|
27
|
+
import { nodePluginConfig } from "./node.js";
|
|
28
|
+
import { perfectionistPluginConfig } from "./perfectionist.js";
|
|
29
|
+
import { promisePluginConfig } from "./promise.js";
|
|
30
|
+
import { react19UpgradePluginConfig } from "./react-19-upgrade.js";
|
|
31
|
+
import { reactCompilerPluginConfig } from "./react-compiler.js";
|
|
32
|
+
import { reactHooksPluginConfig } from "./react-hooks.js";
|
|
33
|
+
import { reactPerfPluginConfig } from "./react-perf.js";
|
|
34
|
+
import { reactRefreshPluginConfig } from "./react-refresh.js";
|
|
35
|
+
import { reactPluginConfig } from "./react.js";
|
|
36
|
+
import { securityPluginConfig } from "./security.js";
|
|
37
|
+
import { sortReactDependenyArraysPluginConfig } from "./sort-react-dependency-arrays.js";
|
|
38
|
+
import { stylisticPluginConfig } from "./stylistic.js";
|
|
39
|
+
import { typescriptPluginConfigs } from "./typescript.js";
|
|
40
|
+
import { unicornPluginConfig } from "./unicorn.js";
|
|
41
|
+
// Always place pluginConfig after rules in case there are overrides (e.g. in the typescriptPlugin)
|
|
42
|
+
const pluginConfig = [
|
|
43
|
+
arrayFuncPluginConfig,
|
|
44
|
+
cssModulesPluginConfig,
|
|
45
|
+
destructuringPluginConfig,
|
|
46
|
+
eslintCommentsPluginConfig,
|
|
47
|
+
importNewlinesPluginConfig,
|
|
48
|
+
// contains rules turned off because they're not compatible with eslint 10
|
|
49
|
+
importXPluginConfig,
|
|
50
|
+
noUnsanitizedPluginConfig,
|
|
51
|
+
noUselessAssignPluginConfig,
|
|
52
|
+
nodePluginConfig,
|
|
53
|
+
perfectionistPluginConfig,
|
|
54
|
+
promisePluginConfig,
|
|
55
|
+
react19UpgradePluginConfig,
|
|
56
|
+
reactCompilerPluginConfig,
|
|
57
|
+
reactHooksPluginConfig,
|
|
58
|
+
reactPerfPluginConfig,
|
|
59
|
+
// contains rules turned off because they're not compatible with eslint 10
|
|
60
|
+
reactPluginConfig,
|
|
61
|
+
reactRefreshPluginConfig,
|
|
62
|
+
securityPluginConfig,
|
|
63
|
+
sortReactDependenyArraysPluginConfig,
|
|
64
|
+
stylisticPluginConfig,
|
|
65
|
+
...typescriptPluginConfigs,
|
|
66
|
+
unicornPluginConfig,
|
|
67
|
+
];
|
|
19
68
|
export const rules = [
|
|
20
69
|
{
|
|
21
70
|
rules: {
|
|
@@ -1447,4 +1496,5 @@ export const rules = [
|
|
|
1447
1496
|
yoda: "warn",
|
|
1448
1497
|
},
|
|
1449
1498
|
},
|
|
1499
|
+
...pluginConfig,
|
|
1450
1500
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/rules/next.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOrC,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAyJrC,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
2
|
+
import next from "@next/eslint-plugin-next";
|
|
3
|
+
/*
|
|
4
|
+
* Extra rules for Eslint
|
|
5
|
+
*
|
|
6
|
+
* https://www.npmjs.com/package/eslint-plugin-next
|
|
7
|
+
*/
|
|
8
|
+
export const nextPluginConfig = {
|
|
9
|
+
plugins: {
|
|
10
|
+
next: fixupPluginRules(next),
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
/*
|
|
14
|
+
* Enforce font-display behavior with Google Fonts.
|
|
15
|
+
*
|
|
16
|
+
* https://nextjs.org/docs/messages/google-font-display
|
|
17
|
+
*/
|
|
18
|
+
"next/google-font-display": "warn",
|
|
19
|
+
/*
|
|
20
|
+
* Ensure preconnect is used with Google Fonts.
|
|
21
|
+
*
|
|
22
|
+
* https://nextjs.org/docs/messages/google-font-preconnect
|
|
23
|
+
*/
|
|
24
|
+
"next/google-font-preconnect": "warn",
|
|
25
|
+
/*
|
|
26
|
+
* Enforce id attribute on next/script components with inline content.
|
|
27
|
+
*
|
|
28
|
+
* https://nextjs.org/docs/messages/inline-script-id
|
|
29
|
+
*/
|
|
30
|
+
"next/inline-script-id": "warn",
|
|
31
|
+
/*
|
|
32
|
+
* Prefer next/script component when using the inline script for Google Analytics.
|
|
33
|
+
*
|
|
34
|
+
* https://nextjs.org/docs/messages/next-script-for-ga
|
|
35
|
+
*/
|
|
36
|
+
"next/next-script-for-ga": "warn",
|
|
37
|
+
/*
|
|
38
|
+
* Prevent assignment to the module variable.
|
|
39
|
+
*
|
|
40
|
+
* https://nextjs.org/docs/messages/no-assign-module-variable
|
|
41
|
+
*/
|
|
42
|
+
"next/no-assign-module-variable": "warn",
|
|
43
|
+
/*
|
|
44
|
+
* Prevent client components from being async functions.
|
|
45
|
+
*
|
|
46
|
+
* https://nextjs.org/docs/messages/no-async-client-component
|
|
47
|
+
*/
|
|
48
|
+
"next/no-async-client-component": "warn",
|
|
49
|
+
/*
|
|
50
|
+
* Prevent usage of next/script's beforeInteractive strategy outside of pages/_document.js.
|
|
51
|
+
*
|
|
52
|
+
* https://nextjs.org/docs/messages/no-before-interactive-script-outside-document
|
|
53
|
+
*/
|
|
54
|
+
"next/no-before-interactive-script-outside-document": "warn",
|
|
55
|
+
/*
|
|
56
|
+
* Prevent manual stylesheet tags.
|
|
57
|
+
*
|
|
58
|
+
* https://nextjs.org/docs/messages/no-css-tags
|
|
59
|
+
*/
|
|
60
|
+
"next/no-css-tags": "warn",
|
|
61
|
+
/*
|
|
62
|
+
* Prevent importing next/document outside of pages/_document.js.
|
|
63
|
+
*
|
|
64
|
+
* https://nextjs.org/docs/messages/no-document-import-in-page
|
|
65
|
+
*/
|
|
66
|
+
"next/no-document-import-in-page": "warn",
|
|
67
|
+
/*
|
|
68
|
+
* Prevent duplicate usage of <Head> in pages/_document.js.
|
|
69
|
+
*
|
|
70
|
+
* https://nextjs.org/docs/messages/no-duplicate-head
|
|
71
|
+
*/
|
|
72
|
+
"next/no-duplicate-head": "warn",
|
|
73
|
+
/*
|
|
74
|
+
* Prevent usage of <head> element.
|
|
75
|
+
*
|
|
76
|
+
* https://nextjs.org/docs/messages/no-head-element
|
|
77
|
+
*/
|
|
78
|
+
"next/no-head-element": "warn",
|
|
79
|
+
/*
|
|
80
|
+
* Prevent usage of next/head in pages/_document.js.
|
|
81
|
+
*
|
|
82
|
+
* https://nextjs.org/docs/messages/no-head-import-in-document
|
|
83
|
+
*/
|
|
84
|
+
"next/no-head-import-in-document": "warn",
|
|
85
|
+
/*
|
|
86
|
+
* Prevent usage of <a> elements to navigate to internal Next.js pages.
|
|
87
|
+
*
|
|
88
|
+
* https://nextjs.org/docs/messages/no-html-link-for-pages
|
|
89
|
+
*/
|
|
90
|
+
"next/no-html-link-for-pages": "warn",
|
|
91
|
+
/*
|
|
92
|
+
* Prevent usage of <img> element due to slower LCP and higher bandwidth.
|
|
93
|
+
*
|
|
94
|
+
* https://nextjs.org/docs/messages/no-img-element
|
|
95
|
+
*/
|
|
96
|
+
"next/no-img-element": "warn",
|
|
97
|
+
/*
|
|
98
|
+
* Prevent page-only custom fonts.
|
|
99
|
+
*
|
|
100
|
+
* https://nextjs.org/docs/messages/no-page-custom-font
|
|
101
|
+
*/
|
|
102
|
+
"next/no-page-custom-font": "warn",
|
|
103
|
+
/*
|
|
104
|
+
* Prevent usage of next/script in next/head component.
|
|
105
|
+
*
|
|
106
|
+
* https://nextjs.org/docs/messages/no-script-component-in-head
|
|
107
|
+
*/
|
|
108
|
+
"next/no-script-component-in-head": "warn",
|
|
109
|
+
/*
|
|
110
|
+
* Prevent usage of styled-jsx in pages/_document.js.
|
|
111
|
+
*
|
|
112
|
+
* https://nextjs.org/docs/messages/no-styled-jsx-in-document
|
|
113
|
+
*/
|
|
114
|
+
"next/no-styled-jsx-in-document": "warn",
|
|
115
|
+
/*
|
|
116
|
+
* Prevent synchronous scripts.
|
|
117
|
+
*
|
|
118
|
+
* https://nextjs.org/docs/messages/no-sync-scripts
|
|
119
|
+
*/
|
|
120
|
+
"next/no-sync-scripts": "warn",
|
|
121
|
+
/*
|
|
122
|
+
* Prevent usage of <title> with Head component from next/document.
|
|
123
|
+
*
|
|
124
|
+
* https://nextjs.org/docs/messages/no-title-in-document-head
|
|
125
|
+
*/
|
|
126
|
+
"next/no-title-in-document-head": "warn",
|
|
127
|
+
/*
|
|
128
|
+
* Prevent common typos in Next.js's data fetching functions
|
|
129
|
+
*
|
|
130
|
+
* https://nextjs.org/docs/messages/no-typos
|
|
131
|
+
*/
|
|
132
|
+
"next/no-typos": "warn",
|
|
133
|
+
/*
|
|
134
|
+
* Prevent duplicate polyfills from Polyfill.io.
|
|
135
|
+
*
|
|
136
|
+
* https://nextjs.org/docs/messages/no-unwanted-polyfillio
|
|
137
|
+
*/
|
|
138
|
+
"next/no-unwanted-polyfillio": "warn",
|
|
139
|
+
},
|
|
140
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-unsanitized.d.ts","sourceRoot":"","sources":["../../src/rules/no-unsanitized.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MA6B9C,CAAC"}
|