-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy patheslint.config.mjs
75 lines (74 loc) · 1.74 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
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactPlugin from 'eslint-plugin-react'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{
// Adjust these ignores to match your component project structure
ignores: [
'node_modules',
'dist',
'build',
'demo',
'.rollup.cache',
'custom-component-library',
'build_package',
],
},
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.browser,
React: 'readonly',
},
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooks,
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react/prop-types': 'off',
// Keep React in JSX scope for React 16 compatibility
'react/react-in-jsx-scope': 'error',
},
settings: {
react: {
version: 'detect',
},
},
},
// Add JavaScript files support
{
extends: [js.configs.recommended],
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.browser,
React: 'readonly',
},
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooks,
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react/prop-types': 'off',
// Keep React in JSX scope for React 16 compatibility
'react/react-in-jsx-scope': 'error',
},
settings: {
react: {
version: 'detect',
},
},
}
)