Repository navigation
Add ember/no-deprecated-imports rule - #2855
Conversation
🏎️ Benchmark Comparison
Full mitata output |
|
Curious about the logic behind this decision:
Though we could probably merge this as is and add support for that later. |
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
Thoughts? |
if someone were to export * as whatever from '@ember/array/proxy'that is fully deprecated -- whereas export * as whatever from '@ember/component';is not |
I don't agree with having an opt out for type-only ~ |
| | 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 | |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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>
1cb6382 to
31ec8d4
Compare
New rule
ember/no-deprecated-importsflags 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.
How a deprecation gets reported:
reportwins over everything else.reportAll: true(the default), everything is reported and ember-source is never looked up.reportAll: false, it is reported once the installed ember-source reaches the deprecation'ssince.enabledversion, orsince.availablewhen it is not enabled yet. Prereleases count, so7.4.0-beta.1is 7.4. If ember-source can't be found, only per-pathreport: trueentries are reported.The data is in
lib/utils/deprecated-imports.js: 24 entries over 17 import paths, frominjectin@ember/service(6.3) andimport 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/componentand@ember/objectdefault exports). Versions and ids follow the ember-source deprecation registry. Each entry has astatus(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
computedfrom@ember/object/computedis fine whilealiasis not. It also checksimport typeandexport ... from. Namespace imports andexport *are only reported when the whole module is deprecated.Things reviewers may want to weigh in on:
emberuses the umbrella iddeprecate-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 perEmber.*member.@ember/objectis listed. Whethercomputed/get/setwill be deprecated is not settled in #21674.until: 7.9.0for Enumerable, MutableEnumerable andControllerMixin, which might be a typo for 8.0.0. The data copies the registry.@ember/componentdefault overlap withno-proxiesandno-classic-components. Paths already covered byno-tracked-built-insandno-legacy-helper-importsare left out.With
reportAll: false, the version comes fromsettings.ember.version(#2859) when set, otherwise from the installed ember-source.lib/utils/ember-source-version.jsnow also exportsisVersionAtLeast.🤖 Generated with Claude Code