UNPKG

ember-template-lint

Version:
28 lines (23 loc) 783 B
'use strict'; const Rule = require('./_base'); module.exports = class NoClassBindings extends Rule { visitor() { function check(node) { let isAttrNode = node.type === 'AttrNode'; let specifiedKey = isAttrNode ? node.name : node.key; let argumentName = isAttrNode ? node.name : `@${node.key}`; if (argumentName === '@classBinding' || argumentName === '@classNameBindings') { this.log({ message: `Passing the \`${specifiedKey}\` property as an argument within templates is not allowed.`, line: node.loc && node.loc.start.line, column: node.loc && node.loc.start.column, source: this.sourceForNode(node), }); } } return { AttrNode: check, HashPair: check, }; } };