Files
rxminder/eslint.config.cjs

73 lines
1.9 KiB
JavaScript

const tsParser = require('@typescript-eslint/parser');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const reactHooksPlugin = require('eslint-plugin-react-hooks');
module.exports = [
{
ignores: ['dist/**', 'node_modules/**', '**/*.min.js'],
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
ecmaFeatures: {
jsx: true,
},
},
globals: {
browser: true,
es2021: true,
node: true,
},
},
plugins: {
'@typescript-eslint': tsPlugin,
'react-hooks': reactHooksPlugin,
},
rules: {
// TypeScript ESLint rules
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': 'warn',
// React Hooks rules
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// General rules
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-debugger': 'error',
'no-unused-expressions': 'error',
'prefer-const': 'error',
'no-var': 'error',
// Code style (handled by Prettier)
'comma-dangle': 'off',
quotes: 'off',
semi: 'off',
},
},
{
files: ['**/*.test.{js,jsx,ts,tsx}', '**/*.spec.{js,jsx,ts,tsx}'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'no-console': 'off',
},
},
{
files: ['**/tests/e2e/fixtures.ts'],
rules: {
'react-hooks/rules-of-hooks': 'off',
},
},
];