1
- const js = require ( '@eslint/js' ) ;
2
- const tseslint = require ( 'typescript-eslint' ) ;
3
- const eslintConfigPrettier = require ( 'eslint-config-prettier' ) ;
4
- const tsParser = require ( '@typescript-eslint/parser' ) ;
1
+ import js from '@eslint/js' ;
2
+ import tseslint from 'typescript-eslint' ;
3
+ import eslintConfigPrettier from 'eslint-config-prettier' ;
4
+ import tsParser from '@typescript-eslint/parser' ;
5
5
// When it works again do `npm install --save-dev eslint-plugin-import`
6
- // const imprt = require( 'eslint-plugin-import') ;
6
+ // import imprt from 'eslint-plugin-import';
7
7
// https://github.com/eslint/eslint/issues/18087
8
8
// https://github.com/import-js/eslint-plugin-import/pull/2829
9
- const globals = require ( 'globals' ) ;
10
- const jest = require ( 'eslint-plugin-jest' ) ;
9
+ import globals from 'globals' ;
10
+ import jest from 'eslint-plugin-jest' ;
11
11
12
12
const off = 'off' ;
13
13
const warn = 'warn' ;
@@ -32,8 +32,33 @@ const any_rules = (level) => {
32
32
'@typescript-eslint/no-explicit-any' : level ,
33
33
} ;
34
34
} ;
35
-
36
- module . exports = [
35
+ /** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray } */
36
+ export default [
37
+ {
38
+ ignores : [
39
+ 'lib/' ,
40
+ 'build/' ,
41
+ 'build-*/' ,
42
+ 'dist/' ,
43
+ '.vscode/' ,
44
+ 'node_modules/' ,
45
+ 'coverage/' ,
46
+ 'report/' ,
47
+ '!*.js' ,
48
+ '!*.mjs' ,
49
+ '!*.cjs' ,
50
+ '!*.ts' ,
51
+ '!.vscode/*.json' ,
52
+ 'package-lock.json' ,
53
+ '**/node_modules' ,
54
+ '**/dist' ,
55
+ '**/build' ,
56
+ '**/__snapshots__' ,
57
+ '**/mocks' ,
58
+ '**/coverage' ,
59
+ '**/report' ,
60
+ ] ,
61
+ } ,
37
62
js . configs . recommended ,
38
63
tseslint . configs . eslintRecommended ,
39
64
...tseslint . configs . recommended ,
@@ -45,26 +70,15 @@ module.exports = [
45
70
parserOptions : {
46
71
ecmaVersion : 2022 ,
47
72
sourceType : 'module' ,
48
- tsconfigRootDir : __dirname ,
73
+ tsconfigRootDir : import . meta . dirname ,
49
74
project : [
50
75
'./tsconfig.eslint.json' ,
51
76
'./tsconfig.json' ,
52
- '/tsconfig.prod.json' ,
77
+ '. /tsconfig.prod.json' ,
53
78
] ,
54
79
} ,
55
80
} ,
56
81
} ,
57
- {
58
- ignores : [
59
- '**/node_modules' ,
60
- '**/dist' ,
61
- '**/build' ,
62
- '**/__snapshots__' ,
63
- '**/mocks' ,
64
- '**/coverage' ,
65
- '**/report' ,
66
- ] ,
67
- } ,
68
82
// Disables all styling from eslint
69
83
eslintConfigPrettier ,
70
84
{
@@ -119,14 +133,24 @@ module.exports = [
119
133
} ,
120
134
} ,
121
135
{
122
- files : [ '.*.js' , '.*.cjs' , '*.config.cjs' , '*.config.js' , '*.config.ts' ] ,
136
+ name : 'linting for configuration files' ,
137
+ files : [
138
+ '.*.js' ,
139
+ '.*.mjs' ,
140
+ '.*.cjs' ,
141
+ '*.config.mjs' ,
142
+ '*.config.cjs' ,
143
+ '*.config.js' ,
144
+ '*.config.ts' ,
145
+ ] ,
123
146
rules : {
124
147
'no-restricted-imports' : off ,
125
148
// Consider if this is too leanient for tests
126
149
...any_rules ( 'off' ) ,
127
150
} ,
128
151
} ,
129
152
{
153
+ name : 'Rules for tests with jest' ,
130
154
files : [
131
155
'**/*.test.js' ,
132
156
'**/*.spec.js' ,
0 commit comments