-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
110 lines (108 loc) · 3.25 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
import neostandard, { resolveIgnoresFromGitignore } from 'neostandard'
import eslint from '@eslint/js'
// @ts-expect-error Yeah we don't need types here
import pluginVue from 'eslint-plugin-vue'
import tseslint from 'typescript-eslint'
import parser from '@typescript-eslint/parser'
export default [
{
languageOptions: {
parserOptions: {
parser,
extraFileExtensions: ['.vue'],
sourceType: 'module',
},
},
},
...neostandard({
ignores: [
...resolveIgnoresFromGitignore()
],
files: [
'**/*.js',
'**/*.mjs',
'**/*.cjs',
'**/*.vue',
],
filesTs: [
'**/*.ts',
'**/*.mts',
'**/*.cts',
],
ts: true,
}),
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['*.mjs', '*.js']
},
tsconfigRootDir: process.cwd(),
},
},
},
...pluginVue.configs['flat/recommended'],
{
name: 'migrate/eslint-config-standard-with-typescript',
rules: {
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/consistent-type-exports': [
'error',
{
fixMixedExportsWithInlineTypeSpecifier: true,
},
],
'@typescript-eslint/consistent-type-imports': 'error',
'@stylistic/member-delimiter-style': [
'error',
{
multiline: { delimiter: 'none' },
singleline: { delimiter: 'comma', requireLast: false },
},
],
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/return-await': ['error', 'always'],
'@typescript-eslint/triple-slash-reference': ['error', { lib: 'never', path: 'never', types: 'never' }],
'@stylistic/type-annotation-spacing': 'error',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
},
},
{
rules: {
'no-void': ['error', { allowAsStatement: true }],
'@typescript-eslint/restrict-template-expressions': ['warn', {
// It'll be the literal number
allowNumber: true,
// It'll be the literal boolean
allowBoolean: true,
// It'll be the regexp source (`${/a/g}` => '/a/g')
allowRegExp: true,
// If you YOLO, you YOLO
allowAny: true,
// default: allowNever: false
// default: allowNullish: false
}],
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',
}
},
{
files: ['**/*.vue'],
rules: {
'vue/max-attributes-per-line': ['warn', { singleline: 5 }],
'vue/multi-word-component-names': 'warn',
},
},
]