Commit 5234d16
Fix: exempt JS-scope locals from restriction checks in gjs/gts
When in gjs/gts mode, names that resolve to JS-scope variables (imports,
const, let, function params) are now treated the same as block params and
exempted from restriction checks. Previously, block params were exempt but
JS-scope bindings were not, which was inconsistent -- both are local
bindings that the developer explicitly controls.
Uses sourceCode.getScope(node) to check whether a reference resolves to
an actual variable definition (ref.resolved != null), ensuring that
ambient/global names are still flagged.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>1 parent eac4005 commit 5234d16
2 files changed
Lines changed: 97 additions & 1 deletion
File tree
- lib/rules
- tests/lib/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
115 | 148 | | |
116 | 149 | | |
117 | 150 | | |
| |||
209 | 242 | | |
210 | 243 | | |
211 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
212 | 253 | | |
213 | 254 | | |
214 | 255 | | |
| |||
236 | 277 | | |
237 | 278 | | |
238 | 279 | | |
| 280 | + | |
239 | 281 | | |
240 | 282 | | |
241 | 283 | | |
| |||
264 | 306 | | |
265 | 307 | | |
266 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
267 | 312 | | |
268 | 313 | | |
269 | 314 | | |
| |||
278 | 323 | | |
279 | 324 | | |
280 | 325 | | |
281 | | - | |
| 326 | + | |
282 | 327 | | |
283 | 328 | | |
284 | 329 | | |
| |||
310 | 355 | | |
311 | 356 | | |
312 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
313 | 361 | | |
314 | 362 | | |
315 | 363 | | |
| |||
329 | 377 | | |
330 | 378 | | |
331 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
332 | 383 | | |
333 | 384 | | |
334 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
69 | 114 | | |
70 | 115 | | |
71 | 116 | | |
| |||
0 commit comments