88 lines
2.2 KiB
JavaScript
88 lines
2.2 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
env: {
|
|
browser: true,
|
|
es2020: true,
|
|
node: true,
|
|
},
|
|
extends: [
|
|
'eslint:recommended',
|
|
'@typescript-eslint/recommended',
|
|
'plugin:react-hooks/recommended',
|
|
'plugin:react/recommended',
|
|
'plugin:react/jsx-runtime',
|
|
],
|
|
ignorePatterns: ['dist', '.eslintrc.cjs', 'vite.config.ts'],
|
|
parser: '@typescript-eslint/parser',
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
plugins: [
|
|
'react-refresh',
|
|
'@typescript-eslint',
|
|
'react',
|
|
'react-hooks',
|
|
],
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
rules: {
|
|
'react-refresh/only-export-components': [
|
|
'warn',
|
|
{ allowConstantExport: true },
|
|
],
|
|
|
|
// TypeScript specific rules
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
|
|
// React specific rules
|
|
'react/prop-types': 'off', // We use TypeScript for prop validation
|
|
'react/react-in-jsx-scope': 'off', // Not needed with new JSX transform
|
|
'react/jsx-uses-react': 'off', // Not needed with new JSX transform
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
|
|
// General rules
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
'no-debugger': 'error',
|
|
'prefer-const': 'error',
|
|
'no-var': 'error',
|
|
'no-unused-expressions': 'error',
|
|
'no-duplicate-imports': 'error',
|
|
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
|
|
'comma-dangle': ['error', 'always-multiline'],
|
|
'semi': ['error', 'always'],
|
|
'quotes': ['error', 'single', { avoidEscape: true }],
|
|
|
|
// Accessibility
|
|
'jsx-a11y/alt-text': 'off', // We'll handle this manually for now
|
|
},
|
|
overrides: [
|
|
{
|
|
files: ['**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'],
|
|
env: {
|
|
jest: true,
|
|
},
|
|
},
|
|
{
|
|
files: ['vite.config.ts'],
|
|
rules: {
|
|
'no-console': 'off',
|
|
},
|
|
},
|
|
],
|
|
};
|