1+ import { defineConfig } from "eslint/config" ;
2+ import typescriptEslint from "@typescript-eslint/eslint-plugin" ;
3+ import globals from "globals" ;
4+ import tsParser from "@typescript-eslint/parser" ;
5+ import path from "node:path" ;
6+ import { fileURLToPath } from "node:url" ;
7+ import js from "@eslint/js" ;
8+ import { FlatCompat } from "@eslint/eslintrc" ;
9+
10+ const __filename = fileURLToPath ( import . meta. url ) ;
11+ const __dirname = path . dirname ( __filename ) ;
12+ const compat = new FlatCompat ( {
13+ baseDirectory : __dirname ,
14+ recommendedConfig : js . configs . recommended ,
15+ allConfig : js . configs . all
16+ } ) ;
17+
18+ export default defineConfig ( [ {
19+ extends : compat . extends ( "eslint:recommended" , "plugin:@typescript-eslint/recommended" , "prettier" ) ,
20+
21+ plugins : {
22+ "@typescript-eslint" : typescriptEslint ,
23+ } ,
24+
25+ languageOptions : {
26+ globals : {
27+ ...globals . browser ,
28+ ...globals . node ,
29+ ...globals . mocha ,
30+ } ,
31+
32+ parser : tsParser ,
33+ ecmaVersion : "latest" ,
34+ sourceType : "module" ,
35+ } ,
36+
37+ rules : {
38+ "no-unused-vars" : "off" ,
39+ "@typescript-eslint/no-unused-vars" : "warn" ,
40+ "@typescript-eslint/no-explicit-any" : "off" ,
41+ } ,
42+ } , {
43+ files : [ "**/.eslintrc.{js,cjs}" ] ,
44+
45+ languageOptions : {
46+ globals : {
47+ ...globals . node ,
48+ } ,
49+
50+ ecmaVersion : 5 ,
51+ sourceType : "commonjs" ,
52+ } ,
53+ } , {
54+ files : [ "./test/**" ] ,
55+
56+ languageOptions : {
57+ globals : {
58+ ...globals . node ,
59+ } ,
60+ } ,
61+
62+ rules : {
63+ "@typescript-eslint/no-var-requires" : "off" ,
64+ "@typescript-eslint/no-explicit-any" : "off" ,
65+ } ,
66+ } ] ) ;
0 commit comments