Skip to content
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

feat(linter): use overrides in root eslint config #3949

Merged
merged 2 commits into from
Oct 23, 2020

Conversation

JamesHenry
Copy link
Collaborator

@JamesHenry JamesHenry commented Oct 21, 2020

Current Behavior

The root level ESLint config in an Nx workspace currently applies all configuration (parser, plugins, rules etc) to all files within the workspace.

This is ok for TypeScript and JavaScript (where the same custom parser can be used for both file types), but for Nx to truly support linting any and all frameworks, libraries and tools, it needs to become more precise in how config is applied.

Expected Behavior

We leverage ESLint's "overrides" capability so that we can set up a root config which will support all permutations of Nx workspaces across all frameworks, libraries and tools.

The key point is that we need entirely different ESLint config to apply to different types of files, but we still want to share common config where possible.

I did not need to change any other existing project level configs, they all still work as before.

This is the final step to unlocking proper Angular linting via ESLint in Nx workspaces, because now HTML files (and inline HTML templates within Components) can be linted alongside other source code.

I have personally verified this locally by using a build of this PR and creating a custom Nx workspace which mixes React and Angular apps together.

Related Issue(s)

Fixes #

@nx-cloud
Copy link

nx-cloud bot commented Oct 21, 2020

Nx Cloud Report

CI ran the following commands for commit bea0cfe. Click to see the status, the terminal output, and the build insights.

Status Command Start Time
#000000 nx build-base linter 10/22/2020, 4:57:51 PM
#000000 nx run-many --target=build --all --parallel 10/22/2020, 4:57:49 PM
#000000 nx run-many --target=e2e --projects=e2e-angular,e2e-bazel 10/22/2020, 4:59:12 PM
#000000 nx run-many --target=e2e --projects=e2e-cypress,e2e-jest,e2e-nx-plugin 10/22/2020, 5:00:20 PM
#000000 nx run-many --target=e2e --projects=e2e-next 10/22/2020, 5:00:28 PM
#000000 nx run-many --target=e2e --projects=e2e-node 10/22/2020, 4:59:38 PM
#000000 nx run-many --target=e2e --projects=e2e-react 10/22/2020, 4:58:01 PM
#000000 nx run-many --target=e2e --projects=e2e-web,e2e-linter,e2e-storybook 10/22/2020, 4:58:35 PM
#000000 nx run-many --target=e2e --projects=e2e-workspace 10/22/2020, 4:58:32 PM
#000000 nx run-many --target=lint --all --parallel 10/22/2020, 5:00:35 PM
#000000 nx run-many --target=test --all --parallel 10/22/2020, 4:59:31 PM

Sent with 💌 from NxCloud.

@JamesHenry JamesHenry changed the title feat(linter): utilise overrides in eslint configs feat(linter): use overrides in root eslint config Oct 22, 2020
@JamesHenry
Copy link
Collaborator Author

The unit test failure was simply a memory issue on the CircleCI agent...

@JamesHenry JamesHenry marked this pull request as ready for review October 22, 2020 16:53
* breaking changes - we should also look to replace all the @typescript-eslint
* related plugins and rules below.
*/
export default {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not relevant for this PR but, should the typescript configuration extend off of this javascript one?

@FrozenPandaz FrozenPandaz merged commit 4f5fb0f into nrwl:master Oct 23, 2020
@JamesHenry JamesHenry deleted the eslint-overrides branch October 24, 2020 17:33
Doginal pushed a commit to Doginal/nx that referenced this pull request Nov 25, 2020
* feat(linter): use overrides in root eslint config

* feat(linter): update-root-eslint-config-to-use-overrides migration
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants