47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
/**
|
|
* ESLint flat config for React
|
|
* Using typescript-eslint and React plugins with custom overrides
|
|
*/
|
|
import eslint from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import react from 'eslint-plugin-react';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import fileLengthPlugin from '@lilith/eslint-plugin-file-length';
|
|
|
|
export default tseslint.config(
|
|
eslint.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
// Use the flat config export — avoids context.getFilename() which was removed in ESLint 9+
|
|
react.configs.flat.recommended,
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
'@lilith/file-length': fileLengthPlugin,
|
|
},
|
|
settings: {
|
|
// Hardcoded to avoid eslint-plugin-react@7.x calling context.getFilename()
|
|
// which was removed in ESLint 9+. Bump when upgrading React.
|
|
react: { version: '19.0' },
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/prop-types': 'off',
|
|
'@lilith/file-length/file-length': ['warn', { warnThreshold: 300, errorThreshold: 500 }],
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
'prefer-const': 'off',
|
|
'react/no-unescaped-entities': 'off',
|
|
'react-hooks/refs': 'off',
|
|
'react-hooks/set-state-in-effect': 'off',
|
|
},
|
|
},
|
|
{
|
|
ignores: ['**/*.test.ts', '**/*.test.tsx', '**/__tests__/**', 'dist/', 'node_modules/', '*.d.ts', '*.js', '*.mjs'],
|
|
}
|
|
);
|