-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheslint.config.mjs
102 lines (101 loc) · 2.86 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
90
91
92
93
94
95
96
97
98
99
100
101
102
import eslintPluginTypescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import eslintPluginReact from 'eslint-plugin-react';
import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
import eslintPluginPrettier from 'eslint-plugin-prettier';
export default [
{
ignores: ['node_modules/', 'dist/', '.cache/'], // Ignore directories
},
// TypeScript files configuration
{
files: ['**/*.ts', '**/*.tsx'],
ignores: ['install/webpack.config.example.ts', 'install/vite.config.example.ts'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
module: 'readonly',
require: 'readonly',
strapi: 'readonly',
process: 'readonly',
},
},
plugins: {
'@typescript-eslint': eslintPluginTypescript,
react: eslintPluginReact,
'react-hooks': eslintPluginReactHooks,
'jsx-a11y': eslintPluginJsxA11y,
prettier: eslintPluginPrettier,
},
rules: {
...eslintPluginTypescript.configs.recommended.rules,
...eslintPluginReact.configs.recommended.rules,
...eslintPluginJsxA11y.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'prettier/prettier': 'error',
// TODO: disallow any
'@typescript-eslint/no-explicit-any': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
// JavaScript files configuration
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
module: 'readonly',
require: 'readonly',
strapi: 'readonly',
process: 'readonly',
},
},
plugins: {
react: eslintPluginReact,
'react-hooks': eslintPluginReactHooks,
'jsx-a11y': eslintPluginJsxA11y,
prettier: eslintPluginPrettier,
},
rules: {
...eslintPluginReact.configs.recommended.rules,
...eslintPluginJsxA11y.configs.recommended.rules,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/react-in-jsx-scope': 'off',
'prettier/prettier': 'error',
},
settings: {
react: {
version: 'detect',
},
},
},
];