Skip to content

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

Open
NullVoxPopuli wants to merge 2 commits into
masterfrom
nvp/no-deprecated-imports
Open

NullVoxPopuli wants to merge 2 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), because several come from ember.js PRs that are not merged yet: #21588, #21687, #21630 and #21674.

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.
  • #21588 sets until: 7.9.0 for Enumerable, MutableEnumerable and ControllerMixin, which might be a typo for 8.0.0. The data copies the PR.
  • 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.

lib/utils/ember-source-version.js now also exports getEmberSourceVersion and isVersionAtLeast.

🤖 Generated with Claude Code

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>
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🏎️ Benchmark Comparison

Benchmark Control (p50) Experiment (p50) Δ
⚪ js small 15.12 ms 15.19 ms +0.4%
🔴 js medium 7.62 ms 8.22 ms +7.9%
⚪ js large 3.19 ms 3.16 ms -1.2%
⚪ gjs small 1.29 ms 1.28 ms -1.4%
🟢 gjs medium 643.60 µs 627.30 µs -2.5%
⚪ gjs large 254.48 µs 252.40 µs -0.8%
⚪ gts small 1.26 ms 1.26 ms -0.6%
⚪ gts medium 627.50 µs 626.08 µs -0.2%
⚪ gts large 251.84 µs 250.36 µs -0.6%

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

Full mitata output
clk: ~3.10 GHz
cpu: AMD EPYC 7763 64-Core Processor
runtime: node 24.21.0 (x64-linux)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
js small (control)            18.19 ms/iter  19.22 ms █ ▂                  
                      (13.30 ms … 33.86 ms)  28.59 ms █▂█    ▅            ▂
                    (  5.45 mb …  10.20 mb)   7.31 mb ███▄▁▇▁█▄▄▁▄▄▁▁▄▁▁▁▄█

js small (experiment)         16.04 ms/iter  16.65 ms  ▅█                  
                      (14.02 ms … 23.47 ms)  22.87 ms ███▃█  ▃             
                    (  6.80 mb …   8.43 mb)   6.90 mb █████▄▄██▄▁▄▁▁▁▁▄▁▁▁▄

                             ┌                                            ┐
                             ╷ ┌───────────┬──┐                           ╷
          js small (control) ├─┤           │  ├───────────────────────────┤
                             ╵ └───────────┴──┘                           ╵
                               ╷ ┌───┬─┐                 ╷
       js small (experiment)   ├─┤   │ ├─────────────────┤
                               ╵ └───┴─┘                 ╵
                             └                                            ┘
                             13.30 ms           20.95 ms           28.59 ms

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

------------------------------------------- -------------------------------
js medium (control)            8.45 ms/iter   8.46 ms  █                   
                       (7.19 ms … 15.47 ms)  15.35 ms ▅█                   
                    (  2.44 mb …   4.63 mb)   3.56 mb ██▄▅▂▃▂▂▁▂▃▂▂▂▁▁▁▁▁▂▂

js medium (experiment)         8.69 ms/iter   8.91 ms ▆▃█ ▅                
                       (7.27 ms … 16.96 ms)  14.87 ms ███▆█                
                    (  2.52 mb …   4.51 mb)   3.55 mb ██████▄▁▃▆▁▁▁▃▃▁▃▁▁▁▃

                             ┌                                            ┐
                             ╷┌─────┬                                     ╷
         js medium (control) ├┤     │─────────────────────────────────────┤
                             ╵└─────┴                                     ╵
                             ╷ ┌─────┬┐                                ╷
      js medium (experiment) ├─┤     │├────────────────────────────────┤
                             ╵ └─────┴┘                                ╵
                             └                                            ┘
                             7.19 ms           11.27 ms            15.35 ms

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

------------------------------------------- -------------------------------
js large (control)             3.60 ms/iter   3.85 ms  █                   
                        (2.92 ms … 8.46 ms)   6.84 ms ▃█                   
                    (226.98 kb …   2.68 mb)   1.44 mb ██▆▄▆▆▃▄▂▁▁▂▁▁▂▁▂▂▁▂▁

js large (experiment)          3.71 ms/iter   3.80 ms █                    
                       (2.74 ms … 10.92 ms)   9.45 ms █▆ ▂                 
                    (412.69 kb …   3.67 mb)   1.48 mb ████▄▂▃▂▂▁▂▁▁▁▂▂▁▁▁▁▁

                             ┌                                            ┐
                              ╷┌───┬┐                   ╷
          js large (control)  ├┤   │├───────────────────┤
                              ╵└───┴┘                   ╵
                             ╷┌─────┬                                     ╷
       js large (experiment) ├┤     │─────────────────────────────────────┤
                             ╵└─────┴                                     ╵
                             └                                            ┘
                             2.74 ms            6.09 ms             9.45 ms

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

------------------------------------------- -------------------------------
gjs small (control)            1.43 ms/iter   1.38 ms █                    
                        (1.22 ms … 6.89 ms)   5.38 ms █▅                   
                    (322.67 kb …   1.82 mb)   1.06 mb ██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gjs small (experiment)         1.39 ms/iter   1.32 ms █                    
                        (1.22 ms … 5.60 ms)   5.00 ms █                    
                    (570.27 kb …   1.59 mb)   1.06 mb ██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌─┬                                          ╷
         gjs small (control) │ │──────────────────────────────────────────┤
                             └─┴                                          ╵
                             ┌─┬                                      ╷
      gjs small (experiment) │ │──────────────────────────────────────┤
                             └─┴                                      ╵
                             └                                            ┘
                             1.22 ms            3.30 ms             5.38 ms

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

------------------------------------------- -------------------------------
gjs medium (control)         700.53 µs/iter 662.65 µs █                    
                      (602.83 µs … 5.65 ms)   3.31 ms █                    
                    (106.95 kb …   1.09 mb) 541.14 kb █▅▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gjs medium (experiment)      698.25 µs/iter 647.87 µs ▆█                   
                      (590.39 µs … 4.88 ms)   1.90 ms ██                   
                    ( 78.63 kb …   1.00 mb) 541.22 kb ██▃▁▁▁▁▁▁▁▂▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌┬                                          ╷
        gjs medium (control) ├┤│──────────────────────────────────────────┤
                             ╵└┴                                          ╵
                             ┌─┬                   ╷
     gjs medium (experiment) │ │───────────────────┤
                             └─┴                   ╵
                             └                                            ┘
                             590.39 µs           1.95 ms            3.31 ms

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

------------------------------------------- -------------------------------
gjs large (control)          280.23 µs/iter 270.48 µs  █▅                  
                      (241.45 µs … 4.99 ms) 381.26 µs  ██                  
                    (216.10 kb … 808.82 kb) 217.43 kb ███▆██▅▃▂▂▁▁▁▁▁▁▁▁▁▁▁

gjs large (experiment)       276.71 µs/iter 267.82 µs  █▅                  
                      (240.01 µs … 5.29 ms) 375.94 µs  ██                  
                    (186.38 kb …   1.10 mb) 216.90 kb ▇██▅█▇▅▃▂▂▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷ ┌──────────┬                               ╷
         gjs large (control) ├─┤          │───────────────────────────────┤
                             ╵ └──────────┴                               ╵
                             ╷ ┌─────────┬                              ╷
      gjs large (experiment) ├─┤         │──────────────────────────────┤
                             ╵ └─────────┴                              ╵
                             └                                            ┘
                             240.01 µs         310.64 µs          381.26 µs

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

------------------------------------------- -------------------------------
gts small (control)            1.38 ms/iter   1.29 ms █                    
                        (1.22 ms … 6.09 ms)   5.19 ms █                    
                    (222.05 kb …   1.94 mb)   1.06 mb █▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gts small (experiment)         1.34 ms/iter   1.28 ms █                    
                        (1.22 ms … 5.68 ms)   4.49 ms █                    
                    (434.81 kb …   1.69 mb)   1.05 mb █▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌─┬                                          ╷
         gts small (control) │ │──────────────────────────────────────────┤
                             └─┴                                          ╵
                             ┌┬                                   ╷
      gts small (experiment) ││───────────────────────────────────┤
                             └┴                                   ╵
                             └                                            ┘
                             1.22 ms            3.20 ms             5.19 ms

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

------------------------------------------- -------------------------------
gts medium (control)         667.44 µs/iter 641.54 µs  █                   
                      (595.01 µs … 4.88 ms)   1.42 ms ▂█                   
                    (293.40 kb …   1.08 mb) 541.81 kb ██▄▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gts medium (experiment)      672.81 µs/iter 641.12 µs  █                   
                      (593.38 µs … 5.06 ms)   1.57 ms ▄█                   
                    (149.05 kb …   1.26 mb) 540.94 kb ██▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌─┬                                  ╷
        gts medium (control) ├┤ │──────────────────────────────────┤
                             ╵└─┴                                  ╵
                             ╷┌──┬                                        ╷
     gts medium (experiment) ├┤  │────────────────────────────────────────┤
                             ╵└──┴                                        ╵
                             └                                            ┘
                             593.38 µs           1.08 ms            1.57 ms

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

------------------------------------------- -------------------------------
gts large (control)          277.80 µs/iter 267.41 µs  █                   
                      (239.23 µs … 5.10 ms) 383.48 µs  ██                  
                    (216.09 kb … 661.11 kb) 217.23 kb ▆██▄█▇▄▂▂▂▁▁▁▁▁▁▁▁▁▁▁

gts large (experiment)       287.13 µs/iter 269.77 µs █                    
                      (239.31 µs … 4.89 ms) 556.72 µs ██▃                  
                    (215.70 kb … 667.19 kb) 216.73 kb ███▅▃▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌───┬              ╷
         gts large (control) ├┤   │──────────────┤
                             ╵└───┴              ╵
                             ╷┌─────┬                                     ╷
      gts large (experiment) ├┤     │─────────────────────────────────────┤
                             ╵└─────┴                                     ╵
                             └                                            ┘
                             239.23 µs         397.97 µs          556.72 µs

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

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>
@gitKrystan

Copy link
Copy Markdown

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

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

This branch has not been deployed

No deployments
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.

2 participants