|
1 | | -import js from '@eslint/js' |
| 1 | +import eslintReact from "@eslint-react/eslint-plugin"; |
| 2 | +import eslintJs from "@eslint/js"; |
| 3 | +import { defineConfig } from "eslint/config"; |
| 4 | +import tseslint from "typescript-eslint"; |
| 5 | +import eslintConfigPrettier from "eslint-config-prettier"; |
2 | 6 | import globals from 'globals' |
3 | | -import reactPlugin from 'eslint-plugin-react' |
4 | | -import reactHooksPlugin from 'eslint-plugin-react-hooks' |
5 | | -import tseslint from 'typescript-eslint' |
6 | | -import eslintConfigPrettier from 'eslint-config-prettier' |
7 | 7 |
|
8 | | -export default tseslint.config( |
| 8 | +export default defineConfig( |
9 | 9 | { |
10 | | - ignores: ['dist/**', 'vite-env.d.ts', 'vite.config.ts'] |
11 | | - }, |
12 | | - js.configs.recommended, |
13 | | - ...tseslint.configs.recommended, |
14 | | - { |
15 | | - files: ['**/*.{ts,tsx}'], |
| 10 | + files: ["**/*.ts", "**/*.tsx"], |
| 11 | + ignores: ['dist/**', 'vite-env.d.ts', 'vite.config.ts'], |
| 12 | + |
| 13 | + // Extend recommended rule sets from: |
| 14 | + // 1. ESLint JS's recommended rules |
| 15 | + // 2. TypeScript ESLint recommended rules |
| 16 | + // 3. ESLint React's recommended-typescript rules |
| 17 | + // 4. Prettier (Must be last to disable conflicting rules) |
| 18 | + extends: [ |
| 19 | + eslintJs.configs.recommended, |
| 20 | + tseslint.configs.recommended, |
| 21 | + eslintReact.configs["recommended-typescript"], |
| 22 | + eslintConfigPrettier, |
| 23 | + ], |
| 24 | + |
| 25 | + // Configure language/parsing options |
16 | 26 | languageOptions: { |
17 | | - ecmaVersion: 'latest', |
| 27 | + ecmaVersion: 'latest', // Allow modern JS syntax |
18 | 28 | globals: { |
19 | | - ...globals.browser |
| 29 | + ...globals.browser, // Allow browser globals like `window` |
20 | 30 | }, |
| 31 | + parser: tseslint.parser, // Your existing parser |
21 | 32 | parserOptions: { |
22 | 33 | projectService: true, |
23 | | - tsconfigRootDir: import.meta.dirname |
24 | | - } |
25 | | - }, |
26 | | - plugins: { |
27 | | - react: reactPlugin, |
28 | | - 'react-hooks': reactHooksPlugin |
29 | | - }, |
30 | | - settings: { |
31 | | - react: { |
32 | | - version: 'detect' |
33 | | - } |
| 34 | + tsconfigRootDir: import.meta.dirname, |
| 35 | + }, |
34 | 36 | }, |
| 37 | + |
| 38 | + // TODO: See if some of these could be fixed |
35 | 39 | rules: { |
36 | | - ...reactPlugin.configs.recommended.rules, |
37 | | - ...reactPlugin.configs['jsx-runtime'].rules, |
38 | | - ...reactHooksPlugin.configs.recommended.rules |
39 | | - } |
| 40 | + "@eslint-react/dom-no-dangerously-set-innerhtml": "off", |
| 41 | + "@eslint-react/exhaustive-deps": "off", |
| 42 | + "@eslint-react/set-state-in-effect": "off", |
| 43 | + }, |
40 | 44 | }, |
41 | | - eslintConfigPrettier |
42 | | -) |
| 45 | +); |
0 commit comments