-
-
Notifications
You must be signed in to change notification settings - Fork 681
/
Copy pathno-deprecated-html-element-is.js
50 lines (45 loc) · 1.46 KB
/
no-deprecated-html-element-is.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @author Yosuke Ota
* See LICENSE file in root directory for full license.
*/
'use strict'
// ------------------------------------------------------------------------------
// Requirements
// ------------------------------------------------------------------------------
const utils = require('../utils')
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallow using deprecated the `is` attribute on HTML elements (in Vue.js 3.0.0+)',
categories: ['vue3-essential'],
url: 'https://eslint.vuejs.org/rules/no-deprecated-html-element-is.html'
},
fixable: null,
schema: [],
messages: {
unexpected: 'The `is` attribute on HTML element are deprecated.'
}
},
create: function (context) {
return utils.defineTemplateBodyVisitor(context, {
"VAttribute[directive=true][key.name.name='bind'][key.argument.name='is'], VAttribute[directive=false][key.name='is']" (node) {
const element = node.parent.parent
if (
!utils.isHtmlWellKnownElementName(element.rawName) &&
!utils.isSvgWellKnownElementName(element.rawName)
) {
return
}
context.report({
node,
loc: node.loc,
messageId: 'unexpected'
})
}
})
}
}