Skip to content

Commit 79b608c

Browse files
Add ignorePattern example to no-v-html docs
1 parent 0b6235f commit 79b608c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/rules/no-v-html.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,23 @@ This rule reports all uses of `v-html` directive in order to reduce the risk of
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$" }`
46+
47+
<eslint-code-block :rules="{'vue/no-v-html': ['error', { 'ignorePattern': '.Html$' }]}">
48+
49+
```vue
50+
<template>
51+
<!-- ✓ GOOD -->
52+
<h2>{{ userName }}</h2>
53+
<span v-html="userLinkHtml" />
54+
55+
<!-- ✗ BAD -->
56+
<span v-html="userName" />
57+
</template>
58+
```
59+
60+
</eslint-code-block>
61+
4562
## :mute: When Not To Use It
4663

4764
If you are certain the content passed to `v-html` is sanitized HTML you can disable this rule.

0 commit comments

Comments
 (0)