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

Fix: init error in extending recommended config (fixes #12707) #12738

Merged
merged 6 commits into from Apr 6, 2020
Merged

Fix: init error in extending recommended config (fixes #12707) #12738

merged 6 commits into from Apr 6, 2020

Conversation

yeonjuan
Copy link
Member

@yeonjuan yeonjuan commented Jan 3, 2020

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[x ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Fix #12707. It still has a triage label but I can reproduce it
reproduced - https://github.com/yeonjuan/autoconfbug

Is there anything you'd like reviewers to focus on?

The cause of the problem is precisely what here mentioned.

RECOMMENDED_CONFIG_NAME is a string, after extendFromRecommended return, the parent scope expect config.extends is an array

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jan 3, 2020
@yeonjuan yeonjuan changed the title Fix: error in extending recommended config (fixes #12707) Fix: init error in extending recommended config (fixes #12707) Jan 3, 2020
Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Can we test this somehow?

lib/init/autoconfig.js Outdated Show resolved Hide resolved
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features and removed triage An ESLint team member will look at this issue soon labels Jan 4, 2020
@kaicataldo
Copy link
Member

Thanks for adding tests for this! I just had a thought - would it make more sense to put eslint:recommended at the beginning of the array? I can't think of a case where it would be overriding other extended plugins, but can think of cases where the opposite might be true.

Also, would it be possible to write an integration test or two for lib/config-initializer to assert that this works correctly?

@yeonjuan
Copy link
Member Author

yeonjuan commented Jan 12, 2020

@kaicataldo

While I write an integration test code,
I realize that eslint --init doesn't ask for installing modules when I answered with "Inspect your JavaScript file(s)"(answers.source = auto)

So, It ends up with showing error messages below.

Error: Failed to load parser '@typescript-eslint/parser' declared in 'BaseConfig': Cannot find module '@typescript-eslint/parser'

Is it intended?

@kaicataldo
Copy link
Member

Sorry I missed this! That seems like a bug to me. Can you make a separate issue for that?

@kaicataldo
Copy link
Member

Thanks for contributing!

@yeonjuan
Copy link
Member Author

yeonjuan commented Apr 7, 2020

That seems like a bug to me. Can you make a separate issue for that?
@kaicataldo Sure!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Oct 4, 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 Oct 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eslint --init: config.extends.push
2 participants