Skip to content

feat: add (opt-in ember-template-lint parity) recommended-template config #2702

Open
johanrd wants to merge 5 commits intoember-cli:masterfrom
johanrd:feat/recommended-template-config
Open

feat: add (opt-in ember-template-lint parity) recommended-template config #2702
johanrd wants to merge 5 commits intoember-cli:masterfrom
johanrd:feat/recommended-template-config

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 13, 2026

Summary

Adds eslint-plugin-ember/configs/recommended-template — an opt-in flat config that enables the same ~94 template rules as ember-template-lint's recommended preset, making it straightforward to drop ember-template-lint and keep equivalent coverage.

import eslintPluginEmberRecommended from 'eslint-plugin-ember/configs/recommended';
import eslintPluginEmberRecommendedTemplate from 'eslint-plugin-ember/configs/recommended-template';

export default [
  ...eslintPluginEmberRecommended,
  ...eslintPluginEmberRecommendedTemplate,
  {
    rules: {
      // migrate overrides from .template-lintrc.*
      'ember/template-no-bare-strings': ['error', { allowlist: ['×'] }],
      'ember/template-no-inline-styles': 'off',
    },
  },
];

Why not part of recommended?

Template linting is a separate concern from Ember JS linting, and many projects will want to adopt it incrementally or tune individual rules (e.g. no-bare-strings allowlists, no-inline-styles) before committing to the full set. Keeping it opt-in avoids a breaking change and lets teams migrate at their own pace.

Why no gjs/gts overrides?

ember-template-lint's recommended config disables several rules for .gjs/.gts files (no-curly-component-invocation, no-implicit-this, builtin-component-arguments, no-builtin-form-components, no-unknown-arguments-for-builtin-components) because template-lint has no JS scope tracker and can't distinguish a JS-scoped binding from an implicit-this lookup inside <template>.

The ported rules in this plugin don't have that limitation:

  • no-implicit-this and no-curly-component-invocation walk ESLint's scope chain and skip any identifier that resolves to a JS binding (import, const, param, block param).
  • no-builtin-form-components explicitly checks filename.endsWith('.gjs/.gts') and only flags components imported from @ember/component.
  • no-unknown-arguments-for-builtin-components checks whether a tag is shadowed by a JS-scope variable before flagging.

Adding the overrides would suppress correct behaviour in gjs/gts, not fix a real problem.

@johanrd johanrd marked this pull request as draft April 13, 2026 19:56
johanrd added 3 commits April 14, 2026 01:22
…ecommended

Adds `eslint-plugin-ember/configs/recommended-template` — an opt-in flat
config that enables the same ~94 template rules as ember-template-lint's
recommended preset, making it easy to drop ember-template-lint and keep
equivalent coverage.

The config is intentionally not part of the main `recommended` export.
Template linting is a separate concern and many projects will want to
adopt it incrementally or tune individual rules (e.g. no-bare-strings
allowlists, no-inline-styles) before committing to the full set.

Unlike ember-template-lint's recommended.js, this config carries no
gjs/gts overrides. The original ETL overrides existed because template-
lint has no JS scope tracker and couldn't distinguish `{{foo}}` (a JS
binding) from `{{foo}}` (an implicit-this lookup). The ported rules in
this plugin walk ESLint's scope chain directly, so no-implicit-this and
no-curly-component-invocation already skip JS-scoped identifiers, and
no-builtin-form-components / no-unknown-arguments-for-builtin-components
explicitly check for imports in gjs/gts files. The overrides would only
suppress correct behaviour.
@johanrd johanrd force-pushed the feat/recommended-template-config branch from 88a6caf to 4f24085 Compare April 13, 2026 23:22
@johanrd johanrd marked this pull request as ready for review April 14, 2026 12:37
@johanrd johanrd changed the title feat: add recommended-template config (opt-in ember-template-lint parity) feat: add (opt-in ember-template-lint parity) recommended-template config Apr 14, 2026
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.

1 participant