67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
env: {
|
|
browser: true,
|
|
es2020: true,
|
|
node: true,
|
|
},
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'plugin:react/recommended',
|
|
'plugin:react/jsx-runtime',
|
|
'plugin:react-hooks/recommended',
|
|
],
|
|
ignorePatterns: ['dist/**', '.eslintrc.cjs'],
|
|
parser: '@typescript-eslint/parser',
|
|
plugins: ['@typescript-eslint', 'react-refresh'],
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
rules: {
|
|
// React hooks rules
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
|
|
// React best practices
|
|
'react/prop-types': 'off',
|
|
'react/jsx-fragments': ['error', 'element'],
|
|
'react/jsx-no-target-blank': 'error',
|
|
'react/no-unescaped-entities': 'error',
|
|
|
|
// TypeScript rules
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
'@typescript-eslint/no-unsafe-call': 'off',
|
|
|
|
// ESLint best practices
|
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
eqeqeq: ['error', 'always'],
|
|
curly: ['error', 'all'],
|
|
|
|
// react-router specific
|
|
'react-refresh/only-export-components': [
|
|
'warn',
|
|
{ allowConstantExport: true },
|
|
],
|
|
|
|
// JSX props must be explicitly typed
|
|
'react/jsx-props-no-spreading': 'off',
|
|
},
|
|
overrides: [
|
|
{
|
|
files: ['**/*.ts*', '**/*.tsx'],
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
},
|
|
},
|
|
],
|
|
};
|