1+ import js from "@eslint/js" ;
12import { defineConfig , globalIgnores } from "eslint/config" ;
2- import { fixupConfigRules } from "@eslint/compat" ;
3+ import tseslint from "typescript-eslint" ;
4+ import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended" ;
5+ import react from "eslint-plugin-react" ;
6+ import reactHooks from "eslint-plugin-react-hooks" ;
37import globals from "globals" ;
4- import tsParser from "@typescript-eslint/parser" ;
5- import path from "node:path" ;
6- import { fileURLToPath } from "node:url" ;
7- import js from "@eslint/js" ;
8- import { FlatCompat } from "@eslint/eslintrc" ;
9-
10- const __filename = fileURLToPath ( import . meta. url ) ;
11- const __dirname = path . dirname ( __filename ) ;
12- const compat = new FlatCompat ( {
13- baseDirectory : __dirname ,
14- recommendedConfig : js . configs . recommended ,
15- allConfig : js . configs . all
16- } ) ;
17-
18- export default defineConfig ( [ globalIgnores ( [ "**/node_modules" , "**/dist" ] ) , {
19- extends : fixupConfigRules ( compat . extends (
20- "eslint:recommended" ,
21- "plugin:react/recommended" ,
22- "plugin:react/jsx-runtime" ,
23- "plugin:@typescript-eslint/recommended" ,
24- "plugin:react-hooks/recommended" ,
25- "prettier" ,
26- ) ) ,
278
9+ export default defineConfig ( [
10+ globalIgnores ( [ "**/node_modules" , "**/dist" ] ) ,
11+ {
12+ name : "eslint-js-recommended-rules" ,
13+ plugins : {
14+ js,
15+ } ,
16+ extends : [ "js/recommended" ] ,
17+ } ,
18+ tseslint . configs . recommended . map ( ( conf ) => ( {
19+ ...conf ,
20+ files : [ "**/*.ts" , "**/*.tsx" ] ,
21+ } ) ) ,
22+ eslintPluginPrettierRecommended ,
23+ {
24+ name : "react" ,
25+ ...react . configs . flat . recommended ,
26+ } ,
27+ reactHooks . configs [ "recommended-latest" ] ,
28+ {
2829 languageOptions : {
29- globals : {
30- ...globals . browser ,
31- } ,
32-
33- parser : tsParser ,
30+ globals : {
31+ ...globals . browser ,
32+ ...globals . node ,
33+ } ,
34+ } ,
35+ rules : {
36+ "react/react-in-jsx-scope" : "off" ,
3437 } ,
35-
3638 settings : {
37- react : {
38- version : "detect" ,
39- } ,
39+ react : {
40+ version : "detect" ,
41+ } ,
4042 } ,
41- } ] ) ;
43+ } ,
44+ ] ) ;
0 commit comments