@soujvnunes/eslint-config 0.1.0 → 0.3.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/dist/index.js +19 -5
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import js from "@eslint/js";
|
|
3
3
|
import nextPlugin from "@next/eslint-plugin-next";
|
|
4
4
|
import prettier from "eslint-config-prettier";
|
|
5
|
+
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
5
6
|
import importHelpers from "eslint-plugin-import-helpers";
|
|
6
7
|
import importXPlugin from "eslint-plugin-import-x";
|
|
7
8
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
@@ -149,6 +150,22 @@ var restrictedSyntaxRule = {
|
|
|
149
150
|
{
|
|
150
151
|
selector: "TSEnumDeclaration",
|
|
151
152
|
message: "Avoid enums; use const assertions or union types instead."
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
selector: "ImportDeclaration[source.value='react'] > ImportDefaultSpecifier",
|
|
156
|
+
message: "Do not import the React default \u2014 use the ambient `React.*` namespace (the react-jsx runtime needs no React import)."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
selector: "ImportDeclaration[source.value='react'] > ImportNamespaceSpecifier",
|
|
160
|
+
message: "Do not `import * as React` \u2014 use the ambient `React.*` namespace."
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
selector: "ImportDeclaration[source.value='react'] > ImportSpecifier[importKind='type']",
|
|
164
|
+
message: "Reference React types via the ambient `React.*` namespace, not a named `{ type X }` import from react."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
selector: "ImportDeclaration[importKind='type'][source.value='react']",
|
|
168
|
+
message: 'Reference React types via the ambient `React.*` namespace, not `import type \u2026 from "react"`.'
|
|
152
169
|
}
|
|
153
170
|
]
|
|
154
171
|
};
|
|
@@ -178,11 +195,7 @@ var nextRules = {
|
|
|
178
195
|
var importOrderRule = (groups) => ({
|
|
179
196
|
"import-helpers/order-imports": [
|
|
180
197
|
"warn",
|
|
181
|
-
{
|
|
182
|
-
newlinesBetween: "always",
|
|
183
|
-
groups,
|
|
184
|
-
alphabetize: { order: "asc", ignoreCase: true }
|
|
185
|
-
}
|
|
198
|
+
{ newlinesBetween: "always", groups, alphabetize: { order: "asc", ignoreCase: true } }
|
|
186
199
|
]
|
|
187
200
|
});
|
|
188
201
|
var buildConfig = ({
|
|
@@ -222,6 +235,7 @@ var buildConfig = ({
|
|
|
222
235
|
NodeJS: "readonly"
|
|
223
236
|
});
|
|
224
237
|
settings.react = { version: "detect" };
|
|
238
|
+
settings["import-x/resolver-next"] = [createTypeScriptImportResolver({ alwaysTryTypes: true })];
|
|
225
239
|
}
|
|
226
240
|
const rootConfigOverride = {
|
|
227
241
|
files: ["*.{mjs,js,ts,mts,cts}"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soujvnunes/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared flat ESLint config factories (base + Next.js).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "soujvnunes",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@eslint/js": "^9.39.4",
|
|
26
26
|
"@next/eslint-plugin-next": "^16.2.2",
|
|
27
27
|
"eslint-config-prettier": "^10.1.8",
|
|
28
|
+
"eslint-import-resolver-typescript": "^4.4.5",
|
|
28
29
|
"eslint-plugin-import-helpers": "^2.0.1",
|
|
29
30
|
"eslint-plugin-import-x": "^4.16.2",
|
|
30
31
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|