@@ -4,21 +4,24 @@ import tsparser from '@typescript-eslint/parser';
44// @ts -ignore - Plugin doesn't have proper ESLint 9 types yet
55import importPlugin from 'eslint-plugin-import' ;
66// @ts -ignore - Plugin doesn't have proper ESLint 9 types yet
7- import prettier from 'eslint-plugin-prettier' ;
8- // @ts -ignore - Plugin doesn't have proper ESLint 9 types yet
97import react from 'eslint-plugin-react' ;
108// @ts -ignore - Plugin doesn't have proper ESLint 9 types yet
119import reactHooks from 'eslint-plugin-react-hooks' ;
10+ import prettierConfig from 'eslint-config-prettier' ;
1211
1312export default [
13+ // Base recommended configurations
1414 js . configs . recommended ,
15+
16+ // TypeScript configuration for all TypeScript files
1517 {
16- files : [ 'src/**/*.{js,jsx, ts,tsx}' ] ,
18+ files : [ 'src/**/*.{ts,tsx}' ] ,
1719 languageOptions : {
1820 parser : tsparser ,
1921 parserOptions : {
2022 ecmaVersion : 'latest' ,
2123 sourceType : 'module' ,
24+ project : './tsconfig.json' ,
2225 ecmaFeatures : {
2326 jsx : true ,
2427 } ,
@@ -30,37 +33,100 @@ export default [
3033 } ,
3134 plugins : {
3235 '@typescript-eslint' : tseslint ,
36+ } ,
37+ rules : {
38+ // Disable core ESLint rules that are covered by TypeScript
39+ 'no-unused-vars' : 'off' ,
40+ 'no-undef' : 'off' , // TypeScript handles this
41+
42+ // Apply TypeScript ESLint recommended rules
43+ ...tseslint . configs . recommended . rules ,
44+ // Override specific rules for our project needs
45+ '@typescript-eslint/ban-ts-comment' : 'off' ,
46+ '@typescript-eslint/no-explicit-any' : 'warn' ,
47+ } ,
48+ } ,
49+
50+ // Node.js CLI configuration
51+ {
52+ files : [ 'src/cli/**/*.{ts,tsx}' ] ,
53+ languageOptions : {
54+ parser : tsparser ,
55+ parserOptions : {
56+ ecmaVersion : 'latest' ,
57+ sourceType : 'module' ,
58+ project : './tsconfig.json' ,
59+ } ,
60+ globals : {
61+ // Node.js globals for CLI scripts
62+ process : 'readonly' ,
63+ console : 'readonly' ,
64+ Buffer : 'readonly' ,
65+ __dirname : 'readonly' ,
66+ __filename : 'readonly' ,
67+ module : 'readonly' ,
68+ require : 'readonly' ,
69+ exports : 'writable' ,
70+ global : 'readonly' ,
71+ } ,
72+ } ,
73+ plugins : {
74+ '@typescript-eslint' : tseslint ,
75+ } ,
76+ rules : {
77+ 'no-unused-vars' : 'off' ,
78+ 'no-undef' : 'off' ,
79+ ...tseslint . configs . recommended . rules ,
80+ '@typescript-eslint/ban-ts-comment' : 'off' ,
81+ '@typescript-eslint/no-explicit-any' : 'warn' ,
82+ } ,
83+ } ,
84+
85+ // React configuration
86+ {
87+ files : [ 'src/**/*.{js,jsx,ts,tsx}' ] ,
88+ languageOptions : {
89+ parser : tsparser ,
90+ parserOptions : {
91+ ecmaVersion : 'latest' ,
92+ sourceType : 'module' ,
93+ project : './tsconfig.json' ,
94+ ecmaFeatures : {
95+ jsx : true ,
96+ } ,
97+ } ,
98+ globals : {
99+ React : 'writable' ,
100+ } ,
101+ } ,
102+ plugins : {
33103 react,
34104 'react-hooks' : reactHooks ,
35105 import : importPlugin ,
36- prettier,
37106 } ,
38107 settings : {
39108 react : {
40109 version : 'detect' ,
41110 } ,
111+ 'import/resolver' : {
112+ typescript : {
113+ project : './tsconfig.json' ,
114+ } ,
115+ node : {
116+ extensions : [ '.js' , '.jsx' , '.ts' , '.tsx' ] ,
117+ } ,
118+ } ,
42119 } ,
43120 rules : {
44- // Core ESLint rules
45- 'no-unused-vars' : 'off' , // Replaced by TypeScript version
46- 'no-undef' : 'off' , // TypeScript handles this
47-
48- // TypeScript ESLint rules
49- '@typescript-eslint/no-unused-vars' : 'error' ,
50- '@typescript-eslint/explicit-function-return-type' : 'off' ,
51- '@typescript-eslint/explicit-module-boundary-types' : 'off' ,
52- '@typescript-eslint/ban-ts-comment' : 'off' ,
53- '@typescript-eslint/no-explicit-any' : 'warn' ,
54-
55- // React rules
56- 'react/react-in-jsx-scope' : 'off' ,
57- 'react/prop-types' : 'off' ,
121+ // Apply React recommended rules
122+ ...react . configs . recommended . rules ,
123+ ...react . configs [ 'jsx-runtime' ] . rules ,
58124
59- // React Hooks rules
60- 'react-hooks/rules-of-hooks' : 'error' ,
61- 'react-hooks/exhaustive-deps' : 'error' ,
125+ // Apply React Hooks recommended rules
126+ ...reactHooks . configs . recommended . rules ,
62127
63- // Import rules
128+ // Apply Import recommended rules with custom order
129+ 'import/no-unresolved' : 'off' , // TypeScript handles this
64130 'import/order' : [
65131 'error' ,
66132 {
@@ -80,9 +146,9 @@ export default [
80146 } ,
81147 } ,
82148 ] ,
83-
84- // Prettier rules
85- 'prettier/prettier' : 'error' ,
86149 } ,
87150 } ,
151+
152+ // Prettier configuration (disables conflicting rules)
153+ prettierConfig ,
88154] ;
0 commit comments