58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
import tsParser from '@typescript-eslint/parser';
|
|
import react from 'eslint-plugin-react';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
import globals from 'globals';
|
|
|
|
export default [
|
|
{
|
|
ignores: ['dist'],
|
|
},
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
ecmaVersion: 2020,
|
|
globals: {
|
|
...globals.browser,
|
|
React: 'readonly',
|
|
},
|
|
parser: tsParser,
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
'react': react,
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
},
|
|
rules: {
|
|
...js.configs.recommended.rules,
|
|
...tseslint.configs.recommended.rules,
|
|
...reactHooks.configs.recommended.rules,
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
|
|
// React configuration
|
|
'react/react-in-jsx-scope': 'off', // Not needed with React 17+
|
|
'react/jsx-uses-react': 'off', // Not needed with React 17+
|
|
|
|
// TypeScript specific
|
|
'@typescript-eslint/no-explicit-any': 'warn', // Allow any but warn
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
|
|
// General ESLint rules
|
|
'no-undef': 'off', // TypeScript handles this
|
|
'no-console': 'warn',
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
},
|
|
];
|