forked from ember-cli/eslint-plugin-ember
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-no-unbound.js
More file actions
36 lines (36 loc) · 1.03 KB
/
template-no-unbound.js
File metadata and controls
36 lines (36 loc) · 1.03 KB
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
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'disallow {{unbound}} helper',
category: 'Deprecations',
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/template-no-unbound.md',
templateMode: 'loose',
},
schema: [],
messages: { unexpected: 'Unexpected {{unboundHelper}} usage.' },
originallyFrom: {
name: 'ember-template-lint',
rule: 'lib/rules/no-unbound.js',
docs: 'docs/rule/no-unbound.md',
tests: 'test/unit/rules/no-unbound-test.js',
},
},
create(context) {
function check(node) {
if (node.path?.type === 'GlimmerPathExpression' && node.path.original === 'unbound') {
context.report({
node,
messageId: 'unexpected',
data: { unboundHelper: '{{unbound}}' },
});
}
}
return {
GlimmerMustacheStatement: check,
GlimmerBlockStatement: check,
GlimmerSubExpression: check,
};
},
};