Skip to content

Commit 6d296a2

Browse files
committed
feat(prefer-template): ignore style block
1 parent 7dec48d commit 6d296a2

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

lib/rules/prefer-template.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@
66
const { wrapCoreRule } = require('../utils')
77

88
// eslint-disable-next-line internal/no-invalid-meta
9-
module.exports = wrapCoreRule('prefer-template', {
10-
applyDocument: true
11-
})
9+
module.exports = wrapCoreRule('prefer-template')

tests/lib/rules/prefer-template.js

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ tester.run('prefer-template', rule, {
2828
.text {
2929
color: v-bind('\`#\${hex}\`')
3030
}
31-
</style>`
31+
</style>`,
32+
// https://github.com/vuejs/eslint-plugin-vue/issues/2712
33+
`
34+
<style>
35+
.text {
36+
color: v-bind('"#"+hex')
37+
}
38+
</style>
39+
`
3240
],
3341
invalid: [
3442
{
@@ -64,27 +72,6 @@ tester.run('prefer-template', rule, {
6472
line: 3
6573
}
6674
]
67-
},
68-
// CSS vars injection
69-
{
70-
code: `
71-
<style>
72-
.text {
73-
color: v-bind('"#"+hex')
74-
}
75-
</style>`,
76-
output: `
77-
<style>
78-
.text {
79-
color: v-bind('\`#\${hex}\`')
80-
}
81-
</style>`,
82-
errors: [
83-
{
84-
message: 'Unexpected string concatenation.',
85-
line: 4
86-
}
87-
]
8875
}
8976
]
9077
})

0 commit comments

Comments
 (0)