1
+ import { defineConfig } from "eslint/config" ;
2
+ import { fixupConfigRules , fixupPluginRules } from "@eslint/compat" ;
3
+ import prettier from "eslint-plugin-prettier" ;
4
+ import _import from "eslint-plugin-import" ;
5
+ import globals from "globals" ;
6
+ import tsParser from "@typescript-eslint/parser" ;
7
+ import path from "node:path" ;
8
+ import { fileURLToPath } from "node:url" ;
9
+ import js from "@eslint/js" ;
10
+ import { FlatCompat } from "@eslint/eslintrc" ;
11
+
12
+ const __filename = fileURLToPath ( import . meta. url ) ;
13
+ const __dirname = path . dirname ( __filename ) ;
14
+ const compat = new FlatCompat ( {
15
+ baseDirectory : __dirname ,
16
+ recommendedConfig : js . configs . recommended ,
17
+ allConfig : js . configs . all
18
+ } ) ;
19
+
20
+ export default defineConfig ( [ {
21
+ extends : fixupConfigRules ( compat . extends (
22
+ "plugin:react/recommended" ,
23
+ "plugin:react-hooks/recommended" ,
24
+ "plugin:@typescript-eslint/recommended" ,
25
+ "plugin:prettier/recommended" ,
26
+ ) ) ,
27
+
28
+ plugins : {
29
+ prettier : fixupPluginRules ( prettier ) ,
30
+ import : fixupPluginRules ( _import ) ,
31
+ } ,
32
+
33
+ languageOptions : {
34
+ globals : {
35
+ ...globals . browser ,
36
+ ...globals . node ,
37
+ ...globals . jest ,
38
+ React : "writable" ,
39
+ } ,
40
+
41
+ parser : tsParser ,
42
+ ecmaVersion : 5 ,
43
+ sourceType : "commonjs" ,
44
+
45
+ parserOptions : {
46
+ jsx : true ,
47
+ useJSXTextNode : true ,
48
+ } ,
49
+ } ,
50
+
51
+ settings : {
52
+ react : {
53
+ version : "detect" ,
54
+ } ,
55
+ } ,
56
+
57
+ rules : {
58
+ "react-hooks/rules-of-hooks" : "error" ,
59
+ "react-hooks/exhaustive-deps" : "error" ,
60
+ "react/react-in-jsx-scope" : "off" ,
61
+ "@typescript-eslint/explicit-function-return-type" : "off" ,
62
+ "@typescript-eslint/explicit-module-boundary-types" : "off" ,
63
+ "@typescript-eslint/ban-ts-comment" : "off" ,
64
+ "react/prop-types" : "off" ,
65
+
66
+ "import/order" : [ "error" , {
67
+ groups : [ "builtin" , "external" , "internal" ] ,
68
+
69
+ pathGroups : [ {
70
+ pattern : "react" ,
71
+ group : "external" ,
72
+ position : "before" ,
73
+ } ] ,
74
+
75
+ pathGroupsExcludedImportTypes : [ "react" ] ,
76
+ "newlines-between" : "always" ,
77
+
78
+ alphabetize : {
79
+ order : "asc" ,
80
+ caseInsensitive : true ,
81
+ } ,
82
+ } ] ,
83
+
84
+ "prettier/prettier" : "error" ,
85
+ } ,
86
+ } ] ) ;
0 commit comments