-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbase.js
87 lines (75 loc) · 2.65 KB
/
base.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
import standard from '@vue/eslint-config-standard'
import tsEslintPlugin from '@typescript-eslint/eslint-plugin'
import { createNextImportResolver } from 'eslint-import-resolver-next'
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
import eslintPluginImportX from 'eslint-plugin-import-x'
const { createNodeResolver } = eslintPluginImportX
/**
* @type {import('eslint').Linter.Config[]}
*/
export default [
...standard,
{
settings: {
'import-x/resolver-next': [
createNodeResolver(),
createNextImportResolver(),
createTypeScriptImportResolver({
alwaysTryTypes: true,
project: ['**/tsconfig.json', '**/tsconfig.*.json']
})
]
}
},
{
name: '@vue/typescript/standard',
files: ['*.ts', '*.tsx', '*.vue'],
plugins: {
'@typescript-eslint': tsEslintPlugin
},
rules: {
// The code problem checked by these ESLint rules
// are automatically checked by the TypeScript compiler.
'no-undef': 'off',
'no-dupe-class-members': 'off',
'no-redeclare': 'off',
// This rule has `typescript-eslint` equivalent but that require type information.
// So only disable the JS version of the rule here to avoid false positives.
// To turn on it please use the `type-checked` config.
'no-unused-vars': 'off',
// Other similar rules in `type-checked` do not incur false positives in the JS version,
// only false negatives. So they are not turned off here.
// Rules that need to be extended to the `typescript-eslint` equivalents
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'error',
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
camelcase: 'off',
// Though there's an equivalent version of `camelcase` in TS,
// it's deprecated in favor of `@typescript-eslint/naming-convention`
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variableLike',
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
format: ['camelCase', 'PascalCase', 'UPPER_CASE']
}
],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{
functions: false,
classes: false,
variables: false,
// These are unique options in the typescript-eslint version of the rule
enums: false,
typedefs: false
}
]
}
}
]