|
1 | | -import globals from "globals"; |
2 | | -import pluginJs from "@eslint/js"; |
3 | | -import tseslint from "typescript-eslint"; |
4 | | -import pluginReact from "eslint-plugin-react"; |
| 1 | +import js from '@eslint/js' |
| 2 | +import globals from 'globals' |
| 3 | +import tseslint from 'typescript-eslint' |
| 4 | +import pluginReact from 'eslint-plugin-react' |
| 5 | +import reactHooks from 'eslint-plugin-react-hooks' |
| 6 | +import reactRefresh from 'eslint-plugin-react-refresh' |
5 | 7 |
|
6 | | - |
7 | | -/** @type {import('eslint').Linter.Config[]} */ |
8 | | -export default [ |
9 | | - {files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]}, |
10 | | - {languageOptions: { globals: globals.browser }}, |
11 | | - pluginJs.configs.recommended, |
12 | | - ...tseslint.configs.recommended, |
13 | | - pluginReact.configs.flat.recommended, |
14 | | - { |
15 | | - rules: { |
16 | | - "react/react-in-jsx-scope": "off", |
17 | | - "react/display-name": "off", |
18 | | - "@typescript-eslint/no-explicit-any": "off", |
| 8 | +export default tseslint.config( |
| 9 | + { ignores: ['dist'] }, |
| 10 | + { |
| 11 | + extends: [js.configs.recommended, ...tseslint.configs.recommended], |
| 12 | + files: ['**/*.{ts,tsx}'], |
| 13 | + languageOptions: { |
| 14 | + ecmaVersion: 2024, |
| 15 | + globals: globals.browser, |
| 16 | + }, |
| 17 | + plugins: { |
| 18 | + react: pluginReact, |
| 19 | + 'react-hooks': reactHooks, |
| 20 | + 'react-refresh': reactRefresh, |
| 21 | + }, |
| 22 | + rules: { |
| 23 | + ...pluginReact.configs.flat.recommended.rules, |
| 24 | + ...reactHooks.configs.recommended.rules, |
| 25 | + 'react/react-in-jsx-scope': 'off', |
| 26 | + 'react/display-name': 'off', |
| 27 | + '@typescript-eslint/no-explicit-any': 'off', |
| 28 | + 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], |
| 29 | + }, |
19 | 30 | } |
20 | | - } |
21 | | -]; |
| 31 | +) |
0 commit comments