import js from '@eslint/js';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __dirname = dirname(fileURLToPath(import.meta.url));
export default [
{
ignores: ['**/assets/**', '**/complex-form/**', 'dist/**', 'node_modules/**'],
},
{
files: ['src/**/*.{ts,tsx,js,jsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
project: true,
sourceType: 'module',
tsconfigRootDir: __dirname,
},
globals: {
browser: true,
es2021: true,
},
},
plugins: {
'@typescript-eslint': tsPlugin,
react,
'react-hooks': reactHooks,
'jsx-a11y': jsxA11y,
},
rules: {
...js.configs.recommended.rules,
...tsPlugin.configs['recommended'].rules,
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
...jsxA11y.configs.recommended.rules,
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'react/no-unused-state': 'error',
eqeqeq: 'error',
'react/react-in-jsx-scope': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
];