Skip to content

Port 125 ember-template-lint rules for gjs/gts strict mode templates#2365

Closed
Copilot wants to merge 4 commits intomasterfrom
copilot/port-lint-rules-to-eslint-plugin
Closed

Port 125 ember-template-lint rules for gjs/gts strict mode templates#2365
Copilot wants to merge 4 commits intomasterfrom
copilot/port-lint-rules-to-eslint-plugin

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Ports all applicable ember-template-lint rules to work with gjs/gts files using ember-eslint-parser's Glimmer AST nodes. Rules are opt-in via new strict-gjs and strict-gts configurations.

Implementation

125 rules ported across categories:

  • Accessibility (24): ARIA validation, interactive elements, semantic HTML, landmark roles
  • Security (4): XSS prevention, link safety, debug statements
  • Deprecations (10): Deprecated helpers and component patterns
  • Best Practices (85): Component validation, argument handling, implicit-this enforcement
  • Style (2, off by default): Formatting rules

Technical approach:

  • Maps MustacheStatementGlimmerMustacheStatement, ElementNodeGlimmerElementNode, etc.
  • Distinguishes static vs dynamic attribute values
  • Context-aware autofixes (e.g., buttons in forms default to type="submit")
  • Follows ember-template-lint semantics closely

Excluded rules (not applicable to strict mode):

  • no-curly-component-invocation - curly component syntax invalid in gjs/gts
  • no-attrs-splat - ...attrs replaced by ...attributes in strict mode
  • no-index-component-invocation - loose mode only

Usage

// eslint.config.js
export default [
  {
    files: ['**/*.gts'],
    extends: ['plugin:ember/strict-gts'],
  },
  {
    files: ['**/*.gjs'],  
    extends: ['plugin:ember/strict-gjs'],
  },
];
// ❌ Fails
<template>{{title}}</template>
<template>{{{userContent}}}</template>

// ✅ Passes  
<template>{{this.title}}</template>
<template>{{this.sanitizedContent}}</template>

Structure

  • Rule implementations: lib/rules/template-*.js
  • Tests: tests/lib/rules/template-*.js
  • Documentation: docs/rules/template-*.md
  • Config generation: lib/strict-rules-{gjs,gts}.js

Non-breaking: existing recommended-gjs/gts configs unchanged, only include original template-no-let-reference rule.

Original prompt

Port all lint rules from https://github.com/ember-template-lint/ember-template-lint to eslint-plugin-ember, but only apply them to gjs/gts files.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Port lint rules from ember-template-lint to eslint-plugin-ember Add 6 ember-template-lint rules for gjs/gts files Jan 27, 2026
Copilot AI requested a review from NullVoxPopuli January 27, 2026 21:51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove this. we use pnpm.

Also, convert all the rules from template-lint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed package-lock.json and added to .gitignore in commit [will include hash].

Regarding converting all 127 rules: This is a substantial effort (estimated 2-3 months for complete implementation with proper testing and documentation). I'll implement as many high-priority rules as feasible. Currently working on batch implementation of the most critical rules including accessibility, deprecation warnings, and common best practices.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed package-lock.json in commit c321747.

Regarding all 127 rules: I've now implemented 10 rules (commit ae08bab) and continuing to batch-implement more. This is a substantial multi-week effort - implementing rules systematically by priority (security, accessibility, deprecations, then best practices). Currently at 10/127, targeting 20-30 in this session.

Copilot AI changed the title Add 6 ember-template-lint rules for gjs/gts files Add 14 ember-template-lint rules for gjs/gts files Jan 27, 2026
Copilot AI requested a review from NullVoxPopuli January 27, 2026 22:03
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting these in recommended should be safe, because they're in recommended in template-lint.

Copilot AI changed the title Add 14 ember-template-lint rules for gjs/gts files Port 29 ember-template-lint rules for gjs/gts template support Jan 27, 2026
Copilot AI requested a review from NullVoxPopuli January 27, 2026 22:36
Copilot AI changed the title Port 29 ember-template-lint rules for gjs/gts template support Update test snapshots for 29 template rules Jan 27, 2026
@NullVoxPopuli
Copy link
Contributor

@copilot fix the lints reported by ci

Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

@copilot fix the lints reported by ci

Fixed all linting issues in commit a578a8d. Changes include:

  • Fixed markdown formatting (blank lines around code blocks)
  • Added missing Config section to documentation
  • Removed mustache syntax from error messages
  • Applied prettier formatting
  • Added output assertions to all tests

All 3,693 tests passing and linting clean.

@NullVoxPopuli
Copy link
Contributor

@copilot tyty -- now proceed with porting over more lint rules from ember-template-lint

Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

@copilot tyty -- now proceed with porting over more lint rules from ember-template-lint

Continued porting rules. Added 6 more rules in commits 37326d0, 2d03b5a, and 8d97621:

Accessibility (4):

  • template-require-iframe-title
  • template-no-heading-inside-button
  • template-require-valid-alt-text
  • template-no-empty-headings

Best Practices (1):

  • template-splat-attributes-only

Deprecations (1):

  • template-no-attrs-in-components

Progress: 35/127 rules (28%) with 130 tests passing. Continuing systematic implementation focusing on high-priority rules.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/ember-template-lint/ember-template-lint/contents/lib/rules
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Update test snapshots for 29 template rules Port 35 ember-template-lint rules for gjs/gts files Jan 28, 2026
@NullVoxPopuli
Copy link
Contributor

@copilot move the changes to the existing recommended configs to a new config called strict only, which must be opt in.
We want this PR to be uncontroversially a non-breaking and opt-in set of work for consumers

Copilot AI changed the title Port all 127 ember-template-lint rules for gjs/gts files via strict configs Port all 127 ember-template-lint rules for gjs/gts strict mode templates Jan 29, 2026
Copilot AI changed the title Port all 127 ember-template-lint rules for gjs/gts strict mode templates Port 127 ember-template-lint rules for gjs/gts files Jan 29, 2026
Copilot AI changed the title Port 127 ember-template-lint rules for gjs/gts files Port 125 ember-template-lint rules for gjs/gts files via strict configs Jan 29, 2026
Copilot AI changed the title Port 125 ember-template-lint rules for gjs/gts files via strict configs Port 125 ember-template-lint rules for gjs/gts strict-mode templates Jan 29, 2026
Copilot AI changed the title Port 125 ember-template-lint rules for gjs/gts strict-mode templates Port ember-template-lint rules to gjs/gts via strict configs Jan 29, 2026
Copilot AI changed the title Port ember-template-lint rules to gjs/gts via strict configs Port 125 ember-template-lint rules for gjs/gts strict mode templates Jan 29, 2026
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review January 29, 2026 14:13
@NullVoxPopuli
Copy link
Contributor

Now to review it all and test it out

@NullVoxPopuli NullVoxPopuli force-pushed the copilot/port-lint-rules-to-eslint-plugin branch from 98e6376 to 66e687e Compare January 29, 2026 22:52
@NullVoxPopuli NullVoxPopuli force-pushed the copilot/port-lint-rules-to-eslint-plugin branch from d3d871b to 15d9f8d Compare January 31, 2026 19:12
@NullVoxPopuli
Copy link
Contributor

Replacing with my own branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments