1- import js from "@eslint/js" ;
2- import { FlatCompat } from "@eslint/eslintrc" ;
1+ import { defineConfig , globalIgnores } from "eslint/config" ;
2+ import nextVitals from "eslint-config-next/core-web-vitals" ;
3+ import nextTs from "eslint-config-next/typescript" ;
34import prettierPlugin from "eslint-plugin-prettier" ;
45
5- const compat = new FlatCompat ( {
6- baseDirectory : import . meta. dirname ,
7- recommendedConfig : js . configs . recommended ,
8- } ) ;
6+ const eslintConfig = defineConfig ( [
7+ ...nextVitals ,
8+ ...nextTs ,
99
10- const eslintConfig = [
11- // Base JavaScript recommendations
12- js . configs . recommended ,
10+ // Override default ignores of eslint-config-next
11+ globalIgnores ( [
12+ // Default ignores of eslint-config-next:
13+ ".next/**" ,
14+ "out/**" ,
15+ "build/**" ,
16+ "next-env.d.ts" ,
1317
14- ...compat . config ( {
15- extends : [ "next/core-web-vitals" , "next/typescript" ] ,
16- } ) ,
18+ // Additional build/test ignores
19+ "node_modules/**" ,
20+ "dist/**" ,
21+ "playwright-report/**" ,
22+ "test-results/**" ,
23+ "*.config.js" ,
24+ "*.config.mjs" ,
25+ ] ) ,
1726
27+ // Custom rules and overrides
1828 {
19- files : [ "**/*.{js,jsx,ts,tsx}" ] ,
2029 plugins : {
2130 prettier : prettierPlugin ,
2231 } ,
2332 rules : {
33+ // Prettier integration
2434 "prettier/prettier" : [
2535 "error" ,
2636 {
@@ -31,13 +41,37 @@ const eslintConfig = [
3141 trailingComma : "es5" ,
3242 } ,
3343 ] ,
44+
45+ // TypeScript overrides
3446 "@typescript-eslint/ban-types" : "off" ,
3547 "@typescript-eslint/no-namespace" : "off" ,
36- "array-callback-return" : "error" ,
3748 "@typescript-eslint/no-empty-object-type" : "off" ,
49+ "react-hooks/purity" : "off" ,
50+ "react-hooks/set-state-in-effect" : "off" ,
51+ "react-hooks/use-memo" : "off" ,
52+ "react-hooks/immutability" : "off" ,
53+ "react-hooks/refs" : "off" ,
54+ "@typescript-eslint/no-unused-vars" : [
55+ "error" ,
56+ {
57+ argsIgnorePattern : "^_" ,
58+ varsIgnorePattern : "^_" ,
59+ ignoreRestSiblings : true ,
60+ } ,
61+ ] ,
62+ "@typescript-eslint/no-explicit-any" : "warn" ,
63+
64+ // Code quality rules
65+ "array-callback-return" : "error" ,
3866 eqeqeq : "error" ,
3967 "no-alert" : "error" ,
4068 "no-return-assign" : "error" ,
69+ "no-extra-boolean-cast" : "error" ,
70+ "no-unsafe-optional-chaining" : "error" ,
71+ "no-empty-pattern" : "error" ,
72+ "no-unused-vars" : "off" , // Let TypeScript handle this
73+
74+ // React Hook Form best practices
4175 "no-restricted-syntax" : [
4276 "error" ,
4377 {
@@ -70,6 +104,8 @@ const eslintConfig = [
70104 'Do not use "condition ? true : false". Simplify "someVariable === 42 ? true : false " to "someVariable === 42"' ,
71105 } ,
72106 ] ,
107+
108+ // Import restrictions
73109 "no-restricted-imports" : [
74110 "error" ,
75111 {
@@ -94,20 +130,6 @@ const eslintConfig = [
94130 ] ,
95131 } ,
96132 } ,
97- {
98- ignores : [
99- "node_modules/**" ,
100- ".next/**" ,
101- "out/**" ,
102- "build/**" ,
103- "dist/**" ,
104- "playwright-report/**" ,
105- "test-results/**" ,
106- "*.config.js" ,
107- "*.config.mjs" ,
108- "next-env.d.ts" ,
109- ] ,
110- } ,
111- ] ;
133+ ] ) ;
112134
113135export default eslintConfig ;
0 commit comments