1- import { dirname } from "path" ;
2- import { fileURLToPath } from "url" ;
3- import { FlatCompat } from "@eslint/eslintrc" ;
4-
5- const __filename = fileURLToPath ( import . meta. url ) ;
6- const __dirname = dirname ( __filename ) ;
7-
8- const compat = new FlatCompat ( {
9- baseDirectory : __dirname ,
10- } ) ;
1+ import nextPlugin from "@next/eslint-plugin-next" ;
2+ import reactPlugin from "eslint-plugin-react" ;
3+ import hooksPlugin from "eslint-plugin-react-hooks" ;
4+ import importPlugin from "eslint-plugin-import" ;
5+ import tseslint from "typescript-eslint" ;
116
127const eslintConfig = [
13- ...compat . extends ( "next/core-web-vitals" , "next/typescript" ) ,
14- {
15- rules : {
16- // Don't force alt for <Image/> (sourced from Sitecore media)
17- "jsx-a11y/alt-text" : "off" ,
18- } ,
8+ {
199 ignores : [
2010 "node_modules/**" ,
2111 ".next/**" ,
@@ -24,6 +14,31 @@ const eslintConfig = [
2414 "next-env.d.ts" ,
2515 ] ,
2616 } ,
17+ ...tseslint . configs . recommended ,
18+ {
19+ files : [ "**/*.{ts,tsx,js,jsx}" ] ,
20+ plugins : {
21+ "@next/next" : nextPlugin ,
22+ "react" : reactPlugin ,
23+ "react-hooks" : hooksPlugin ,
24+ "import" : importPlugin ,
25+ } ,
26+ rules : {
27+ ...nextPlugin . configs . recommended . rules ,
28+ ...nextPlugin . configs [ "core-web-vitals" ] . rules ,
29+ ...reactPlugin . configs . recommended . rules ,
30+ ...hooksPlugin . configs . recommended . rules ,
31+ // Don't force alt for <Image/> (sourced from Sitecore media)
32+ "jsx-a11y/alt-text" : "off" ,
33+ // React 17+ doesn't require importing React
34+ "react/react-in-jsx-scope" : "off" ,
35+ } ,
36+ settings : {
37+ react : {
38+ version : "detect" ,
39+ } ,
40+ } ,
41+ } ,
2742] ;
2843
2944export default eslintConfig ;
0 commit comments