-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
eslint.js
35 lines (31 loc) · 966 Bytes
/
eslint.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
import Linter from "eslint4b"
import plugin from "eslint-plugin-vue"
import * as parser from "vue-eslint-parser"
const verifyOptions = Object.freeze({
preprocess: plugin.processors[".vue"].preprocess,
postprocess: plugin.processors[".vue"].postprocess,
})
export const linter = new class extends Linter {
/** Initialize this linter. */
constructor() {
super()
this.defineParser("vue-eslint-parser", parser)
for (const name of Object.keys(plugin.rules)) {
this.defineRule(`vue/${name}`, plugin.rules[name])
}
}
/** @inheritdoc */
verify(textOrSourceCode, config, options) {
return super.verify(textOrSourceCode, config, {
...options,
...verifyOptions,
})
}
/** @inheritdoc */
verifyAndFix(text, config, options) {
return super.verifyAndFix(text, config, {
...options,
...verifyOptions,
})
}
}()