-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy patheslint.config.mjs
111 lines (102 loc) · 2.81 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
103
104
105
106
107
108
109
110
111
import babelParser from '@babel/eslint-parser'
import scw from '@scaleway/eslint-config-react/javascript'
import scwTypescript from '@scaleway/eslint-config-react/typescript'
import globals from 'globals'
export default [
{
ignores: [
'**/node_modules/',
'**/dist/',
'**/build/',
'**/__typetests__/',
'**/packages_deprecated/',
'**/coverage/',
],
},
{
settings: {
react: {
pragma: 'React', // Pragma to use, default to "React"
fragment: 'Fragment', // Fragment to use (may be a property of <pragma>), default to "Fragment"
version: 'detect', // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// Defaults to the "defaultVersion" setting and warns if missing, and to "detect" in the future
defaultVersion: '18', // Default React version to use when the version you have installed cannot be detected.
// If not provided, defaults to the latest React version.
},
'import/resolver': {
typescript: {
project: [
'./tsconfig.json', // Root config
'./packages/**/tsconfig.json',
],
},
},
},
languageOptions: {
globals: {
...globals.browser,
},
},
},
...scw.map(config => ({ ...config, files: ['**/*.js'] })),
{
files: ['**/*.js'],
languageOptions: {
parser: babelParser,
parserOptions: {
configFile: './babel.config.json',
},
},
},
...scwTypescript.map(config => ({
...config,
files: ['**/*.ts', '**/*.tsx'],
})),
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
project: ['tsconfig.json', 'packages/**/tsconfig.json'],
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
...scwTypescript.map(config => ({
...config,
files: [
'packages/changesets-renovate/**/*.ts{x,}',
'packages/validate-icu-locales/**/*.ts{x,}',
'**/__tests__/**/*.ts{x,}',
],
languageOptions: {
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
project: ['tsconfig.json', 'packages/**/tsconfig.json'],
},
},
rules: {
...config.rules,
'no-console': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
},
})),
{
files: [
'**/__tests__/**/*.ts{x,}',
'**/vitest.setup.ts',
'**/*.config.ts',
'**/__mocks__/**/*.ts{x,}',
],
rules: {
'import/no-extraneous-dependencies': 'off',
'react/jsx-key': 'off',
'import/no-relative-packages': 'off',
},
},
]