-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
89 lines (85 loc) · 2.67 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import js from '@eslint/js';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import a11yPlugin from 'eslint-plugin-jsx-a11y';
import prettierConfig from 'eslint-config-prettier';
import globals from 'globals';
export default [
js.configs.recommended,
{
ignores: ['node_modules/**', 'dist/**', 'build/**', 'coverage/**'],
},
{
files: ['**/*.{ts,tsx}'],
plugins: {
'@typescript-eslint': tsPlugin,
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.node,
myCustomGlobal: 'readonly',
},
},
rules: {
// TypeScript specific rules
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/prefer-interface': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
},
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
'jsx-a11y': a11yPlugin,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// General JavaScript/TypeScript rules
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-debugger': 'warn',
'no-unused-vars': 'off', // TypeScript rule is used instead
'prefer-const': 'error',
'no-var': 'error',
eqeqeq: ['error', 'always'],
// React specific rules
'react/prop-types': 'off', // Not needed when using TypeScript
'react/react-in-jsx-scope': 'off', // Not needed in React 17+
'react/display-name': 'off',
'react/no-unescaped-entities': 'warn',
'react/no-children-prop': 'error',
'react/no-array-index-key': 'warn',
'react/no-unused-prop-types': 'warn',
'react/jsx-no-target-blank': 'warn',
'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'never' }],
// React Hooks rules
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// Accessibility rules
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/anchor-is-valid': 'warn',
'jsx-a11y/click-events-have-key-events': 'warn',
'jsx-a11y/no-static-element-interactions': 'warn',
},
},
prettierConfig,
];