-
Notifications
You must be signed in to change notification settings - Fork 10
/
.eslintrc.cjs
114 lines (108 loc) · 3.59 KB
/
.eslintrc.cjs
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
112
113
114
// @ts-check
const { defineConfig } = require('eslint-define-config')
const pkg = require('./package.json')
module.exports = defineConfig({
root: true,
extends: [
'eslint:recommended',
'plugin:n/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:regexp/recommended',
],
ignorePatterns: ['packages/create-vite/template-**'],
plugins: ['import', 'regexp','react-refresh'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2022,
},
rules: {
eqeqeq: ['warn', 'always', { null: 'never' }],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'no-debugger': ['error'],
'no-empty': ['warn', { allowEmptyCatch: true }],
'no-process-exit': 'off',
'no-useless-escape': 'off',
'prefer-const': [
'warn',
{
destructuring: 'all',
},
],
'n/no-process-exit': 'off',
'n/no-missing-import': 'off',
'n/no-missing-require': [
'error',
{
// for try-catching yarn pnp
allowModules: ['pnpapi', 'vite'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],
},
],
'n/no-extraneous-import': [
'error',
{
allowModules: ['vite', 'less', 'sass', 'vitest', 'unbuild',"@jest/globals"],
},
],
'n/no-extraneous-require': [
'error',
{
allowModules: ['vite'],
},
],
'n/no-deprecated-api': 'off',
'n/no-unpublished-import': 'off',
'n/no-unpublished-require': 'off',
'n/no-unsupported-features/es-syntax': 'off',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': 'off', // TODO: we should turn this on in a new PR
// '@typescript-eslint/explicit-module-boundary-types': [
// 'error',
// { allowArgumentsExplicitlyTypedAsAny: true },
// ],
'@typescript-eslint/no-empty-function': [
'error',
{ allow: ['arrowFunctions'] },
],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'off', // conflicts with prettier
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-unused-vars': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: false },
],
// disable rules set in @typescript-eslint/stylistic v6 that wasn't set in @typescript-eslint/recommended v5 and which conflict with current code
// maybe we should turn them on in a new PR
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/ban-tslint-comment': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/prefer-function-type': 'off',
'import/no-duplicates': 'error',
'import/order': 'error',
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: false,
},
],
'regexp/no-contradiction-with-assertion': 'error',
'n/shebang': 'off'
},
reportUnusedDisableDirectives: true,
})