Skip to content

Commit 726ec0b

Browse files
wagenetclaude
andcommitted
Fix CI lint failures and remove rule from recommended configs
- Remove `require('ts-api-utils')` and `require('typescript')` (not declared deps); inline TS_ALIAS_FLAG constant and displayPartsToString logic - Remove `recommendedGts: true` and `requiresTypeChecking` from meta (breaking change, per review; fixes meta-property-ordering lint error) - Fix `eqeqeq`: use `!== undefined` instead of `!= null` - Fix `no-param-reassign`: use `current` variable instead of reassigning `symbol` param - Add `output: null` to invalid test cases (consistent-output lint rule) - Regenerate config files and docs (rule no longer in recommended configs) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent a80c119 commit 726ec0b

6 files changed

Lines changed: 27 additions & 26 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ rules in templates can be disabled with eslint directives with mustache or html
291291
| [no-empty-glimmer-component-classes](docs/rules/no-empty-glimmer-component-classes.md) | disallow empty backing classes for Glimmer components || | |
292292
| [no-tracked-properties-from-args](docs/rules/no-tracked-properties-from-args.md) | disallow creating @tracked properties from this.args || | |
293293
| [template-indent](docs/rules/template-indent.md) | enforce consistent indentation for gts/gjs templates | | 🔧 | |
294-
| [template-no-deprecated](docs/rules/template-no-deprecated.md) | disallow using deprecated Glimmer components, helpers, and modifiers in templates | ![gts logo](/docs/svgs/gts.svg) | | |
294+
| [template-no-deprecated](docs/rules/template-no-deprecated.md) | disallow using deprecated Glimmer components, helpers, and modifiers in templates | | | |
295295
| [template-no-let-reference](docs/rules/template-no-let-reference.md) | disallow referencing let variables in \<template\> | ![gjs logo](/docs/svgs/gjs.svg) ![gts logo](/docs/svgs/gts.svg) | | |
296296

297297
### jQuery

docs/rules/template-no-deprecated.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# ember/template-no-deprecated
22

3-
💼 This rule is enabled in the ![gts logo](/docs/svgs/gts.svg) `recommended-gts` [config](https://github.com/ember-cli/eslint-plugin-ember#-configurations).
4-
53
<!-- end auto-generated rule header -->
64

75
Disallows using Glimmer components, helpers, or modifiers that are marked `@deprecated` in their JSDoc.
@@ -14,12 +12,12 @@ The rule resolves template references through ESLint's scope analysis: a `<Compo
1412

1513
**Covered syntax:**
1614

17-
| Template syntax | Example |
18-
|---|---|
19-
| Component element | `<DeprecatedComponent />` |
20-
| Helper / value mustache | `{{deprecatedHelper}}` |
21-
| Block component | `{{#DeprecatedBlock}}…{{/DeprecatedBlock}}` |
22-
| Modifier | `<div {{deprecatedModifier}}>` |
15+
| Template syntax | Example |
16+
| ----------------------- | ------------------------------------------- |
17+
| Component element | `<DeprecatedComponent />` |
18+
| Helper / value mustache | `{{deprecatedHelper}}` |
19+
| Block component | `{{#DeprecatedBlock}}…{{/DeprecatedBlock}}` |
20+
| Modifier | `<div {{deprecatedModifier}}>` |
2321

2422
**Not covered (see future work):** `<MyComp @deprecatedArg={{x}}>` — argument names are not scope-registered by the parser.
2523

lib/recommended-rules-gjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
* definitions, execute "npm run update"
66
*/
77
module.exports = {
8-
"ember/template-no-let-reference": "error"
8+
'ember/template-no-let-reference': 'error',
99
};

lib/recommended-rules-gts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
* definitions, execute "npm run update"
66
*/
77
module.exports = {
8-
"ember/template-no-deprecated": "error",
9-
"ember/template-no-let-reference": "error"
8+
'ember/template-no-let-reference': 'error',
109
};

lib/rules/template-no-deprecated.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const tsutils = require('ts-api-utils');
4-
const ts = require('typescript');
3+
// ts.SymbolFlags.Alias = 2097152 (1 << 21) — stable across all TypeScript versions
4+
const TS_ALIAS_FLAG = 2_097_152;
55

66
/** @type {import('eslint').Rule.RuleModule} */
77
module.exports = {
@@ -11,10 +11,8 @@ module.exports = {
1111
description:
1212
'disallow using deprecated Glimmer components, helpers, and modifiers in templates',
1313
category: 'Ember Octane',
14-
recommendedGts: true,
1514
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/template-no-deprecated.md',
1615
},
17-
requiresTypeChecking: true,
1816
schema: [],
1917
messages: {
2018
deprecated: '`{{name}}` is deprecated.',
@@ -44,27 +42,30 @@ module.exports = {
4442
return undefined;
4543
}
4644
const displayParts = tag.text;
47-
return displayParts ? ts.displayPartsToString(displayParts) : '';
45+
return displayParts ? displayParts.map((p) => p.text).join('') : '';
4846
}
4947

5048
function searchForDeprecationInAliasesChain(symbol, checkAliasedSymbol) {
51-
if (!symbol || !tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
49+
// eslint-disable-next-line no-bitwise
50+
if (!symbol || !(symbol.flags & TS_ALIAS_FLAG)) {
5251
return checkAliasedSymbol ? getJsDocDeprecation(symbol) : undefined;
5352
}
5453
const targetSymbol = checker.getAliasedSymbol(symbol);
55-
while (tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
56-
const reason = getJsDocDeprecation(symbol);
57-
if (reason != null) {
54+
let current = symbol;
55+
// eslint-disable-next-line no-bitwise
56+
while (current.flags & TS_ALIAS_FLAG) {
57+
const reason = getJsDocDeprecation(current);
58+
if (reason !== undefined) {
5859
return reason;
5960
}
6061
const immediateAliasedSymbol =
61-
symbol.getDeclarations() && checker.getImmediateAliasedSymbol(symbol);
62+
current.getDeclarations() && checker.getImmediateAliasedSymbol(current);
6263
if (!immediateAliasedSymbol) {
6364
break;
6465
}
65-
symbol = immediateAliasedSymbol;
66-
if (checkAliasedSymbol && symbol === targetSymbol) {
67-
return getJsDocDeprecation(symbol);
66+
current = immediateAliasedSymbol;
67+
if (checkAliasedSymbol && current === targetSymbol) {
68+
return getJsDocDeprecation(current);
6869
}
6970
}
7071
return undefined;
@@ -92,7 +93,7 @@ module.exports = {
9293
}
9394

9495
const reason = searchForDeprecationInAliasesChain(symbol, true);
95-
if (reason == null) {
96+
if (reason === undefined) {
9697
return;
9798
}
9899

tests/lib/rules/template-no-deprecated.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ ruleTesterTyped.run('template-no-deprecated (with TS project)', rule, {
8585
import DeprecatedComponent from './deprecated-component';
8686
<template><DeprecatedComponent /></template>
8787
`,
88+
output: null,
8889
errors: [{ messageId: 'deprecatedWithReason', type: 'GlimmerElementNodePart' }],
8990
},
9091
// Deprecated helper in mustache position
@@ -94,6 +95,7 @@ ruleTesterTyped.run('template-no-deprecated (with TS project)', rule, {
9495
import { deprecatedHelper } from './deprecated-helper';
9596
<template>{{deprecatedHelper}}</template>
9697
`,
98+
output: null,
9799
errors: [{ messageId: 'deprecated', type: 'VarHead' }],
98100
},
99101
// Deprecated component in block position
@@ -103,6 +105,7 @@ ruleTesterTyped.run('template-no-deprecated (with TS project)', rule, {
103105
import DeprecatedComponent from './deprecated-component';
104106
<template>{{#DeprecatedComponent}}{{/DeprecatedComponent}}</template>
105107
`,
108+
output: null,
106109
errors: [{ messageId: 'deprecatedWithReason', type: 'VarHead' }],
107110
},
108111
],

0 commit comments

Comments
 (0)