-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
84 lines (79 loc) · 2.42 KB
/
eslint.config.mjs
File metadata and controls
84 lines (79 loc) · 2.42 KB
1
2
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
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from "eslint-plugin-storybook";
import { createRequire } from "module";
// Next.js 16 uses a different ESLint config structure
const require = createRequire(import.meta.url);
// Import Next.js ESLint config
let nextConfig = [];
try {
const nextPlugin = require("@next/eslint-plugin-next");
const tsPlugin = require("@typescript-eslint/eslint-plugin");
const tsParser = require("@typescript-eslint/parser");
const reactPlugin = require("eslint-plugin-react");
const reactHooksPlugin = require("eslint-plugin-react-hooks");
nextConfig = [
{
plugins: {
"@next/next": nextPlugin,
"@typescript-eslint": tsPlugin,
"react": reactPlugin,
"react-hooks": reactHooksPlugin,
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,
...tsPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
},
},
];
} catch (err) {
// Fallback if plugins aren't available
console.warn(
"Failed to load one or more ESLint plugins (e.g., @next/eslint-plugin-next, @typescript-eslint/eslint-plugin, eslint-plugin-react, eslint-plugin-react-hooks). " +
"Please ensure all required plugins are installed. Error details:", err
);
}
const eslintConfig = [
{
ignores: [
"node_modules/**",
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
"coverage/**",
"html/**",
".storybook-static/**",
"storybook-static/**",
"public/mockServiceWorker.js"
]
},
...nextConfig,
...storybook.configs["flat/recommended"],
{
files: ["tests/**/*", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@next/next/no-assign-module-variable": "off",
"@next/next/no-img-element": "off",
"react-hooks/refs": "off"
}
},
{
files: ["*.config.js", "*.config.ts", "*.config.mjs", "playwright.config.ts"],
rules: {
"@typescript-eslint/no-require-imports": "off"
}
}
];
export default eslintConfig;