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
Add support for overrideConfig
in Programmable API
#231
Conversation
extensions: this.config.extensions, | ||
cwd: this.config.cwd, | ||
this.config = { | ||
...DEFAULT_BASE_CONFIG, |
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 fixes a bug where DEFAULT_BASE_CONFIG.quiet
and DEFAULT_BASE_CONFIG.formatterName
were only being used in the CLI, and not the programmatic API. I think my new code implements the original intention of DEFAULT_BASE_CONFIG
.
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.
As you say, this is a bug. Thanks for fixing it.
I enabled Github Actions, you can check out the builds on my branch here: https://github.com/adidahiya/eslint-interactive/actions?query=branch%3Aad%2FoverrideConfig |
Thanks for contributing! I'll review this pull request later! |
There's a performance regression but I'm not sure what it's caused by: https://github.com/adidahiya/eslint-interactive/commit/1db1073b39d81b5dced85e2bdcc7b312454b2eda#commitcomment-82817209 |
export type Config = Pick< | ||
ESLint.Options, | ||
'extensions' | 'rulePaths' | 'cache' | 'cacheLocation' | 'useEslintrc' | 'overrideConfig' | 'cwd' | ||
> & { |
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.
Nice refactoring 👍
The continuous benchmark is not stable and sometimes failed (ref: #202). You can safely ignore them this time! Sorry for worrying you. I will raise the upper limit of the benchmark threshold at a later date. |
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.
LGTM!
The programmable API was created just for fun, so I am glad to know that there are people using it.
overrideConfig
in Programmable API
This PR was released by v10.1.0. |
Thanks for the quick review and release @mizdra! I'll try out the release and follow up if I need more adjustments. |
I used eslint-interactive recently to programmatically suppress lint rules across a large codebase. It worked well, but I found it to be a bit slow running all the enabled rules. Sometimes I want to use eslint-interactive with just a few rules enabled, and I found no way to do this with the programmatic API.
This PR adds two new properties accepted in the options object for the
Core()
constructor,overrideConfig
anduseEslintrc
. These forward directly to theESLint()
constructor.I've also adjusted the code and types a bit in core.ts to make it clear which parts of the API are forwarding to ESLint directly. Please let me know what you think, thanks.