-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
157 lines (157 loc) · 4.27 KB
/
index.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
module.exports = {
root: true,
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
// Allow jest syntax in the src folder
jest: true,
},
parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 6,
requireConfigFile: false,
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:n/recommended',
'plugin:vue/recommended',
'plugin:@nextcloud/recommended',
'plugin:jsdoc/recommended',
'standard',
],
settings: {
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.js', '.vue'],
},
exports: {
conditions: ['import'],
},
},
jsdoc: {
tagNamePreference: {
returns: 'return',
},
mode: 'typescript',
},
},
plugins: ['vue', 'n', 'jsdoc'],
rules: {
// space before function ()
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
// stay consistent with array brackets
'array-bracket-newline': ['error', 'consistent'],
// tabs only for indentation
indent: ['error', 'tab'],
'no-tabs': ['error', { allowIndentationTabs: true }],
'vue/html-indent': ['error', 'tab'],
// allow spaces after tabs for alignment
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
// only debug console
'no-console': ['error', { allow: ['error', 'warn', 'info', 'debug'] }],
// classes blocks
'padded-blocks': ['error', { classes: 'always' }],
// always have the operator in front
'operator-linebreak': ['error', 'before'],
// ternary on multiline
'multiline-ternary': ['error', 'always-multiline'],
// force proper JSDocs
'jsdoc/require-returns': 0,
'jsdoc/require-returns-description': 0,
'jsdoc/tag-lines': ['off'],
// disallow use of "var"
'no-var': 'error',
// suggest using const
'prefer-const': 'error',
// es6 import/export and require
'n/no-unpublished-require': ['off'],
'n/no-unsupported-features/es-syntax': ['off'],
// PascalCase components names for vuejs
// https://vuejs.org/v2/style-guide/#Single-file-component-filename-casing-strongly-recommended
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
// force name
'vue/match-component-file-name': ['error', {
extensions: ['jsx', 'vue', 'js'],
shouldMatchCase: true,
}],
// space before self-closing elements
'vue/html-closing-bracket-spacing': 'error',
// no ending html tag on a new line
'vue/html-closing-bracket-newline': ['error', { multiline: 'never' }],
// check vue files too
'n/no-missing-import': ['error', {}],
// code spacing with attributes
'vue/max-attributes-per-line': ['error', {
singleline: 3,
multiline: 1,
}],
'vue/first-attribute-linebreak': ['error', {
singleline: 'beside',
multiline: 'beside',
}],
// Allow single-word components names
'vue/multi-word-component-names': ['off'],
// custom event naming convention
'vue/custom-event-name-casing': ['error', 'kebab-case', {
// allows custom xxxx:xxx events formats
ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'],
}],
// always add a trailing comma (for diff readability)
'comma-dangle': ['warn', 'always-multiline'],
// Allow shallow import of @vue/test-utils and @testing-library/vue in order to be able to use it in
// the src folder
'n/no-unpublished-import': ['error', {
allowModules: ['@vue/test-utils', '@testing-library/vue'],
}],
// require object literal shorthand syntax
'object-shorthand': ['error', 'always'],
// Warn when file extensions are not used on import paths
'import/extensions': ['warn', 'always', {
ignorePackages: true,
}],
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
extends: [
'@vue/eslint-config-typescript/recommended',
'plugin:import/typescript',
],
parserOptions: {
parser: '@typescript-eslint/parser',
},
rules: {
'n/no-missing-import': 'off',
'import/extensions': 'off',
'jsdoc/check-tag-names': [
'warn', {
// for projects using typedoc
definedTags: [
'notExported',
'packageDocumentation',
],
},
],
// Does not make sense with TypeScript
'jsdoc/require-param-type': 'off',
},
settings: {
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.(m|c)?js', '.ts', '.tsx', '.vue'],
},
},
},
},
],
}