Skip to content

Commit 90380c6

Browse files
Change tests+docs ignorePattern
1 parent 37c7542 commit 90380c6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

docs/rules/no-v-html.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ This rule reports all uses of `v-html` directive in order to reduce the risk of
3535
```json
3636
{
3737
"vue/no-v-html": ["error", {
38-
"ignorePattern": ".Html$"
38+
"ignorePattern": "^html"
3939
}]
4040
}
4141
```
4242

4343
- `ignorePattern` ... disables reporting when the `v-html` directive references a variable matching this pattern. By default, all `v-html` uses are forbidden.
4444

45-
### `{ "ignorePattern": ".Html$" }`
45+
### `{ "ignorePattern": "^html" }`
4646

47-
<eslint-code-block :rules="{'vue/no-v-html': ['error', { 'ignorePattern': '.Html$' }]}">
47+
<eslint-code-block :rules="{'vue/no-v-html': ['error', { 'ignorePattern': '^html' }]}">
4848

4949
```vue
5050
<template>
5151
<!-- ✓ GOOD -->
5252
<h2>{{ userName }}</h2>
53-
<span v-html="userLinkHtml" />
53+
<span v-html="htmlUserLink" />
5454
5555
<!-- ✗ BAD -->
5656
<span v-html="userName" />

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ ruleTester.run('no-v-html', rule, {
3131
},
3232
{
3333
filename: 'test.vue',
34-
code: '<template><div v-html="knownHtml"></div></template>',
35-
options: [{ ignorePattern: '.Html$' }]
34+
code: '<template><div v-html="htmlKnownToBeSafe"></div></template>',
35+
options: [{ ignorePattern: '^html' }]
3636
}
3737
],
3838
invalid: [
@@ -78,7 +78,7 @@ ruleTester.run('no-v-html', rule, {
7878
{
7979
filename: 'test.vue',
8080
code: '<template><div v-html="unsafeString"></div></template>',
81-
options: [{ ignorePattern: '.Html$' }],
81+
options: [{ ignorePattern: '^html' }],
8282
errors: [
8383
{
8484
message: "'v-html' directive can lead to XSS attack.",

0 commit comments

Comments
 (0)