-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy patheslint.config.js
More file actions
95 lines (88 loc) · 2.53 KB
/
Copy patheslint.config.js
File metadata and controls
95 lines (88 loc) · 2.53 KB
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
90
91
92
93
94
95
import js from '@eslint/js';
import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import prettierConfig from 'eslint-plugin-prettier/recommended';
import htmlPlugin from 'eslint-plugin-html';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
export default [
// Global ignores — replaces .eslintignore and ignorePatterns
{
ignores: [
'src/VERSION.js',
'build/**',
'playwright-report/**',
'test-results/**',
'**/i18n*.js',
'**/i18n*.jsx',
],
},
// eslint:recommended
js.configs.recommended,
// plugin:react/recommended (flat)
reactPlugin.configs.flat.recommended,
// Base rules, globals, and react-hooks plugin
{
plugins: {
'react-hooks': reactHooksPlugin,
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
settings: {
react: { version: 'detect' },
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
curly: ['error', 'all'],
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'no-case-declarations': 'off',
'no-extra-boolean-cast': 'off',
'no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none' },
],
},
},
// TypeScript — replaces the overrides block
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
},
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
// recommended contains only non-type-aware rules (no await-thenable, no-floating-promises, etc.)
// Type-aware rules live in recommended-type-checked and require parserOptions.project
...tsPlugin.configs.recommended.rules,
'no-undef': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none' },
],
},
},
// Prettier — must be last to override formatting rules
prettierConfig,
// HTML — eslint-plugin-html extracts and lints <script> blocks
{
files: ['**/*.html'],
plugins: { html: htmlPlugin },
},
];