1+ import { defineConfig , globalIgnores } from "eslint/config" ;
2+ import jest from "eslint-plugin-jest" ;
3+ import typescriptEslint from "@typescript-eslint/eslint-plugin" ;
4+ import stylistic from "@stylistic/eslint-plugin" ;
5+ import antiTrojanSource from "eslint-plugin-anti-trojan-source" ;
6+ import globals from "globals" ;
7+ import tsParser from "@typescript-eslint/parser" ;
8+ import path from "node:path" ;
9+ import { fileURLToPath } from "node:url" ;
10+ import js from "@eslint/js" ;
11+ import { FlatCompat } from "@eslint/eslintrc" ;
12+
13+ const __filename = fileURLToPath ( import . meta. url ) ;
14+ const __dirname = path . dirname ( __filename ) ;
15+ const compat = new FlatCompat ( {
16+ baseDirectory : __dirname ,
17+ recommendedConfig : js . configs . recommended ,
18+ allConfig : js . configs . all
19+ } ) ;
20+
21+ export default defineConfig ( [
22+ globalIgnores ( [ "**/dist/" , "**/lib/" , "**/node_modules/" , "**/jest.config.js" ] ) ,
23+ {
24+ extends : compat . extends ( "plugin:github/recommended" ) ,
25+
26+ plugins : {
27+ jest,
28+ "@typescript-eslint" : typescriptEslint ,
29+ "@stylistic" : stylistic ,
30+ "anti-trojan-source" : antiTrojanSource ,
31+ } ,
32+
33+ files : [ "**/*.ts" ] ,
34+
35+ languageOptions : {
36+ globals : {
37+ ...globals . node ,
38+ ...globals . jest ,
39+ } ,
40+
41+ parser : tsParser ,
42+ ecmaVersion : 9 ,
43+ sourceType : "module" ,
44+
45+ parserOptions : {
46+ project : "./tsconfig.json" ,
47+ } ,
48+ } ,
49+
50+ rules : {
51+ "@typescript-eslint/array-type" : "error" ,
52+ "@typescript-eslint/await-thenable" : "error" ,
53+ "@typescript-eslint/ban-ts-comment" : "error" ,
54+ "@typescript-eslint/consistent-type-assertions" : "error" ,
55+
56+ "@typescript-eslint/explicit-function-return-type" : [ "error" , {
57+ allowExpressions : true ,
58+ } ] ,
59+
60+ "@typescript-eslint/explicit-member-accessibility" : [ "error" , {
61+ accessibility : "no-public" ,
62+ } ] ,
63+
64+ "@stylistic/func-call-spacing" : [ "error" , "never" ] ,
65+ "@typescript-eslint/no-array-constructor" : "error" ,
66+ "@typescript-eslint/no-empty-interface" : "error" ,
67+ "@typescript-eslint/no-explicit-any" : "error" ,
68+ "@typescript-eslint/no-extraneous-class" : "error" ,
69+ "@typescript-eslint/no-for-in-array" : "error" ,
70+ "@typescript-eslint/no-inferrable-types" : "error" ,
71+ "@typescript-eslint/no-misused-new" : "error" ,
72+ "@typescript-eslint/no-namespace" : "error" ,
73+ "@typescript-eslint/no-non-null-assertion" : "warn" ,
74+ "@typescript-eslint/no-require-imports" : "error" ,
75+ "@typescript-eslint/no-unnecessary-qualifier" : "error" ,
76+ "@typescript-eslint/no-unnecessary-type-assertion" : "error" ,
77+ "@typescript-eslint/no-unused-vars" : "off" ,
78+ "@typescript-eslint/no-useless-constructor" : "error" ,
79+ "@typescript-eslint/no-var-requires" : "error" ,
80+ "@typescript-eslint/prefer-for-of" : "warn" ,
81+ "@typescript-eslint/prefer-function-type" : "warn" ,
82+ "@typescript-eslint/prefer-includes" : "error" ,
83+ "@typescript-eslint/prefer-string-starts-ends-with" : "error" ,
84+ "@typescript-eslint/promise-function-async" : "error" ,
85+ "@typescript-eslint/require-array-sort-compare" : "error" ,
86+ "@typescript-eslint/restrict-plus-operands" : "error" ,
87+ "@stylistic/semi" : [ "error" , "never" ] ,
88+ "@stylistic/type-annotation-spacing" : "error" ,
89+ "@typescript-eslint/unbound-method" : "error" ,
90+ "anti-trojan-source/no-bidi" : "error" ,
91+ camelcase : "off" ,
92+ "eslint-comments/no-use" : "off" ,
93+ "filenames/match-regex" : "off" ,
94+ "i18n-text/no-en" : "off" ,
95+ "import/no-namespace" : "off" ,
96+ "no-unused-vars" : "off" ,
97+ semi : "off" ,
98+ } ,
99+ } ,
100+ ] ) ;
0 commit comments