Skip to content

Add ember/no-deprecated-imports rule - #2855

Merged
NullVoxPopuli merged 3 commits into
masterfrom
nvp/no-deprecated-imports
Oct 23, 2026
Merged

NullVoxPopuli merged 3 commits into
masterfrom
nvp/no-deprecated-imports

Conversation

@NullVoxPopuli

@NullVoxPopuli NullVoxPopuli commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

New rule ember/no-deprecated-imports flags imports of APIs that ember-source has deprecated or is about to deprecate.

By default it reports every deprecation on the list, including ones ember-source hasn't shipped yet. These APIs have had better replacements for a long time, so new code shouldn't use them regardless of Ember version.

'ember/no-deprecated-imports': ['error', {
  reportAll: true, // default. false: only report what the installed ember-source has reached
  imports: {
    '@ember/object/computed': { report: false }, // silence
    '@ember/array': { report: true },            // with reportAll: false, opt in early
  },
}]

How a deprecation gets reported:

  1. A per-path report wins over everything else.
  2. Otherwise, with reportAll: true (the default), everything is reported and ember-source is never looked up.
  3. With reportAll: false, it is reported once the installed ember-source reaches the deprecation's since.enabled version, or since.available when it is not enabled yet. Prereleases count, so 7.4.0-beta.1 is 7.4. If ember-source can't be found, only per-path report: true entries are reported.

The data is in lib/utils/deprecated-imports.js: 24 entries over 17 import paths, from inject in @ember/service (6.3) and import Ember from 'ember' (6.5) through the 7.4 and 7.5 work (mixins, Evented, proxies, @ember/utils, computed macros, @ember/array, Observable, Enumerable, ControllerMixin, the @ember/component and @ember/object default exports). Versions and ids follow the ember-source deprecation registry. Each entry has a status (released, merged, pr, draft). All entries are in a published ember-source prerelease except two from draft ember.js PRs: #21630 (@ember/component) and #21674 (@ember/object).

It reports per imported name, so computed from @ember/object/computed is fine while alias is not. It also checks import type and export ... from. Namespace imports and export * are only reported when the whole module is deprecated.

Things reviewers may want to weigh in on:

  • Evented is gated on 7.4. The registry says available 7.3.0, but it first shipped in 7.4.0-alpha.2.
  • ember uses the umbrella id deprecate-import-ember-from-ember (deprecation-app build(deps-dev): bump prettier from 2.4.1 to 2.5.0 #1383). ember-source registers one id per Ember.* member.
  • Only the default export of @ember/object is listed. Whether computed/get/set will be deprecated is not settled in #21674.
  • The registry sets until: 7.9.0 for Enumerable, MutableEnumerable and ControllerMixin, which might be a typo for 8.0.0. The data copies the registry.
  • Proxies and the @ember/component default overlap with no-proxies and no-classic-components. Paths already covered by no-tracked-built-ins and no-legacy-helper-imports are left out.

With reportAll: false, the version comes from settings.ember.version (#2859) when set, otherwise from the installed ember-source. lib/utils/ember-source-version.js now also exports isVersionAtLeast.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🏎️ Benchmark Comparison

Benchmark Control (p50) Experiment (p50) Δ
🟢 js small 11.18 ms 10.92 ms -2.3%
⚪ js medium 5.31 ms 5.33 ms +0.4%
🟢 js large 2.12 ms 2.08 ms -2.1%
⚪ gjs small 879.61 µs 870.45 µs -1.0%
⚪ gjs medium 440.26 µs 441.25 µs +0.2%
⚪ gjs large 174.77 µs 173.91 µs -0.5%
⚪ gts small 878.32 µs 874.72 µs -0.4%
⚪ gts medium 440.14 µs 437.82 µs -0.5%
⚪ gts large 175.09 µs 174.03 µs -0.6%

🟢 faster · 🔴 slower · 🟠 slightly slower · ⚪ within 2%

Full mitata output
clk: ~3.47 GHz
cpu: AMD EPYC 9V74 80-Core Processor
runtime: node 24.21.0 (x64-linux)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
js small (control)            13.17 ms/iter  14.18 ms █▃▆                  
                       (9.35 ms … 26.83 ms)  26.40 ms ███  ▂               
                    (  6.15 mb …  10.42 mb)   7.22 mb ███▃███▆▁▃▃▃▃▁▆▁▃▁▁▁▃

js small (experiment)         11.64 ms/iter  12.57 ms ▅█▅      ▂           
                       (9.85 ms … 15.96 ms)  15.60 ms ███▂▅    █  ▂        
                    (  6.61 mb …   7.99 mb)   6.88 mb █████▇▇▄▁█▄▇█▄▁▄▄▄▄▄▄

                             ┌                                            ┐
                             ╷┌────────┬──┐                               ╷
          js small (control) ├┤        │  ├───────────────────────────────┤
                             ╵└────────┴──┘                               ╵
                              ╷┌───┬─┐        ╷
       js small (experiment)  ├┤   │ ├────────┤
                              ╵└───┴─┘        ╵
                             └                                            ┘
                             9.35 ms           17.87 ms            26.40 ms

summary
  js small (experiment)
   1.13x faster than js small (control)

------------------------------------------- -------------------------------
js medium (control)            5.83 ms/iter   5.98 ms  █                   
                       (4.95 ms … 10.23 ms)   9.79 ms ▃█                   
                    (  2.94 mb …   4.52 mb)   3.55 mb ███▇▃▄▁▅▂▂▂▁▂▃▂▁▁▂▁▂▂

js medium (experiment)         5.97 ms/iter   5.85 ms   █                  
                       (4.54 ms … 14.78 ms)  12.14 ms   █                  
                    (  1.16 mb …   5.93 mb)   3.52 mb █▆██▃▄▅▁▂▂▂▂▁▁▁▂▁▂▂▁▂

                             ┌                                            ┐
                               ╷┌────┬┐                     ╷
         js medium (control)   ├┤    │├─────────────────────┤
                               ╵└────┴┘                     ╵
                             ╷   ┌───┬                                    ╷
      js medium (experiment) ├───┤   │────────────────────────────────────┤
                             ╵   └───┴                                    ╵
                             └                                            ┘
                             4.54 ms            8.34 ms            12.14 ms

summary
  js medium (control)
   1.03x faster than js medium (experiment)

------------------------------------------- -------------------------------
js large (control)             2.35 ms/iter   2.23 ms  █                   
                        (1.96 ms … 5.76 ms)   4.96 ms ▇█                   
                    (188.59 kb …   2.72 mb)   1.44 mb ███▂▂▃▂▂▂▂▂▂▂▁▁▁▁▁▁▂▁

js large (experiment)          2.28 ms/iter   2.16 ms ▃█                   
                        (1.92 ms … 7.48 ms)   5.11 ms ██                   
                    (301.61 kb …   2.91 mb)   1.44 mb ██▆▂▂▂▂▂▂▂▂▂▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                              ╷┌───┬                                    ╷
          js large (control)  ├┤   │────────────────────────────────────┤
                              ╵└───┴                                    ╵
                             ╷┌───┬                                       ╷
       js large (experiment) ├┤   │───────────────────────────────────────┤
                             ╵└───┴                                       ╵
                             └                                            ┘
                             1.92 ms            3.52 ms             5.11 ms

summary
  js large (experiment)
   1.03x faster than js large (control)

------------------------------------------- -------------------------------
gjs small (control)          978.08 µs/iter 890.10 µs █                    
                      (854.59 µs … 6.69 ms)   5.20 ms █                    
                    (476.37 kb …   1.67 mb)   1.05 mb █▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gjs small (experiment)       974.43 µs/iter 881.84 µs █                    
                      (849.30 µs … 6.17 ms)   5.18 ms █                    
                    (191.40 kb …   1.94 mb)   1.05 mb █▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌┬                                           ╷
         gjs small (control) ││───────────────────────────────────────────┤
                             └┴                                           ╵
                             ┌┬                                           ╷
      gjs small (experiment) ││───────────────────────────────────────────┤
                             └┴                                           ╵
                             └                                            ┘
                             849.30 µs           3.03 ms            5.20 ms

summary
  gjs small (experiment)
   1x faster than gjs small (control)

------------------------------------------- -------------------------------
gjs medium (control)         486.32 µs/iter 446.82 µs █                    
                      (425.22 µs … 5.51 ms)   1.63 ms █                    
                    (508.37 kb …   1.34 mb) 542.20 kb █▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gjs medium (experiment)      501.77 µs/iter 447.87 µs █                    
                      (427.21 µs … 5.20 ms)   2.18 ms █                    
                    (195.98 kb …   1.56 mb) 541.00 kb █▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌─┬                            ╷
        gjs medium (control) │ │────────────────────────────┤
                             └─┴                            ╵
                             ┌─┬                                          ╷
     gjs medium (experiment) │ │──────────────────────────────────────────┤
                             └─┴                                          ╵
                             └                                            ┘
                             425.22 µs           1.30 ms            2.18 ms

summary
  gjs medium (control)
   1.03x faster than gjs medium (experiment)

------------------------------------------- -------------------------------
gjs large (control)          194.53 µs/iter 178.73 µs   █                  
                      (168.85 µs … 5.12 ms) 224.98 µs  ██▃                 
                    ( 18.51 kb …   1.37 mb) 216.74 kb ▂███▄▆▅▂▂▂▁▁▁▁▁▁▁▁▁▁▁

gjs large (experiment)       191.93 µs/iter 177.18 µs   █                  
                      (168.12 µs … 4.92 ms) 215.70 µs  ███                 
                    (170.20 kb …   1.37 mb) 216.35 kb ▂███▆▄▆▅▃▂▂▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                              ╷  ┌────────────────┬                       ╷
         gjs large (control)  ├──┤                │───────────────────────┤
                              ╵  └────────────────┴                       ╵
                             ╷  ┌───────────────┬                  ╷
      gjs large (experiment) ├──┤               │──────────────────┤
                             ╵  └───────────────┴                  ╵
                             └                                            ┘
                             168.12 µs         196.55 µs          224.98 µs

summary
  gjs large (experiment)
   1.01x faster than gjs large (control)

------------------------------------------- -------------------------------
gts small (control)          974.50 µs/iter 888.17 µs █                    
                      (853.44 µs … 5.82 ms)   5.18 ms █                    
                    (  1.02 mb …   2.18 mb)   1.06 mb █▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gts small (experiment)       955.07 µs/iter 883.94 µs █                    
                      (854.62 µs … 5.96 ms)   5.08 ms █                    
                    (755.83 kb …   2.15 mb)   1.06 mb █▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌┬                                           ╷
         gts small (control) ││───────────────────────────────────────────┤
                             └┴                                           ╵
                             ┌┬                                          ╷
      gts small (experiment) ││──────────────────────────────────────────┤
                             └┴                                          ╵
                             └                                            ┘
                             853.44 µs           3.02 ms            5.18 ms

summary
  gts small (experiment)
   1.02x faster than gts small (control)

------------------------------------------- -------------------------------
gts medium (control)         480.92 µs/iter 445.69 µs  █                   
                      (426.01 µs … 5.35 ms) 868.51 µs ██                   
                    (540.28 kb …   1.31 mb) 541.38 kb ██▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gts medium (experiment)      484.89 µs/iter 443.72 µs █                    
                      (423.82 µs … 5.35 ms)   1.12 ms █▃                   
                    ( 33.72 kb …   1.04 mb) 539.83 kb ██▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌──┬                        ╷
        gts medium (control) ├┤  │────────────────────────┤
                             ╵└──┴                        ╵
                             ┌───┬                                        ╷
     gts medium (experiment) │   │────────────────────────────────────────┤
                             └───┴                                        ╵
                             └                                            ┘
                             423.82 µs          774.40 µs           1.12 ms

summary
  gts medium (control)
   1.01x faster than gts medium (experiment)

------------------------------------------- -------------------------------
gts large (control)          194.31 µs/iter 178.56 µs  ▂█                  
                      (168.62 µs … 5.01 ms) 235.78 µs  ██                  
                    (216.09 kb …   1.37 mb) 216.95 kb ▂██▇▅▅▃▂▂▂▁▁▁▁▁▁▁▁▁▁▁

gts large (experiment)       193.77 µs/iter 176.84 µs   █                  
                      (168.39 µs … 4.95 ms) 223.19 µs  ██                  
                    (170.17 kb …   1.37 mb) 216.62 kb ▂███▃▅▄▂▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷  ┌─────────────┬                           ╷
         gts large (control) ├──┤             │───────────────────────────┤
                             ╵  └─────────────┴                           ╵
                             ╷  ┌─────────────┬                   ╷
      gts large (experiment) ├──┤             │───────────────────┤
                             ╵  └─────────────┴                   ╵
                             └                                            ┘
                             168.39 µs         202.08 µs          235.78 µs

summary
  gts large (experiment)
   1x faster than gts large (control)

@gitKrystan

Copy link
Copy Markdown
Contributor

Curious about the logic behind this decision:

Namespace imports and export * are only reported when the whole module is deprecated.

Though we could probably merge this as is and add support for that later.

@gitKrystan

Copy link
Copy Markdown
Contributor

It also checks import type

Can we make this opt-out?

My thought is that during a TypeScript conversion of a large codebase I'd rather not have to be disabling no-deprecated all over the place. I'd rather:

  1. do the TS conversion, not having to slow down to disable the rule for type-only imports
  2. fix all of the ember/no-deprecated-imports for non-type imports
  3. remove the opt-out and fix the types (which should be roughly possible to do without behavior changes in a fully TS codebase if all of the non-type imports are removed).

Thoughts?

@NullVoxPopuli

Copy link
Copy Markdown
Contributor Author

Curious about the logic behind this decision:

Namespace imports and export * are only reported when the whole module is deprecated.

Though we could probably merge this as is and add support for that later.

if someone were to

export * as whatever from '@ember/array/proxy'

that is fully deprecated -- whereas

export * as whatever from '@ember/component';

is not

@NullVoxPopuli

Copy link
Copy Markdown
Contributor Author

It also checks import type

Can we make this opt-out?

My thought is that during a TypeScript conversion of a large codebase I'd rather not have to be disabling no-deprecated all over the place. I'd rather:

  1. do the TS conversion, not having to slow down to disable the rule for type-only imports
  2. fix all of the ember/no-deprecated-imports for non-type imports
  3. remove the opt-out and fix the types (which should be roughly possible to do without behavior changes in a fully TS codebase if all of the non-type imports are removed).

Thoughts?

I don't agree with having an opt out for type-only ~
its hiding debt that comes from elsewhere that needs dealt with

Comment thread docs/rules/no-deprecated-imports.md Outdated
Comment on lines +30 to +41
| 7.5 | `@ember/object/computed` | `collect`, `filter`, `filterBy`, `intersect`, `map`, `mapBy`, `max`, `min`, `setDiff`, `sort`, `sum`, `union`, `uniq`, `uniqBy` | `deprecate-array-computed-macros` | open PR |
| 7.5 | `@ember/array` | `A` | `deprecate-ember-array-a` | open PR |
| 7.5 | `@ember/array` | default (`EmberArray`) | `deprecate-ember-array-mixin` | open PR |
| 7.5 | `@ember/array` | `MutableArray` | `deprecate-mutable-array-mixin` | open PR |
| 7.5 | `@ember/array/mutable` | default (`MutableArray`) | `deprecate-mutable-array-mixin` | open PR |
| 7.5 | `@ember/array` | `NativeArray` | `deprecate-native-array-mixin` | open PR |
| 7.5 | `@ember/object/observable` | default (`Observable`) | `deprecate-observable-mixin` | open PR |
| 7.5 | `@ember/enumerable` | default (`Enumerable`) | `deprecate-enumerable-mixin` | open PR |
| 7.5 | `@ember/enumerable/mutable` | default (`MutableEnumerable`) | `deprecate-mutable-enumerable-mixin` | open PR |
| 7.5 | `@ember/controller` | `ControllerMixin` | `deprecate-controller-mixin` | open PR |
| 7.5 | `@ember/component` | default (`Component`) | `ember-component` | draft PR |
| 7.5 | `@ember/object` | default (`EmberObject`) | `deprecate-ember-object` | draft PR |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't checked all of these but the first few I did check have been merged since this table (and the data) was compiled. Just need to make sure this is accurate before merging I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, you were right. I checked each row against the ember.js PRs and the published ember-source prereleases, and updated the data and this table.

Everything except the last two rows is now in a published prerelease, so those rows say released. deprecate-ember-utils is in 7.5.0-alpha.4. The rest of the 7.5 rows are in 7.5.0-alpha.5. The versions, ids and until values all match the registry on main, including until: 7.9.0 for Enumerable, MutableEnumerable and ControllerMixin.

Implementations:

Deprecation id ember.js PR State
importing-inject-from-ember-service #20526, enabled in #20820 merged
deprecate-import-ember-from-ember #20686 merged
deprecate-evented #21542 merged
deprecate-mixins #21577 merged
deprecate-array-proxy, deprecate-object-proxy #21579 merged
deprecate-promise-proxy-mixin, deprecate-observable-mixin, deprecate-enumerable-mixin, deprecate-mutable-enumerable-mixin, deprecate-ember-array-mixin, deprecate-mutable-array-mixin, deprecate-native-array-mixin, deprecate-controller-mixin #21588 merged
deprecate-ember-utils #21632 merged
deprecate-computed-macros #21688 merged
deprecate-ember-array-a, deprecate-array-computed-macros #21687 merged
ember-component #21630 draft
deprecate-ember-object #21674 draft

The registry on main also has ids for ActionHandler, ProxyMixin, ContainerProxyMixin, RegistryProxyMixin, Comparable and TargetActionSupport. I left them out because they only come from private @ember/-internals/* modules, so there is no public import path to lint.

I also rebased onto master. The rule now reads settings.ember.version from #2859 when reportAll: false, like the other version-gated rules.

NullVoxPopuli and others added 3 commits October 23, 2026 13:41
Flags imports of APIs deprecated in ember-source, gated on the installed
ember-source version. `reportAll: true` opts in to upcoming deprecations,
and `imports: { '<path>': { report: true|false } }` overrides per path.
Does nothing when ember-source is not found, unless something opts in.

The deprecation data lives in lib/utils/deprecated-imports.js and covers
6.3 through 7.5, including deprecations from open and draft ember.js PRs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The APIs on the list have had better replacements for a long time, so new
code shouldn't use them even before ember-source ships the deprecation.
Version gating is now opt-in with `reportAll: false`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rsion

ember.js #21588 and #21687 merged and, with #21632 and #21688, are in
ember-source 7.5.0-alpha.4 and 7.5.0-alpha.5. Only the Component and
EmberObject entries are still draft PRs.

Use getEmberSourceVersionForContext so `settings.ember.version` works
with `reportAll: false`, like the other version-gated rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NullVoxPopuli
NullVoxPopuli force-pushed the nvp/no-deprecated-imports branch from 1cb6382 to 31ec8d4 Compare October 23, 2026 17:48
@NullVoxPopuli
NullVoxPopuli merged commit 8a02d08 into master Oct 23, 2026
10 checks passed
@NullVoxPopuli
NullVoxPopuli deleted the nvp/no-deprecated-imports branch October 23, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants