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

Extending overrides in sharable configs #12685

Closed
mrmckeb opened this issue Dec 19, 2019 · 4 comments
Closed

Extending overrides in sharable configs #12685

mrmckeb opened this issue Dec 19, 2019 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon

Comments

@mrmckeb
Copy link
Contributor

mrmckeb commented Dec 19, 2019

The version of ESLint you are using.
6.7.x

The problem you want to solve.
We have a shareable config that we use for Create React App (eslint-config-react-app).

When we added TypeScript support, we added an overrides object for Typescript, which sets the rules for related files. JS files are still handled by the root/base config.

This works fine until users try to extend these rules, they need to reimplement the TypeScript overrides object. This is causing issues for some of our users (facebook/create-react-app#7776).

Your take on the correct solution to problem.
We've given it some thought. One option is for us to ship a separate config for TypeScript, and simply extend that in our overrides. That would be fairly simple for users to reimplement.

However, we wondered if the ESLint team had better ideas. Perhaps a way to merge/extend overrides?

Are you willing to submit a pull request to implement this change?
Of course.

@mrmckeb mrmckeb added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Dec 19, 2019
@mysticatea
Copy link
Member

Thank you for your report.

First, all content of the extender overrides the extendees at all. This is concept.

I don't understand the context completely, but I'm guessing that end users want to override settings for JS but not for others?
If it is, it's simple.

extends: original
overrides:
- files: "*.js"
  rules:
    # override some rules.

@mrmckeb
Copy link
Contributor Author

mrmckeb commented Dec 19, 2019

Thanks for the fast response!

It's actually the other way, @mysticatea. Some want to extend the TS rules - which are implemented as an override.

We want people to be able to add rules here, without reimplementing everything else in this override.
https://github.com/facebook/create-react-app/blob/master/packages/eslint-config-react-app/index.js#L55

@mysticatea
Copy link
Member

Is it good with extends? The extends feature exists in order to override a part of existing configuration.

extends: original
overrides:
- files: "*.ts"
  rules:
    # override some rules.

@mrmckeb
Copy link
Contributor Author

mrmckeb commented Dec 19, 2019

Thanks @mysticatea, you were helpful. I think the issue is on our side. I'll close this off for now.

@mrmckeb mrmckeb closed this as completed Dec 19, 2019
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jun 18, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jun 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

2 participants