1- import { dirname } from "path" ;
2- import { fileURLToPath } from "url" ;
3- import { FlatCompat } from "@eslint/eslintrc" ;
1+ import js from "@eslint/js" ;
2+ import nextPlugin from "@next/eslint-plugin-next" ;
3+ import reactPlugin from "eslint-plugin-react" ;
4+ import reactHooksPlugin from "eslint-plugin-react-hooks" ;
5+ import tailwindcssPlugin from "eslint-plugin-tailwindcss" ;
6+ import globals from "globals" ;
47
5- const __filename = fileURLToPath ( import . meta. url ) ;
6- const __dirname = dirname ( __filename ) ;
8+ export default [
9+ // Base JS rules
10+ js . configs . recommended ,
711
8- const compat = new FlatCompat ( {
9- baseDirectory : __dirname ,
10- } ) ;
12+ // Next.js recommended rules (core-web-vitals)
13+ {
14+ plugins : {
15+ "@next/next" : nextPlugin ,
16+ } ,
17+ rules : {
18+ ...nextPlugin . configs [ "core-web-vitals" ] . rules ,
19+ } ,
20+ } ,
1121
12- const eslintConfig = [ ...compat . extends ( "next/core-web-vitals" ) ] ;
22+ // React & React Hooks
23+ {
24+ plugins : {
25+ react : reactPlugin ,
26+ "react-hooks" : reactHooksPlugin ,
27+ } ,
28+ languageOptions : {
29+ globals : {
30+ ...globals . browser ,
31+ ...globals . node ,
32+ } ,
33+ parserOptions : {
34+ ecmaFeatures : {
35+ jsx : true ,
36+ } ,
37+ ecmaVersion : "latest" ,
38+ sourceType : "module" ,
39+ } ,
40+ } ,
41+ rules : {
42+ ...reactPlugin . configs . recommended . rules ,
43+ ...reactHooksPlugin . configs . recommended . rules ,
44+ "react/react-in-jsx-scope" : "off" , // Next.js handles React import
45+ } ,
46+ settings : {
47+ react : {
48+ version : "detect" ,
49+ } ,
50+ } ,
51+ } ,
1352
14- export default eslintConfig ;
53+ // TailwindCSS support
54+ {
55+ plugins : {
56+ tailwindcss : tailwindcssPlugin ,
57+ } ,
58+ rules : {
59+ ...tailwindcssPlugin . configs . recommended . rules ,
60+ } ,
61+ } ,
62+
63+ // General settings
64+ {
65+ ignores : [ "node_modules/**" , ".next/**" , "out/**" , "dist/**" ] ,
66+ } ,
67+ ] ;
0 commit comments