1
+ import globals from 'globals' ;
2
+ import babelParser from '@babel/eslint-parser' ;
3
+ import typescriptPlugin from '@typescript-eslint/eslint-plugin' ;
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
+ import jest from 'eslint-plugin-jest' ;
10
+
11
+ const __filename = fileURLToPath ( import . meta. url ) ;
12
+ const __dirname = path . dirname ( __filename ) ;
13
+ const compat = new FlatCompat ( {
14
+ baseDirectory : __dirname ,
15
+ recommendedConfig : js . configs . recommended ,
16
+ allConfig : js . configs . all
17
+ } ) ;
18
+
19
+ export default [ {
20
+ ignores : [ '**/dist' , '**/node_modules' ] ,
21
+ } , {
22
+ files : [ 'spec/**' ] ,
23
+ ...jest . configs [ 'flat/recommended' ] ,
24
+ rules : {
25
+ ...jest . configs [ 'flat/recommended' ] . rules ,
26
+ 'jest/prefer-expect-assertions' : 'off' ,
27
+ } ,
28
+ } , ...compat . extends ( 'eslint:recommended' ) , {
29
+ languageOptions : {
30
+ globals : {
31
+ ...globals . node
32
+ } ,
33
+ parser : babelParser ,
34
+ } ,
35
+ rules : {
36
+ 'no-console' : 'off' ,
37
+ 'no-invalid-this' : 'warn' ,
38
+ 'no-undef' : 'error' ,
39
+ 'no-unused-vars' : 'warn' ,
40
+ 'no-var' : [ 'error' ] ,
41
+ quotes : [ 'error' , 'single' ] ,
42
+ strict : [ 2 , 'never' ] ,
43
+ } ,
44
+ } , ...compat . extends (
45
+ 'eslint:recommended' ,
46
+ 'plugin:@typescript-eslint/eslint-recommended' ,
47
+ 'plugin:@typescript-eslint/recommended' ,
48
+ ) . map ( config => ( {
49
+ ...config ,
50
+ files : [ 'src/**/*.d.ts' ] ,
51
+ } ) ) , {
52
+ files : [ 'src/**/*.d.ts' ] ,
53
+ plugins : {
54
+ '@typescript-eslint' : typescriptPlugin ,
55
+ } ,
56
+ rules : {
57
+ '@typescript-eslint/no-explicit-any' : 'off' ,
58
+ } ,
59
+ languageOptions : {
60
+ parser : tsParser ,
61
+ } ,
62
+ } ] ;
0 commit comments