1+ import { defineConfig , globalIgnores } from "eslint/config" ;
2+ import prettier from "eslint-plugin-prettier" ;
3+ import _import from "eslint-plugin-import" ;
4+ import { fixupPluginRules } from "@eslint/compat" ;
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 ( [ globalIgnores ( [ "**/node_modules" , "**/lib" ] ) , {
21+ extends : compat . extends ( "plugin:@typescript-eslint/recommended" , "plugin:prettier/recommended" ) ,
22+
23+ plugins : {
24+ prettier,
25+ import : fixupPluginRules ( _import ) ,
26+ } ,
27+
28+ languageOptions : {
29+ globals : {
30+ ...globals . browser ,
31+ ...globals . node ,
32+ ...globals . jest ,
33+ React : "writable" ,
34+ } ,
35+
36+ parser : tsParser ,
37+ ecmaVersion : 5 ,
38+ sourceType : "commonjs" ,
39+
40+ parserOptions : {
41+ jsx : true ,
42+ useJSXTextNode : true ,
43+ } ,
44+ } ,
45+
46+ settings : {
47+ react : {
48+ version : "detect" ,
49+ } ,
50+ } ,
51+
52+ rules : {
53+ "@typescript-eslint/explicit-function-return-type" : "off" ,
54+ "@typescript-eslint/explicit-module-boundary-types" : "off" ,
55+ "@typescript-eslint/ban-ts-comment" : "off" ,
56+
57+ "import/order" : [ "error" , {
58+ groups : [ "builtin" , "external" , "internal" ] ,
59+
60+ pathGroups : [ {
61+ pattern : "react" ,
62+ group : "external" ,
63+ position : "before" ,
64+ } ] ,
65+
66+ pathGroupsExcludedImportTypes : [ "react" ] ,
67+ "newlines-between" : "always" ,
68+
69+ alphabetize : {
70+ order : "asc" ,
71+ caseInsensitive : true ,
72+ } ,
73+ } ] ,
74+
75+ "prettier/prettier" : "error" ,
76+ } ,
77+ } ] ) ;
0 commit comments