You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
933 B
34 lines
933 B
3 years ago
|
/**
|
||
|
* @author Yosuke Ota
|
||
|
* See LICENSE file in root directory for full license.
|
||
|
*/
|
||
|
'use strict'
|
||
|
|
||
|
// ------------------------------------------------------------------------------
|
||
|
// Helpers
|
||
|
// ------------------------------------------------------------------------------
|
||
|
|
||
|
const BUILTIN_MODIFIERS = new Set(['lazy', 'number', 'trim'])
|
||
|
|
||
|
module.exports = {
|
||
|
supported: '>=3.0.0',
|
||
|
/** @param {RuleContext} context @returns {TemplateListener} */
|
||
|
createTemplateBodyVisitor(context) {
|
||
|
return {
|
||
|
/** @param {VDirectiveKey} node */
|
||
|
"VAttribute[directive=true] > VDirectiveKey[name.name='model'][modifiers.length>0]"(
|
||
|
node
|
||
|
) {
|
||
|
for (const modifier of node.modifiers) {
|
||
|
if (!BUILTIN_MODIFIERS.has(modifier.name)) {
|
||
|
context.report({
|
||
|
node: modifier,
|
||
|
messageId: 'forbiddenVModelCustomModifiers'
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|