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

New: Array Config #21

Closed
wants to merge 1 commit into from
Closed

New: Array Config #21

wants to merge 1 commit into from

Conversation

mysticatea
Copy link
Member

Rendered RFC

This was separated from #13.

Summary

This proposal makes .eslintrc files allowing an array as the top-level config. This is a syntax sugar of extends property and overrides property to make configuration simpler. Also, this form is closer to ESLint internal structure about configuration (ConfigArray).

Related Issues

@mysticatea mysticatea added feature Initial Commenting This RFC is in the initial feedback stage labels May 11, 2019
@not-an-aardvark
Copy link
Member

Thanks for working on this RFC!

I don't feel strongly either way, but I'm unsure about how useful this would actually be for users. It's not clear to me that users would find array configs less confusing than extends/overrides, even if they're conceptually similar. (Array configs might seem intuitive to us because we're familiar with the internals, but for new users it might not be obvious that overrides blocks can be implemented as a series of configs that extend each other.)


Also, it seems like users could accidentally create an error by doing something like this:

// ./.eslintrc.js

module.exports = [
  require('eslint-config-foo'),
  { /* additional config */ }
];
// ./node_modules/eslint-config-foo/index.js

module.exports = {
  parser: 'my-parser'
};
// ./node_modules/eslint-config-foo/node_modules/my-parser/index.js

module.exports = { /* (parser implementation) */ };

In this case, the end user's array config could appear to work at first, but it would break if the shareable config started to depend on relative paths.

@mysticatea
Copy link
Member Author

Yeah, actually, I don't feel strongly, too.

A use case I thought is to address conflicted localPlugins. (https://github.com/eslint/rfcs/blob/eslintrc-improvements/designs/2019-eslintrc-improvements/minor-03-plugin-renaming.md#using-two-shareable-configs-which-have-the-same-plugin-id-with-renaming) ... sorry for not linked.

@ExE-Boss
Copy link

This would bring .eslintrc closer to the upcoming eslint.config.js (#9).

@mysticatea
Copy link
Member Author

Actually, I'm still opposing #9 because that's fragile and we don't need to break all users' configs completely.

@ljharb
Copy link
Sponsor

ljharb commented May 12, 2019

Array config seems like it’d make migration to the more powerful object form painful; whereas the initial pain of using an object (when this RFC would allow an array) is minimal.

@not-an-aardvark
Copy link
Member

not-an-aardvark commented May 13, 2019

@ljharb I think the array form is as powerful as the object form, so it doesn't seem like a migration of that kind would be necessary. (Object configs are processed internally by compiling them into something resembling the array configs from this proposal.)

@ExE-Boss
Copy link

ExE-Boss commented May 13, 2019

Array configs would also make migration to eslint.config.js (#9) easier.

Once that gets implemented at some unknown point in the future.

@mysticatea
Copy link
Member Author

@ExE-Boss please mind that we have not decided to go with #9. We should evaluate this proposal as separated from that.

@ExE-Boss
Copy link

ExE-Boss commented May 13, 2019

I’m keeping that in mind, that’s why I said at some unknown point in the future when the decision about #9 actually gets made.

@not-an-aardvark
Copy link
Member

I don't feel strongly about it, but I'm leaning against supporting this RFC because it's not clear that allowing array configs would be useful, and it might lead to some confusion (by having another way to do things).

@btmills
Copy link
Member

btmills commented Jul 16, 2020

Thank you all for the discussion in this thread and particularly @mysticatea for putting the RFC together! Now that we've decided on a direction to take configs going forward in #9, the TSC decided today to close the other config-related RFCs so we can focus on the new format. You can follow along with that implementation work at eslint/eslint#13481.

@btmills btmills closed this Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Initial Commenting This RFC is in the initial feedback stage
Projects
None yet
5 participants