66 lines
1.7 KiB
JavaScript
66 lines
1.7 KiB
JavaScript
import globals from 'globals';
|
|
import tseslint from 'typescript-eslint';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
import prettier from 'eslint-plugin-prettier';
|
|
import prettierConfig from 'eslint-config-prettier';
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: ['dist/', 'node_modules/'],
|
|
},
|
|
|
|
// Configuration for your React application source code
|
|
{
|
|
files: ['src/**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
// This is the most critical fix: point to the config that INCLUDES the src files.
|
|
project: './tsconfig.app.json',
|
|
ecmaFeatures: { jsx: true },
|
|
},
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint.plugin,
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
prettier: prettier,
|
|
},
|
|
rules: {
|
|
...tseslint.configs.recommended.rules,
|
|
...reactHooks.configs.recommended.rules,
|
|
...prettierConfig.rules,
|
|
'prettier/prettier': 'error',
|
|
'react-refresh/only-export-components': 'warn',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
},
|
|
},
|
|
|
|
// Configuration for project-level config files
|
|
{
|
|
files: ['eslint.config.ts', 'vite.config.ts'],
|
|
languageOptions: {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
project: './tsconfig.node.json',
|
|
},
|
|
globals: {
|
|
...globals.node,
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint.plugin,
|
|
prettier: prettier,
|
|
},
|
|
rules: {
|
|
...tseslint.configs.recommended.rules,
|
|
...prettierConfig.rules,
|
|
'prettier/prettier': 'error',
|
|
},
|
|
},
|
|
);
|