1+ const eslint = require ( '@eslint/js' ) ;
2+ const tseslint = require ( '@typescript-eslint/eslint-plugin' ) ;
3+ const tsparser = require ( '@typescript-eslint/parser' ) ;
4+ const globals = require ( 'globals' ) ;
5+ const pluginJest = require ( 'eslint-plugin-jest' ) ;
6+
7+ module . exports = [
8+ eslint . configs . recommended ,
9+ {
10+ files : [ '**/*.ts' ] ,
11+ languageOptions : {
12+ parser : tsparser ,
13+ parserOptions : {
14+ ecmaVersion : 2018 ,
15+ sourceType : 'module' ,
16+ project : [ './tsconfig.json' , './packages/*/tsconfig.json' ]
17+ } ,
18+ globals : {
19+ ...globals . node ,
20+ ...globals . es6
21+ }
22+ } ,
23+ plugins : {
24+ '@typescript-eslint' : tseslint ,
25+ } ,
26+ rules : {
27+ // Disabled rules from original config
28+ 'eslint-comments/no-use' : 'off' ,
29+ 'import/no-namespace' : 'off' ,
30+ 'no-constant-condition' : 'off' ,
31+ 'no-unused-vars' : 'off' ,
32+ 'i18n-text/no-en' : 'off' ,
33+ 'camelcase' : 'off' ,
34+ 'semi' : 'off' ,
35+ 'no-shadow' : 'off' ,
36+
37+ // TypeScript ESLint rules
38+ '@typescript-eslint/no-unused-vars' : 'error' ,
39+ '@typescript-eslint/explicit-member-accessibility' : [ 'error' , { accessibility : 'no-public' } ] ,
40+ '@typescript-eslint/no-require-imports' : 'error' ,
41+ '@typescript-eslint/array-type' : 'error' ,
42+ '@typescript-eslint/await-thenable' : 'error' ,
43+ '@typescript-eslint/explicit-function-return-type' : [ 'error' , { allowExpressions : true } ] ,
44+ '@typescript-eslint/no-array-constructor' : 'error' ,
45+ '@typescript-eslint/no-empty-interface' : 'error' ,
46+ '@typescript-eslint/no-explicit-any' : 'off' , // Fixed: removed duplicate and kept only this one
47+ '@typescript-eslint/no-extraneous-class' : 'error' ,
48+ '@typescript-eslint/no-floating-promises' : 'error' ,
49+ '@typescript-eslint/no-for-in-array' : 'error' ,
50+ '@typescript-eslint/no-inferrable-types' : 'error' ,
51+ '@typescript-eslint/no-misused-new' : 'error' ,
52+ '@typescript-eslint/no-namespace' : 'error' ,
53+ '@typescript-eslint/no-non-null-assertion' : 'warn' ,
54+ '@typescript-eslint/no-unnecessary-qualifier' : 'error' ,
55+ '@typescript-eslint/no-unnecessary-type-assertion' : 'error' ,
56+ '@typescript-eslint/no-useless-constructor' : 'error' ,
57+ '@typescript-eslint/no-var-requires' : 'error' ,
58+ '@typescript-eslint/prefer-for-of' : 'warn' ,
59+ '@typescript-eslint/prefer-function-type' : 'warn' ,
60+ '@typescript-eslint/prefer-includes' : 'error' ,
61+ '@typescript-eslint/prefer-string-starts-ends-with' : 'error' ,
62+ '@typescript-eslint/promise-function-async' : 'error' ,
63+ '@typescript-eslint/require-array-sort-compare' : 'error' ,
64+ '@typescript-eslint/restrict-plus-operands' : 'error' ,
65+ '@typescript-eslint/unbound-method' : 'error' ,
66+ '@typescript-eslint/no-shadow' : [ 'error' ]
67+ }
68+ } ,
69+ {
70+ // Test files configuration - Fixed file pattern to match .ts files
71+ files : [ '**/*test*.ts' , '**/*spec*.ts' , '**/tests/**/*.ts' ] ,
72+ languageOptions : {
73+ parser : tsparser ,
74+ parserOptions : {
75+ ecmaVersion : 2018 ,
76+ sourceType : 'module' ,
77+ project : [ './tsconfig.json' , './packages/*/tsconfig.json' ]
78+ } ,
79+ globals : {
80+ ...globals . node ,
81+ ...globals . es6 ,
82+ // Fixed Jest globals
83+ describe : 'readonly' ,
84+ it : 'readonly' ,
85+ test : 'readonly' ,
86+ expect : 'readonly' ,
87+ beforeEach : 'readonly' ,
88+ afterEach : 'readonly' ,
89+ beforeAll : 'readonly' ,
90+ afterAll : 'readonly' ,
91+ jest : 'readonly'
92+ }
93+ } ,
94+ plugins : {
95+ '@typescript-eslint' : tseslint ,
96+ jest : pluginJest
97+ } ,
98+ rules : {
99+ // Disable no-undef for test files since Jest globals are handled above
100+ 'no-undef' : 'off' ,
101+ // Relax some rules for test files
102+ '@typescript-eslint/no-explicit-any' : 'off' ,
103+ '@typescript-eslint/no-non-null-assertion' : 'off' ,
104+ '@typescript-eslint/explicit-function-return-type' : 'off'
105+ }
106+ } ,
107+ {
108+ files : [ '**/jest.config.js' , '**/jest.setup.js' ] ,
109+ languageOptions : {
110+ globals : {
111+ ...globals . node ,
112+ jest : 'readonly' ,
113+ module : 'writable'
114+ }
115+ } ,
116+ rules : {
117+ '@typescript-eslint/no-require-imports' : 'off' ,
118+ '@typescript-eslint/no-var-requires' : 'off' ,
119+ 'import/no-commonjs' : 'off'
120+ }
121+ }
122+ ] ;
0 commit comments