1- import js from '@eslint/js' ;
2- import typescript from '@typescript-eslint/eslint-plugin' ;
3- import typescriptParser from '@typescript-eslint/parser' ;
4- import prettier from 'eslint-config-prettier' ;
5- import importPlugin from 'eslint-plugin-import' ;
6- import unusedImports from 'eslint-plugin-unused-imports' ;
1+ import eslint from '@eslint/js' ;
2+ import { defineConfig } from 'eslint/config' ;
3+ import tseslint from 'typescript-eslint' ;
4+ import globals from 'globals' ;
75
8- export default [
6+ export default defineConfig (
7+ eslint . configs . recommended ,
8+ tseslint . configs . recommended ,
99 {
10- ignores : [ 'dist/**' , 'node_modules/**' , '*.js' , '*.cjs' , '*.mjs' ]
11- } ,
12- {
13- files : [ '**/*.test.ts' , '**/*.spec.ts' , '**/*.test-helpers.ts' ] ,
1410 languageOptions : {
1511 globals : {
16- describe : 'readonly' ,
17- test : 'readonly' ,
18- it : 'readonly' ,
19- expect : 'readonly' ,
20- beforeEach : 'readonly' ,
21- afterEach : 'readonly' ,
22- jest : 'readonly' ,
23- fetch : 'readonly' ,
24- global : 'readonly'
25- } ,
12+ ...globals . node ,
13+ }
2614 } ,
2715 rules : {
28- 'no-undef' : 'off' ,
29- '@typescript-eslint/no-unused-vars' : 'off' ,
30- 'unused-imports/no-unused-imports' : 'off' ,
31- 'import/order' : 'off' ,
32- } ,
16+ "@typescript-eslint/no-explicit-any" : "warn" ,
17+ }
3318 } ,
34- js . configs . recommended ,
3519 {
36- files : [ 'src/**/*.ts' , 'src/**/*.tsx' ] ,
37- languageOptions : {
38- parser : typescriptParser ,
39- parserOptions : {
40- ecmaVersion : 'latest' ,
41- sourceType : 'module' ,
42- project : './tsconfig.json'
43- } ,
44- globals : {
45- fetch : 'readonly' ,
46- process : 'readonly' ,
47- global : 'readonly' ,
48- globalThis : 'readonly' ,
49- URL : 'readonly' ,
50- Request : 'readonly' ,
51- RequestInit : 'readonly' ,
52- Response : 'readonly' ,
53- Buffer : 'readonly' ,
54- console : 'readonly' ,
55- require : 'readonly' ,
56- __dirname : 'readonly' ,
57- __filename : 'readonly' ,
58- } ,
59- } ,
60- plugins : {
61- '@typescript-eslint' : typescript ,
62- 'import' : importPlugin ,
63- 'unused-imports' : unusedImports
64- } ,
20+ files : [ "test/**/*.ts" ] ,
6521 rules : {
66- ...typescript . configs . recommended . rules ,
67- '@typescript-eslint/no-unused-vars' : 'off' ,
68- 'unused-imports/no-unused-imports' : 'error' ,
69- 'unused-imports/no-unused-vars' : [
70- 'warn' ,
71- {
72- vars : 'all' ,
73- varsIgnorePattern : '^_' ,
74- args : 'after-used' ,
75- argsIgnorePattern : '^_'
76- }
77- ] ,
78- 'import/order' : [
79- 'error' ,
80- {
81- groups : [ 'builtin' , 'external' , 'internal' , 'parent' , 'sibling' , 'index' ] ,
82- 'newlines-between' : 'never' ,
83- alphabetize : {
84- order : 'asc'
85- }
86- }
87- ] ,
88- 'no-console' : 'warn' ,
89- '@typescript-eslint/explicit-function-return-type' : 'off' ,
90- '@typescript-eslint/no-explicit-any' : 'warn' ,
91- '@typescript-eslint/no-non-null-assertion' : 'warn' ,
92- '@typescript-eslint/no-require-imports' : 'off' ,
93- 'no-undef' : 'off' // TypeScript handles this
22+ "@typescript-eslint/no-unused-vars" : "off" ,
9423 }
95- } ,
96- prettier
97- ] ;
24+ }
25+ ) ;
0 commit comments