Extract rule: template-require-strict-mode#2613
Extract rule: template-require-strict-mode#2613NullVoxPopuli wants to merge 1 commit intoember-cli:masterfrom
Conversation
NullVoxPopuli-ai-agent
left a comment
There was a problem hiding this comment.
Review: template-require-strict-mode (PR #2613)
Comparison with ember-template-lint source
General correctness:
-
Detection mechanism differs: The original ETL rule uses
this.isStrictModewhich is a property set by the ETL framework based on how the template was parsed. The ESLint version checks the file extension (filePath.endsWith('.hbs')). This is a reasonable approximation but has edge cases:- Files without extensions or with unusual extensions would not be flagged.
- The
templateMode: 'loose'in the meta should already restrict this rule to .hbs files via the parser, so the filename check may be redundant (or thetemplateModemay not be fully enforced yet). Worth verifying.
-
messagesis empty: The rule uses inlinemessageincontext.report()instead ofmessageId. Minor style inconsistency. -
Test gap: The hbs test suite has no invalid cases. The comment says
invalid: []for the hbs parser. This is odd — since this rule is specifically designed to flag .hbs files, the hbs parser tests should have invalid cases. However, it seems the hbs parser might not set filename context the same way, making it difficult to test. The gjs tests do include aninvalidcase withfilename: 'hello.hbs'which covers the core logic. -
templateMode: 'loose'correctness: SettingtemplateMode: 'loose'is correct since this rule only applies to loose-mode templates. However, the valid test for the gjs parser (filename: 'hello.gjs') will still run the rule visitor — it just won't trigger because the filename check prevents reporting. This is fine functionally.
Scope analysis (gjs/gts):
Not applicable. This rule checks file-level metadata (filename/mode), not template content.
Summary: Straightforward migration. The filename-based detection is a reasonable approach. No blocking issues.
🤖 Automated review comparing with ember-template-lint source
Split from #2371.