1+ import { fixupConfigRules , fixupPluginRules } from "@eslint/compat" ;
2+ import jest from "eslint-plugin-jest" ;
3+ import typescriptEslint from "@typescript-eslint/eslint-plugin" ;
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 [ ...fixupConfigRules ( compat . extends (
21+ "plugin:import/recommended" ,
22+ "plugin:import/typescript" ,
23+ "plugin:@typescript-eslint/recommended" ,
24+ ) ) , {
25+ plugins : {
26+ jest,
27+ "@typescript-eslint" : fixupPluginRules ( typescriptEslint ) ,
28+ import : fixupPluginRules ( _import ) ,
29+ } ,
30+
31+ languageOptions : {
32+ globals : {
33+ ...globals . node ,
34+ ...globals . commonjs ,
35+ ...jest . environments . globals . globals ,
36+ } ,
37+
38+ parser : tsParser ,
39+ ecmaVersion : "latest" ,
40+ sourceType : "commonjs" ,
41+
42+ parserOptions : {
43+ project : "./tsconfig.json" ,
44+ } ,
45+ } ,
46+
47+ settings : {
48+ "import/resolver" : {
49+ typescript : true ,
50+ node : true ,
51+ } ,
52+ } ,
53+
54+ rules : {
55+ "i18n-text/no-en" : "off" ,
56+ "eslint-comments/no-use" : "off" ,
57+ "filenames/match-regex" : "off" ,
58+ "import/no-namespace" : "off" ,
59+ "no-console" : "off" ,
60+ "one-var" : "off" ,
61+
62+ "@typescript-eslint/no-unused-vars" : [ "error" , {
63+ argsIgnorePattern : "^_" ,
64+ varsIgnorePattern : "^_" ,
65+ caughtErrorsIgnorePattern : "^_" ,
66+ } ] ,
67+
68+ "no-unused-vars" : "off" ,
69+
70+ "@typescript-eslint/explicit-member-accessibility" : [ "error" , {
71+ accessibility : "no-public" ,
72+ } ] ,
73+
74+ "@typescript-eslint/no-require-imports" : "error" ,
75+ "@typescript-eslint/array-type" : "error" ,
76+ "@typescript-eslint/await-thenable" : "error" ,
77+ "@typescript-eslint/ban-ts-comment" : "error" ,
78+ camelcase : "off" ,
79+ "@typescript-eslint/consistent-type-assertions" : "error" ,
80+
81+ "@typescript-eslint/explicit-function-return-type" : [ "error" , {
82+ allowExpressions : true ,
83+ } ] ,
84+ "@typescript-eslint/no-array-constructor" : "error" ,
85+ "@typescript-eslint/no-empty-interface" : "error" ,
86+ "@typescript-eslint/no-explicit-any" : "error" ,
87+ "@typescript-eslint/no-extraneous-class" : "error" ,
88+ "@typescript-eslint/no-for-in-array" : "error" ,
89+ "@typescript-eslint/no-inferrable-types" : "error" ,
90+ "@typescript-eslint/no-misused-new" : "error" ,
91+ "@typescript-eslint/no-namespace" : "error" ,
92+ "@typescript-eslint/no-non-null-assertion" : "warn" ,
93+ "@typescript-eslint/no-unnecessary-qualifier" : "error" ,
94+ "@typescript-eslint/no-unnecessary-type-assertion" : "error" ,
95+ "@typescript-eslint/no-useless-constructor" : "error" ,
96+ "@typescript-eslint/no-var-requires" : "error" ,
97+ "@typescript-eslint/prefer-for-of" : "warn" ,
98+ "@typescript-eslint/prefer-function-type" : "warn" ,
99+ "@typescript-eslint/prefer-includes" : "error" ,
100+ "@typescript-eslint/prefer-string-starts-ends-with" : "error" ,
101+ "@typescript-eslint/promise-function-async" : "error" ,
102+ "@typescript-eslint/require-array-sort-compare" : "error" ,
103+ "@typescript-eslint/restrict-plus-operands" : "error" ,
104+ semi : "off" ,
105+ "@typescript-eslint/unbound-method" : "error" ,
106+
107+ "import/order" : [ "error" , {
108+ groups : [ "builtin" , "external" , "internal" , "parent" , "sibling" , "index" ] ,
109+ "newlines-between" : "always" ,
110+
111+ alphabetize : {
112+ order : "asc" ,
113+ caseInsensitive : true ,
114+ } ,
115+ } ] ,
116+
117+ "import/extensions" : [ "error" , "never" , {
118+ pattern : {
119+ json : "ignorePackages" ,
120+ } ,
121+ } ] ,
122+ } ,
123+ } ] ;
0 commit comments