Skip to content

Commit 6c775ac

Browse files
npm run lint:fix
1 parent 9dcfc74 commit 6c775ac

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

lib/rules/no-v-html.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ module.exports = {
1515
url: 'https://eslint.vuejs.org/rules/no-v-html.html'
1616
},
1717
fixable: null,
18-
schema: [{
19-
type: 'object',
20-
properties: {
21-
ignorePattern: {
22-
type: 'string'
23-
}
24-
},
25-
additionalProperties: false
26-
}],
18+
schema: [
19+
{
20+
type: 'object',
21+
properties: {
22+
ignorePattern: {
23+
type: 'string'
24+
}
25+
},
26+
additionalProperties: false
27+
}
28+
],
2729
messages: {
2830
unexpected: "'v-html' directive can lead to XSS attack."
2931
}
@@ -38,7 +40,11 @@ module.exports = {
3840
return utils.defineTemplateBodyVisitor(context, {
3941
/** @param {VDirective} node */
4042
"VAttribute[directive=true][key.name.name='html']"(node) {
41-
if (ignoredVarMatcher && node.value.expression.type === 'Identifier' && ignoredVarMatcher.test(node.value.expression.name)) {
43+
if (
44+
ignoredVarMatcher &&
45+
node.value.expression.type === 'Identifier' &&
46+
ignoredVarMatcher.test(node.value.expression.name)
47+
) {
4248
return
4349
}
4450
context.report({

tests/lib/rules/no-v-html.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ruleTester.run('no-v-html', rule, {
3232
{
3333
filename: 'test.vue',
3434
code: '<template><div v-html="knownHtml"></div></template>',
35-
options: [{ignorePattern: '/^(?:html|.+Html)$/'}]
35+
options: [{ ignorePattern: '/^(?:html|.+Html)$/' }]
3636
}
3737
],
3838
invalid: [
@@ -54,7 +54,7 @@ ruleTester.run('no-v-html', rule, {
5454
{
5555
filename: 'test.vue',
5656
code: '<template><div v-html="unsafeString"></div></template>',
57-
options: [{ignorePattern: '^(?:html|.+Html)$'}],
57+
options: [{ ignorePattern: '^(?:html|.+Html)$' }],
5858
errors: ["'v-html' directive can lead to XSS attack."]
5959
}
6060
]

0 commit comments

Comments
 (0)