Skip to content

Commit b8c3449

Browse files
committed
Fix: vue/script-indent doesn't work
1 parent c31b0cf commit b8c3449

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/lib/eslint.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ export const linter = new class extends Linter {
1818
}
1919

2020
/** @inheritdoc */
21-
verify(textOrSourceCode, config) {
22-
return super.verify(textOrSourceCode, config, verifyOptions)
21+
verify(textOrSourceCode, config, options) {
22+
return super.verify(textOrSourceCode, config, {
23+
...options,
24+
...verifyOptions,
25+
})
2326
}
2427

2528
/** @inheritdoc */
26-
verifyAndFix(text, config) {
27-
return super.verifyAndFix(text, config, verifyOptions)
29+
verifyAndFix(text, config, options) {
30+
return super.verifyAndFix(text, config, {
31+
...options,
32+
...verifyOptions,
33+
})
2834
}
2935
}()

src/playground.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class="playground__editor"
55
:code="code"
66
:config="actualConfig"
7+
:filename="filename"
78
:format="formatOptions"
89
:language="language"
910
:linter="linter"
@@ -76,6 +77,10 @@ export default {
7677
return config
7778
},
7879
80+
filename() {
81+
return this.looksHtml ? "vue-eslint-demo.vue" : "vue-eslint-demo.js"
82+
},
83+
7984
formatOptions() {
8085
return {
8186
insertSpaces: this.indentType === "space",
@@ -84,13 +89,16 @@ export default {
8489
},
8590
8691
language() {
87-
const trimedCode = this.code.trim()
88-
return trimedCode.startsWith("<") ? "html" : "javascript"
92+
return this.looksHtml ? "html" : "javascript"
8993
},
9094
9195
linter() {
9296
return linter
9397
},
98+
99+
looksHtml() {
100+
return this.code.trim().startsWith("<")
101+
},
94102
},
95103
96104
methods: {

0 commit comments

Comments
 (0)