51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
|
|
/**
|
||
|
|
* Shared ESLint configuration for React + TypeScript projects
|
||
|
|
* Extends base config with React-specific rules
|
||
|
|
*/
|
||
|
|
module.exports = {
|
||
|
|
extends: ['./eslint.base.cjs'],
|
||
|
|
parser: '@typescript-eslint/parser',
|
||
|
|
parserOptions: {
|
||
|
|
ecmaVersion: 'latest',
|
||
|
|
sourceType: 'module',
|
||
|
|
ecmaFeatures: {
|
||
|
|
jsx: true,
|
||
|
|
},
|
||
|
|
project: './tsconfig.json',
|
||
|
|
},
|
||
|
|
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
|
||
|
|
settings: {
|
||
|
|
react: {
|
||
|
|
version: 'detect',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
env: {
|
||
|
|
browser: true,
|
||
|
|
es2021: true,
|
||
|
|
},
|
||
|
|
globals: {
|
||
|
|
React: 'readonly',
|
||
|
|
JSX: 'readonly',
|
||
|
|
NodeJS: 'readonly',
|
||
|
|
},
|
||
|
|
ignorePatterns: ['vite.config.ts', 'vitest.config.ts', 'dist', 'node_modules'],
|
||
|
|
rules: {
|
||
|
|
// React rules
|
||
|
|
'react/react-in-jsx-scope': 'off', // Not needed in React 18+
|
||
|
|
'react/prop-types': 'off', // Using TypeScript for prop types
|
||
|
|
'react-hooks/rules-of-hooks': 'error',
|
||
|
|
'react-hooks/exhaustive-deps': 'warn',
|
||
|
|
|
||
|
|
// TypeScript rules
|
||
|
|
'@typescript-eslint/no-unused-vars': ['error', {
|
||
|
|
argsIgnorePattern: '^_',
|
||
|
|
varsIgnorePattern: '^_',
|
||
|
|
}],
|
||
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
||
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||
|
|
'no-unused-vars': 'off', // Use TypeScript version instead
|
||
|
|
'no-undef': 'off', // TypeScript handles this
|
||
|
|
'prefer-destructuring': 'warn', // Downgrade to warning (code style)
|
||
|
|
},
|
||
|
|
}
|