File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ module.exports = {
21
21
ignorePattern : {
22
22
type : 'string'
23
23
}
24
- }
24
+ } ,
25
+ additionalProperties : false
25
26
} ] ,
26
27
messages : {
27
28
unexpected : "'v-html' directive can lead to XSS attack."
@@ -30,15 +31,14 @@ module.exports = {
30
31
/** @param {RuleContext } context */
31
32
create ( context ) {
32
33
const options = context . options [ 0 ]
33
- let ignoredVarMatcher = null
34
- if ( options ?. ignorePattern ) {
35
- ignoredVarMatcher = toRegExp ( options . ignorePattern , { remove : 'g' } )
36
- }
34
+ const ignoredVarMatcher = options ?. ignorePattern
35
+ ? toRegExp ( options . ignorePattern , { remove : 'g' } )
36
+ : undefined
37
37
38
38
return utils . defineTemplateBodyVisitor ( context , {
39
39
/** @param {VDirective } node */
40
40
"VAttribute[directive=true][key.name.name='html']" ( node ) {
41
- if ( ignoredVarMatcher !== null && node . value . expression . type === 'Identifier' && ignoredVarMatcher . test ( node . value . expression . name ) ) {
41
+ if ( ignoredVarMatcher && node . value . expression . type === 'Identifier' && ignoredVarMatcher . test ( node . value . expression . name ) ) {
42
42
return
43
43
}
44
44
context . report ( {
You can’t perform that action at this time.
0 commit comments