New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENHANCEMENT] Upgrade ESLint to v8 in app
and addon
blueprints
#9669
Conversation
It's required to use `@babel/plugin-proposal-decorators` plugin with `@babel/eslint-parser` if we want to support decorators in JavaScript. This reverts commit 8ae8d5f.
@SergeAstapov that would be awesome, thank you. |
ember-auto-import doesn't seem happy with |
blueprints/app/files/package.json
Outdated
@@ -23,14 +23,15 @@ | |||
"test:ember": "ember test" | |||
}, | |||
"devDependencies": { | |||
"@babel/eslint-parser": "^7.15.8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way we can bundle these dependencies as fallbacks? so we don't have to bundle them in the app's package.json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is! I found a way
Upgrading it seems to break stuff with babel-parser. See: * ember-cli/ember-cli#9307 * ember-cli/ember-cli#9669
Opened emberjs/rfcs#817 to hopefully get the ball rolling on this one. |
Get rid of deprecated `babel-eslint` References: ember-cli/ember-cli#9669 ijlee2/ember-container-query#115
I don't think upgrading the parser like this needs an RFC. However, my main concern is that this hard-codes a separate babel config for use by eslint that needs to be maintained separately from the real config. That might be an acceptable tradeoff given that it will be more difficult for many apps to quickly adopt a standalone babel config file. |
@ef4 what would it take for you to feel comfortable landing this? |
What is the status here? Would be great if we could upgrade to eslint v8 in Ember projects. In general migration from |
I would like to see this progress as well. I'll try to update the PR and put this on the agenda for the CLI meeting tomorrow. |
@bertdeblock thanks for helping with this! If RFC still needed, I can help with it as called out before however there were several comments here and there it may not be needed. |
I agree it's important to get this ESLint / @babel/eslint-parser upgrade in. Last I saw, it was stalled on comments on this PR / my previous PR attempt (#9556). Note that Ember already works fine with these upgraded versions, they just don't come standard in the Ember blueprint yet. |
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-ember": "^10.4.2", | ||
"eslint-plugin-ember": "^10.5.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems outdated, don't think this version should be touched for this PR?
app
and addon
blueprints
While I still don't love having a separate babel config in the eslintrc, I think it's the closest way to configure the existing behavior in the new version. So I'm ok with it. |
Hello, I think it'd be good for us to resume working on this pull request and getting it merged soon. To provide confidence to this PR: I was able to migrate a monorepo with addons and engines to use Going forward, PS. In eslint/eslint#13481, how can we get |
I don't think we need the ESLint team to monitor compatibility with eslint-plugin-ember. They just listed a few top ESLint plugins in that section as a sanity check that their flat config implementation works properly. But it would be good to file an issue in eslint-plugin-ember for us to add support for flat config. |
For reference, i have a flat config here: embroider-build/addon-blueprint#71 |
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-ember": "^10.4.2", | ||
"eslint-plugin-ember": "^10.5.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be properly rebased. This is an older version than is on master:
"eslint-plugin-ember": "^11.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a few searches and replace, all occurrences are now updated to the ^11.10
.
5b623b6
to
2af5e8a
Compare
The parser in the ESLint config file is still |
Can you search for |
As mentioned by @bertdeblock, I still see |
blueprints/app/files/package.json
Outdated
@@ -24,6 +24,8 @@ | |||
"test:ember": "ember test" | |||
}, | |||
"devDependencies": { | |||
"@babel/eslint-parser": "^7.15.8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug (blocking)
Before, babel-eslint
was added to package.json
via the else
clause. You'll want to add @babel/eslint-parser
and @babel/plugin-proposal-decorators
conditionally.
Pseudocode:
<% if (!typescript) { %>
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-proposal-decorators": "^7.20.5",
<% } %>
I listed the latest versions above, in case you want the latest.
blueprints/app/files/package.json
Outdated
@@ -54,7 +55,7 @@ | |||
"ember-source": "~4.9.0-beta.1", | |||
"ember-template-lint": "^4.16.1<% if (welcome) { %>", | |||
"ember-welcome-page": "^6.2.0<% } %>", | |||
"eslint": "^7.32.0", | |||
"eslint": "^8.24.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest version is 8.29.0
, in case you want the latest.
(We can always create a separate PR to update eslint
and its plugins to the latest.)
plugins: [ | ||
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question
Now that @babel/plugin-proposal-decorators
is used, I don't think we need the ecmaFeatures
key (along with legacyDecorators
) anymore (lines 9-11)?
The first commit (e97c6ad) shows that ecmaFeatures
had been removed. I wonder if it got accidentally re-introduced by merging master
(i.e. a rebase didn't happen correctly).
@@ -143,7 +143,7 @@ | |||
"chai-jest-snapshot": "^2.0.0", | |||
"ember-cli-blueprint-test-helpers": "^0.19.2", | |||
"ember-cli-internal-test-helpers": "^0.9.1", | |||
"eslint": "^8.24.0", | |||
"eslint": "^8.29.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumping eslint
for ember-cli
itself can be omitted from this PR imo, as it's not related to the blueprints.
blueprints/app/files/package.json
Outdated
@@ -24,6 +24,8 @@ | |||
"test:ember": "ember test" | |||
}, | |||
"devDependencies": { | |||
<% if (!typescript) { %>"@babel/eslint-parser": "^7.19.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the file should still be valid JSON, see #10058 for more info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bertdeblock Do you have the permissions to run CI? It'd help @nightire to see if linting and testing are passing. (For first-time contributors, I'm not sure if you may need to approve running workflows after every push.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but it's failing because eslint
was bumped in ember-cli's package file without updating the lock file.
I would omit that bump from this PR though.
babel-eslint
does not works well with eslint@8, this PR uses@babel/eslint-parser
instead.The failing tests are not related with changes in this PR.