-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
143 lines (139 loc) · 4.17 KB
/
eslint.config.js
File metadata and controls
143 lines (139 loc) · 4.17 KB
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
import stylistic from '@stylistic/eslint-plugin'
import esParser from '@typescript-eslint/parser'
import vue from 'eslint-plugin-vue'
import vParser from 'vue-eslint-parser'
const tsRules = {
'@stylistic/space-before-blocks': [ 'error', 'always' ],
'@stylistic/switch-colon-spacing': [ 'error', { 'after': true, 'before': false }],
'@stylistic/keyword-spacing': [ 'error', { before: true, after: true }],
'@stylistic/space-in-parens': [ 'error', 'never' ],
'@stylistic/type-generic-spacing': [ 'error' ],
'@stylistic/type-annotation-spacing': [ 'error' ],
'@stylistic/curly-newline': [ 'error', { 'minElements': 2, 'consistent': true }],
'@stylistic/indent': [ 'error', 2 ],
'@stylistic/quotes': [ 'error', 'single' ],
'@stylistic/semi': [ 'error', 'never' ],
'@stylistic/eol-last': [ 'error', 'always' ],
'@stylistic/arrow-spacing': [ 'error', { 'before': true, 'after': true }],
'@stylistic/space-before-function-paren': [ 'error', 'always' ],
'@stylistic/comma-spacing': [ 'error', { 'before': false, 'after': true }],
'@stylistic/comma-dangle': [ 'error', 'always-multiline' ],
'@stylistic/array-bracket-spacing': [
'error',
'always',
{
// 'singleValue': false, // makes [1] into [ 1 ] provided there are no other items in the list. disabled for now.
'objectsInArrays': false,
'arraysInArrays': false,
},
],
'@stylistic/spaced-comment': [ 'error', 'always' ],
'@stylistic/space-infix-ops': [ 'error' ],
'@stylistic/block-spacing': [ 'error', 'always' ],
'@stylistic/array-bracket-newline': [ 'error', { multiline: true, minItems: null }],
'@stylistic/object-curly-spacing': [ 'error', 'always' ],
'@stylistic/object-curly-newline': [ 'error', { multiline: true, consistent: true }],
}
export default [
{
globals: {
definePage: 'readonly',
},
},
{
files: [ '**/*.js', '**/*.ts' ],
languageOptions: {
parser: esParser,
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: { '@stylistic': stylistic },
rules: { ...tsRules },
},
{
files: [ '**/*.vue' ],
languageOptions: {
parser: vParser,
parserOptions: {
parser: esParser, // Use TypeScript parser for `<script>` blocks
ecmaVersion: 'latest',
sourceType: 'module',
},
},
plugins: { vue, '@stylistic': stylistic },
rules: {
// TS STUFF IN VUE JS FILES
...tsRules,
/**
* VUE JS STUFF
* Format and ordering. note that v-bind will sit among props/conventional attributes
* <div
* is="header"
* v-for="item in items"
* v-if="!visible"
* v-once
* id="uniqueID"
* ref="header"
* v-model="headerData"
* my-prop="prop"
* @click="functionCall"
* v-text="textContent"
* >
* ...
* </div>
*/
'vue/attributes-order': [
'error',
{
'order': [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
[ 'UNIQUE', 'SLOT' ],
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'EVENTS',
'CONTENT',
],
'alphabetical': false,
},
],
'vue/max-attributes-per-line': [
'error', {
'singleline': { 'max': 1 },
'multiline': { 'max': 1 },
},
],
'vue/first-attribute-linebreak': [
'error', {
'singleline': 'ignore',
'multiline': 'below',
},
],
'vue/html-indent': [ 'error', 2 ], // Enforce 2 spaces for indentation
'vue/html-closing-bracket-newline': [
'error',
{
'multiline': 'always',
'selfClosingTag': { 'multiline': 'always' },
},
],
'vue/html-closing-bracket-spacing': [
'error', {
startTag: 'never',
endTag: 'never',
selfClosingTag: 'always',
},
],
'vue/singleline-html-element-content-newline': [
'error', {
ignoreWhenNoAttributes: true,
ignoreWhenEmpty: true,
},
],
},
},
]