Add new rule template-no-let-reference#1939
Conversation
lib/parsers/gjs-parser.js
Outdated
| } | ||
| const currentScope = findParentScope(scopeManager, nodePath); | ||
| if (!scope) { | ||
| return { scope: findParentScope(scopeManager, nodePath) }; |
There was a problem hiding this comment.
needed to fix the current scope, as the references should be added in the scope where the references are and not where the variable definition is
| } | ||
| } | ||
|
|
||
| if ('blockParams' in node) { |
There was a problem hiding this comment.
needed to move this down. this creates the scope for elementnodes and mustache blocks.
it should do this after creating the references, as otherwise the current scope would be the element or mustache block itself
lib/recommended-rules.js
Outdated
| "ember/use-ember-data-rfc-395-imports": "error" | ||
| } No newline at end of file | ||
| "ember/use-ember-data-rfc-395-imports": "error", | ||
| "ember/template-no-let-reference": "error" |
There was a problem hiding this comment.
The set of recommended rules should only be updated during a major release. If you like, we can enable it as recommended at that time.
ecd1507 to
d7e52d8
Compare
|
needs rebase it looks like |
d7e52d8 to
5ff6570
Compare
| } | ||
|
|
||
| export default <template>{{foo}}</template>; | ||
| ```` |
lib/recommended-rules.js
Outdated
| "ember/require-tagless-components": "error", | ||
| "ember/require-valid-css-selector-in-test-helpers": "error", | ||
| "ember/routes-segments-snake-case": "error", | ||
| "ember/template-no-let-reference": "error", |
There was a problem hiding this comment.
Can we have a separate PR to enable any rules as recommended? It's more clear what's going on then and will be better for the resulting changelog. Normally, we never create rules at the same time as enabling them as recommended.
5ff6570 to
b5ab4aa
Compare
b5ab4aa to
2d10fe0
Compare
template-no-let-reference
resolves #1897