ember-template-lint
Version:
Linter for Ember or Handlebars templates.
27 lines (24 loc) • 552 B
JavaScript
import Rule from './_base.js';
const message = 'Unexpected {{partial}} usage.';
export default class NoPartial extends Rule {
_checkForPartial(node) {
if (node.path.original === 'partial') {
this.log({
message,
node,
});
}
}
/**
* @returns {import('./types.js').VisitorReturnType<NoPartial>}
*/
visitor() {
return {
MustacheStatement(node, path) {
if (!path.parentNode || path.parentNode.type !== 'AttrNode') {
this._checkForPartial(node);
}
},
};
}
}