forked from vitejs/vite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
77 lines (77 loc) · 1.86 KB
/
.eslintrc.js
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
module.exports = {
root: true,
extends: ['plugin:node/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
},
rules: {
'no-debugger': ['error'],
'node/no-missing-import': [
'error',
{
allowModules: ['types', 'estree', 'testUtils'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx']
}
],
'node/no-missing-require': [
'error',
{
// for try-catching yarn pnp
allowModules: ['pnpapi'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx']
}
],
'node/no-restricted-require': [
'error',
Object.keys(require('./packages/vite/package.json').devDependencies).map(
(d) => ({
name: d,
message:
`devDependencies can only be imported using ESM syntax so ` +
`that they are included in the rollup bundle. If you are trying to ` +
`lazy load a dep, use (await import('dep')).default instead.`
})
)
],
'node/no-extraneous-import': [
'error',
{
allowModules: ['vite', 'less', 'sass']
}
],
'node/no-extraneous-require': [
'error',
{
allowModules: ['vite']
}
],
'node/no-deprecated-api': 'off',
'node/no-unpublished-import': 'off',
'node/no-unpublished-require': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'no-process-exit': 'off'
},
overrides: [
{
files: ['packages/vite/src/node/**'],
rules: {
'no-console': ['error']
}
},
{
files: ['packages/playground/**'],
rules: {
'node/no-extraneous-import': 'off',
'node/no-extraneous-require': 'off'
}
},
{
files: ['packages/create-app/template-*/**'],
rules: {
'node/no-missing-import': 'off'
}
}
]
}