Commit e5b3dfc
committed
Fix template-no-unbound false positive in GJS/GTS
`unbound` is an ambient strict-mode keyword in Glimmer/Ember
(registered in STRICT_MODE_KEYWORDS, backed by
BUILTIN_KEYWORD_HELPERS.unbound), so `{{unbound foo}}` works in .gjs/.gts
templates without an import. The rule should still flag those uses —
its purpose is to discourage `unbound` everywhere — but skip cases
where the user has shadowed `unbound` with a JS import or a template
block param.
Replace the previous .hbs-only gate with a JS-scope-binding check
(mirroring template-no-log): walk sourceCode.getScope().variables
to detect imports/consts/params, plus track template block params,
and skip reporting only when the identifier resolves to a local.
This restores correct behavior for:
- bare `{{unbound foo}}` in .gjs (now flagged again — was a false
negative under the .hbs-only gate)
- `import unbound from '...'; {{unbound foo}}` (correctly skipped)
- `{{#let (...) as |unbound|}}{{unbound}}{{/let}}` (correctly skipped)
Update templateMode metadata from 'loose' to 'both' to reflect that
the rule now runs in strict mode.1 parent b705850 commit e5b3dfc
2 files changed
Lines changed: 109 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 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 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
21 | 65 | | |
22 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
23 | 72 | | |
24 | 73 | | |
25 | 74 | | |
26 | 75 | | |
27 | 76 | | |
28 | 77 | | |
29 | 78 | | |
| 79 | + | |
30 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
31 | 104 | | |
32 | | - | |
33 | 105 | | |
34 | 106 | | |
35 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
40 | 72 | | |
41 | 73 | | |
42 | 74 | | |
| |||
0 commit comments