File tree 1 file changed +11
-15
lines changed
1 file changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -8,33 +8,29 @@ This rule reports use of `v-html` directive in order to reduce the risk of injec
8
8
9
9
This rule reports all uses of ` v-html ` to help prevent XSS attacks.
10
10
11
- This rule does not check syntax errors in directives because it's checked by no-parsing-error rule.
12
-
13
- :-1 : Examples of ** incorrect** code for this rule:
14
-
15
- ``` html
16
- <template >
17
- <div v-html =" someHTML" ></div >
18
- </template >
11
+ <eslint-code-block :rules =" {'vue/no-v-html': ['error']} " >
19
12
```
20
-
21
- :+1 : Examples of ** correct** code for this rule:
22
-
23
- ``` html
24
13
<template>
25
- <div >{{someHTML}}</div >
14
+ <!-- ✓ GOOD -->
15
+ <div>{{ someHTML }}</div>
16
+
17
+ <!-- ✗ BAD -->
18
+ <div v-html="someHTML"></div>
26
19
</template>
27
20
```
21
+ </eslint-code-block >
22
+
23
+ This rule does not check syntax errors in directives because it's checked by no-parsing-error rule.
28
24
29
25
## :wrench : Options
30
26
31
27
Nothing.
32
28
33
- ## When Not To Use It
29
+ ## : mute : When Not To Use It
34
30
35
31
If you are certain the content passed ` to v-html ` is sanitized HTML you can disable this rule.
36
32
37
- ## Related links
33
+ ## : books : Further reading
38
34
39
35
- [ XSS in Vue.js] ( https://blog.sqreen.io/xss-in-vue-js/ )
40
36
You can’t perform that action at this time.
0 commit comments