-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
eslint.config.js
137 lines (126 loc) · 3.53 KB
/
eslint.config.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
const antfu = require('@antfu/eslint-config').default
const pluginSimpleImportSort = require('eslint-plugin-simple-import-sort')
module.exports = antfu(
{
stylistic: {
indent: 'tab',
quotes: 'single',
semi: false,
// https://eslint.style/packages/ts
overrides: {
'curly': 'off',
'style/eol-last': 'off',
'style/block-spacing': ['error', 'always'],
'style/brace-style': ['error', '1tbs'],
'style/comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
}],
'style/comma-spacing': ['error', { before: false, after: true }],
'style/func-call-spacing': ['error', 'never'],
'style/lines-around-comment': ['error', {
beforeBlockComment: true,
afterBlockComment: false,
beforeLineComment: false,
afterLineComment: false,
allowBlockStart: true,
allowBlockEnd: true,
allowObjectStart: true,
allowObjectEnd: true,
allowArrayStart: true,
allowArrayEnd: true,
}],
'style/member-delimiter-style': ['error', {
multiline: {
delimiter: 'none',
requireLast: true,
},
singleline: {
delimiter: 'comma',
requireLast: false,
},
}],
'style/object-curly-spacing': ['error', 'always'],
'style/padded-blocks': ['error', {
blocks: 'never',
classes: 'always',
switches: 'never',
}],
'style/padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: 'class' },
{ blankLine: 'always', prev: '*', next: 'block' },
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: '*', next: 'case' },
{ blankLine: 'always', prev: '*', next: 'default' },
],
'style/quote-props': ['error', 'consistent-as-needed'],
// 'style/space-before-blocks': ['error', 'always'],
'style/type-annotation-spacing': ['error', {
before: false,
after: true,
overrides: {
arrow: { before: true, after: true },
},
}],
},
},
jsonc: false,
yaml: false,
linterOptions: {
reportUnusedDisableDirectives: false,
},
ignores: [
'node_modules',
'build',
'logs',
'database',
],
},
{
plugins: {
'simple-import-sort': pluginSimpleImportSort,
},
rules: {
'ts/ban-ts-comment': 'off',
'ts/consistent-type-imports': 'off',
'ts/consistent-type-definitions': ['error', 'type'],
'eslint-comments/no-unlimited-disable': 'off',
'eslint-comments/no-unused-disable': 'off',
'antfu/if-newline': 'off',
'no-unused-vars': 'off', // prefer unused-imports/no-unused-vars
'unused-imports/no-unused-vars': 'warn',
'no-console': 'off',
// Preferred "simple-import-sort" over "import/order"
// See: https://github.com/lydell/eslint-plugin-simple-import-sort#how-is-this-rule-different-from-importorder
'sort-imports': 'off',
'import/order': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
// Side effect imports.
['^\\u0000'],
// Node.js builtins prefixed with `node:`.
['^node:'],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Internal packages.
// Things that start with `@/`.
['^@/\\w'],
// Other imports
['^\\w'],
// TypeScript import assignments.
['^\\u0001', '^\\u0002'],
],
},
],
'simple-import-sort/exports': 'off',
'import/no-duplicates': 'error',
},
}
)