|
1 |
| -import js from '@eslint/js'; |
2 |
| -import tseslint from '@typescript-eslint/eslint-plugin'; |
3 |
| -import tsparser from '@typescript-eslint/parser'; |
4 |
| -// @ts-ignore - Plugin doesn't have proper ESLint 9 types yet |
5 |
| -import importPlugin from 'eslint-plugin-import'; |
6 |
| -// @ts-ignore - Plugin doesn't have proper ESLint 9 types yet |
7 |
| -import react from 'eslint-plugin-react'; |
8 |
| -// @ts-ignore - Plugin doesn't have proper ESLint 9 types yet |
9 |
| -import reactHooks from 'eslint-plugin-react-hooks'; |
10 |
| -import prettierConfig from 'eslint-config-prettier'; |
| 1 | +import js from "@eslint/js"; |
| 2 | +import tseslint from "@typescript-eslint/eslint-plugin"; |
| 3 | +import tsparser from "@typescript-eslint/parser"; |
| 4 | +import react from "eslint-plugin-react"; |
| 5 | +import reactHooks from "eslint-plugin-react-hooks"; |
| 6 | +import importPlugin from "eslint-plugin-import"; |
| 7 | +import type { Linter } from "eslint"; |
11 | 8 |
|
12 | 9 | export default [
|
13 |
| - // Base recommended configurations |
14 | 10 | js.configs.recommended,
|
15 |
| - |
16 |
| - // TypeScript configuration for all TypeScript files |
17 | 11 | {
|
18 |
| - files: ['src/**/*.{ts,tsx}'], |
| 12 | + files: ["**/*.{js,jsx,ts,tsx}"], |
19 | 13 | languageOptions: {
|
20 | 14 | parser: tsparser,
|
21 | 15 | parserOptions: {
|
22 |
| - ecmaVersion: 'latest', |
23 |
| - sourceType: 'module', |
24 |
| - project: './tsconfig.json', |
| 16 | + ecmaVersion: "latest", |
| 17 | + sourceType: "module", |
25 | 18 | ecmaFeatures: {
|
26 | 19 | jsx: true,
|
27 | 20 | },
|
28 | 21 | },
|
29 | 22 | globals: {
|
30 |
| - // Only keep React global for JSX without explicit React imports |
31 |
| - React: 'writable', |
| 23 | + // Node.js globals |
| 24 | + process: "readonly", |
| 25 | + console: "readonly", |
| 26 | + // TypeScript/React globals |
| 27 | + React: "readonly", |
| 28 | + JSX: "readonly", |
32 | 29 | },
|
33 | 30 | },
|
34 | 31 | plugins: {
|
35 |
| - '@typescript-eslint': tseslint, |
| 32 | + "@typescript-eslint": tseslint as any, |
| 33 | + react: react as any, |
| 34 | + "react-hooks": reactHooks as any, |
| 35 | + import: importPlugin as any, |
36 | 36 | },
|
37 | 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 | 38 | ...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 |
| - // Only the Node.js globals actually used in CLI files |
62 |
| - process: 'readonly', |
63 |
| - console: 'readonly', |
64 |
| - }, |
65 |
| - }, |
66 |
| - plugins: { |
67 |
| - '@typescript-eslint': tseslint, |
68 |
| - }, |
69 |
| - rules: { |
70 |
| - 'no-unused-vars': 'off', |
71 |
| - 'no-undef': 'off', |
72 |
| - ...tseslint.configs.recommended.rules, |
73 |
| - '@typescript-eslint/ban-ts-comment': 'off', |
74 |
| - '@typescript-eslint/no-explicit-any': 'warn', |
75 |
| - }, |
76 |
| - }, |
77 |
| - |
78 |
| - // React configuration |
79 |
| - { |
80 |
| - files: ['src/**/*.{js,jsx,ts,tsx}'], |
81 |
| - languageOptions: { |
82 |
| - parser: tsparser, |
83 |
| - parserOptions: { |
84 |
| - ecmaVersion: 'latest', |
85 |
| - sourceType: 'module', |
86 |
| - project: './tsconfig.json', |
87 |
| - ecmaFeatures: { |
88 |
| - jsx: true, |
89 |
| - }, |
90 |
| - }, |
91 |
| - globals: { |
92 |
| - React: 'writable', |
93 |
| - }, |
94 |
| - }, |
95 |
| - plugins: { |
96 |
| - react, |
97 |
| - 'react-hooks': reactHooks, |
98 |
| - import: importPlugin, |
| 39 | + ...react.configs.recommended.rules, |
| 40 | + ...reactHooks.configs.recommended.rules, |
| 41 | + "react/react-in-jsx-scope": "off", |
| 42 | + "react/prop-types": "off", |
| 43 | + "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], |
| 44 | + "@typescript-eslint/explicit-function-return-type": "off", |
| 45 | + "@typescript-eslint/explicit-module-boundary-types": "off", |
| 46 | + "@typescript-eslint/no-explicit-any": "warn", |
| 47 | + // Allow regex escape characters |
| 48 | + "no-useless-escape": "off", |
99 | 49 | },
|
100 | 50 | settings: {
|
101 | 51 | react: {
|
102 |
| - version: 'detect', |
| 52 | + version: "detect", |
103 | 53 | },
|
104 |
| - 'import/resolver': { |
105 |
| - typescript: { |
106 |
| - project: './tsconfig.json', |
107 |
| - }, |
108 |
| - node: { |
109 |
| - extensions: ['.js', '.jsx', '.ts', '.tsx'], |
110 |
| - }, |
| 54 | + "import/resolver": { |
| 55 | + typescript: {}, |
111 | 56 | },
|
112 | 57 | },
|
113 |
| - rules: { |
114 |
| - // Apply React recommended rules |
115 |
| - ...react.configs.recommended.rules, |
116 |
| - ...react.configs['jsx-runtime'].rules, |
117 |
| - |
118 |
| - // Apply React Hooks recommended rules |
119 |
| - ...reactHooks.configs.recommended.rules, |
120 |
| - |
121 |
| - // Apply Import recommended rules with custom order |
122 |
| - 'import/no-unresolved': 'off', // TypeScript handles this |
123 |
| - 'import/order': [ |
124 |
| - 'error', |
125 |
| - { |
126 |
| - groups: ['builtin', 'external', 'internal'], |
127 |
| - pathGroups: [ |
128 |
| - { |
129 |
| - pattern: 'react', |
130 |
| - group: 'external', |
131 |
| - position: 'before', |
132 |
| - }, |
133 |
| - ], |
134 |
| - pathGroupsExcludedImportTypes: ['react'], |
135 |
| - 'newlines-between': 'always', |
136 |
| - alphabetize: { |
137 |
| - order: 'asc', |
138 |
| - caseInsensitive: true, |
139 |
| - }, |
140 |
| - }, |
141 |
| - ], |
142 |
| - }, |
143 | 58 | },
|
144 |
| - |
145 |
| - // Prettier configuration (disables conflicting rules) |
146 |
| - prettierConfig, |
| 59 | + { |
| 60 | + ignores: ["lib/**", "node_modules/**", "coverage/**"], |
| 61 | + }, |
147 | 62 | ];
|
0 commit comments