1+ import { defineConfig , globalIgnores } from "eslint/config" ;
2+ import _import from "eslint-plugin-import" ;
3+ import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin" ;
4+ import unusedImports from "eslint-plugin-unused-imports" ;
5+ import { fixupPluginRules } from "@eslint/compat" ;
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 ( [ "**/.prettierrc.js" , "bin/**/*.js" ] ) , {
21+ extends : compat . extends ( "plugin:@typescript-eslint/recommended" , "plugin:prettier/recommended" ) ,
22+
23+ plugins : {
24+ import : fixupPluginRules ( _import ) ,
25+ "@typescript-eslint" : typescriptEslintEslintPlugin ,
26+ "unused-imports" : unusedImports ,
27+ } ,
28+
29+ languageOptions : {
30+ parser : tsParser ,
31+ } ,
32+
33+ rules : {
34+ "@typescript-eslint/interface-name-prefix" : "off" ,
35+ "@typescript-eslint/explicit-function-return-type" : "off" ,
36+ "@typescript-eslint/explicit-module-boundary-types" : "off" ,
37+ "@typescript-eslint/no-explicit-any" : "off" ,
38+ "@typescript-eslint/ban-ts-comment" : "off" ,
39+ "react-hooks/exhaustive-deps" : "off" ,
40+ "unused-imports/no-unused-imports" : 1 ,
41+
42+ "import/order" : [ "error" , {
43+ groups : [ "builtin" , "external" , "internal" , "parent" , "sibling" ] ,
44+
45+ pathGroups : [ {
46+ pattern : "src/**" ,
47+ group : "internal" ,
48+ position : "before" ,
49+ } ] ,
50+
51+ pathGroupsExcludedImportTypes : [ "builtin" ] ,
52+
53+ alphabetize : {
54+ order : "asc" ,
55+ caseInsensitive : false ,
56+ } ,
57+
58+ "newlines-between" : "always-and-inside-groups" ,
59+ warnOnUnassignedImports : true ,
60+ } ] ,
61+
62+ "import/no-extraneous-dependencies" : [ "error" , {
63+ devDependencies : [
64+ "**/*.test.{ts,js}" ,
65+ "**/*.spec.{ts,js}" ,
66+ "scripts/**/*.{ts,js}" ,
67+ "bin/**/*.{ts,js}" ,
68+ "test/**/*.{ts,js}" ,
69+ ] ,
70+ } ] ,
71+ } ,
72+ } , {
73+ files : [
74+ "**/setupTests.ts" ,
75+ "**/*.test.tsx" ,
76+ "**/*.test.ts" ,
77+ "**/*.@(story|stories).*" ,
78+ ] ,
79+
80+ rules : {
81+ "import/no-extraneous-dependencies" : "off" ,
82+ } ,
83+ } ] ) ;
0 commit comments