-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
113 lines (103 loc) · 2.91 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
module.exports = {
'extends': [
'wikimedia',
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript'
],
'parserOptions': {
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser'
},
'root': true,
'env': {
browser: true,
node: true,
es6: true,
mocha: true
},
'globals': {
mw: false
},
'plugins': [
'@stylistic/ts'
],
'rules': {
// TODO: Turn this rule back on when this is merged https://github.com/vuejs/eslint-plugin-vue/pull/2268
'vue/no-setup-props-destructure': [ 'off' ],
// Make unused vars throw a linter error
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
// We want to use const and let wherever we like. TypeScript will inform us about use-before-declaration situations
'vars-on-top': [ 'off' ],
// use as few quotes as possible
'quote-props': [ 'error', 'consistent-as-needed', { keywords: true } ],
// Allow template literals
'quotes': [ 'error', 'single', { allowTemplateLiterals: true } ],
// We have big monitors
'max-len': [ 'error', { code: 180 } ],
// jsdoc should use TypeScript type information, most doc comments may just inform about the purpose of a function/method
'jsdoc/require-param': [ 'off' ],
'jsdoc/require-returns': [ 'off' ],
// This forces script and style lang in Vue single file components
'vue/block-lang': [ 'error', {
script: { lang: 'ts' },
style: { lang: 'scss' }
} ],
// Workaround for Typescript enums, see https://github.com/typescript-eslint/typescript-eslint/issues/2483
'no-shadow': 'off',
'@typescript-eslint/no-shadow': [ 'error' ],
'@stylistic/ts/type-annotation-spacing': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
// This forces private properties to be prefixed with an underscore
'no-underscore-dangle': [
'error',
{
allowAfterThis: true
}
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'classProperty',
modifiers: [ 'private' ],
format: [ 'camelCase' ],
leadingUnderscore: 'require'
},
// Allow PHP-like public CLASS_CONSTANTS
{
selector: 'classProperty',
modifiers: [ 'public', 'static', 'readonly' ],
format: [ 'UPPER_CASE' ],
leadingUnderscore: 'forbid'
},
{
selector: 'classProperty',
modifiers: [ 'public' ],
format: [ 'camelCase' ],
leadingUnderscore: 'forbid'
},
{
selector: 'parameterProperty',
format: [ 'camelCase' ],
leadingUnderscore: 'forbid'
},
{
selector: 'parameter',
format: [ 'camelCase' ],
leadingUnderscore: 'forbid'
}
]
},
'overrides': [
{
// enable the rule specifically for TypeScript files
files: [ '*.ts', '*.mts', '*.cts', '*.tsx', '*.vue' ],
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-member-accessibility': 'error'
}
}
]
};