ember-cli / eslint-plugin-ember

An ESLint plugin that provides set of rules for Ember applications based on commonly known good practices.
MIT License
260 stars 202 forks source link

eslint v9 support #2136

Closed Techn1x closed 2 weeks ago

Techn1x commented 5 months ago

There are aspects of this plugin that don't support eslint v9

TypeError: context.getAncestors is not a function from this line https://github.com/ember-cli/eslint-plugin-ember/blob/7e6bca993226891be07ad367f066323573b672aa/lib/rules/require-return-from-computed.js#L69-L70

context.getAncestors() is replaced in v9 https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/#context.getancestors()

That's just the one I found, there is potentially other things that need to change for eslint v9

LucasHill commented 3 months ago

Should have this resolved in : https://github.com/ember-cli/eslint-plugin-ember/pull/2153

LucasHill commented 3 months ago

https://github.com/ember-cli/eslint-plugin-ember/pull/2153 was merged but there is at least one (and possibly more) deprecations. However the changes did unblock using the eslint/compat library to bring this plugin up to v9 compatibility. The usage in your eslint.config.mjs that's working for me is...

import { fixupConfigRules } from '@eslint/compat';
import emberRecommended from 'eslint-plugin-ember/configs/recommended';
const fixedEmberRecommended = fixupConfigRules(emberRecommended);
export default [
...yourOtherRules,
...fixedEmberRecommended
]

I'd still like to fix everything else to make this plugin work natively in v9 but if someone beats me to it go ahead.

LucasHill commented 3 months ago

@NullVoxPopuli would it make sense to do a release to enable the above workaround until full support is in?

NullVoxPopuli commented 3 months ago

perhaps!

I'd like to set up release-plan on this repo so releasing is less of a process (i.e.: can do it from the phone) -- but would need to discuss with @bmish <3

bmish commented 3 months ago

I'm in favor of more automation for the release process, probably something like release-please in https://github.com/eslint/generator-eslint/pull/175. Contributions welcome if someone wants to improve it. For now, we have a command mentioned here: https://github.com/ember-cli/eslint-plugin-ember/blob/master/RELEASE.md

LucasHill commented 1 month ago

I hope this will be resolved with my second attempt here: https://github.com/ember-cli/eslint-plugin-ember/pull/2159

JoshuaKGoldberg commented 3 weeks ago

Was this resolved by #2159 with a fix released in 12.2.0?

LucasHill commented 3 weeks ago

@JoshuaKGoldberg i am using the plugin on 12.2.0 on my large ember codebase with eslint 9 but i'm not sure what the done criteria are for this, such as getting the test suite running against eslint 9.

JoshuaKGoldberg commented 2 weeks ago

That sounds like support to me 😄. But I'm not an Ember user so I'm not confident. If this issue gets closed by a maintainer then I'll just go ahead and mark a ✅ on https://github.com/eslint/eslint/issues/18093.

Turbo87 commented 2 weeks ago

seems to work fine on ESLint 9 now with the latest release. thanks everyone! :)

Techn1x commented 2 weeks ago

It does indeed seem to work 🎉

If anyone here's having dependency issues with ember-eslint-parser & eslint v9, this PR might be relevant to you https://github.com/ember-tooling/ember-eslint-parser/pull/95