-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Validate options passed to CLIEngine API #10272
Comments
I think this could be a good idea, although it's a breaking change. |
Would adding initially as just a warning be considered breaking? |
This aims to prevent some of the common pitfalls/points of confusion when configuring `CLIEngine`, such as: * it not being clear that `baseConfig` supports all of the options defined in the `.eslintrc.*` schema, and so can be used for options that are not supported as top-level `CLIEngine` arguments such as `extends` and `settings. * some of the CLIEngine options being named the same or almost the same as their `.eslintrc.*` equivalents, but being a different data type. * it not being clear that CLIEngine silently ignores invalid options (which will hopefully be fixed at some point by eslint#10272). Refs: eslint#4402 eslint#5179 eslint#6605 eslint#7247 eslint#7967 eslint#10272 webpack-contrib/eslint-loader#173 webpack-contrib/eslint-loader#252 neutrinojs/neutrino#1181
This aims to prevent some of the common pitfalls/points of confusion when configuring `CLIEngine`, such as: * it not being clear that `baseConfig` supports all of the options defined in the `.eslintrc.*` schema, and so can be used for options that are not supported as top-level `CLIEngine` arguments such as `extends` and `settings. * some of the CLIEngine options being named the same or almost the same as their `.eslintrc.*` equivalents, but being a different data type. * it not being clear that CLIEngine silently ignores invalid options (which will hopefully be fixed at some point by eslint#10272). Refs: eslint#4402 eslint#5179 eslint#6605 eslint#7247 eslint#7967 eslint#10272 webpack-contrib/eslint-loader#173 webpack-contrib/eslint-loader#252 neutrinojs/neutrino#1181
This aims to prevent some of the common pitfalls/points of confusion when configuring `CLIEngine`, such as: * it not being clear that `baseConfig` supports all of the options defined in the `.eslintrc.*` schema, and so can be used for options that are not supported as top-level `CLIEngine` arguments such as `extends` and `settings. * some of the CLIEngine options being named the same or almost the same as their `.eslintrc.*` equivalents, but being a different data type. * it not being clear that CLIEngine silently ignores invalid options (which will hopefully be fixed at some point by #10272). Refs: #4402 #5179 #6605 #7247 #7967 #10272 webpack-contrib/eslint-loader#173 webpack-contrib/eslint-loader#252 neutrinojs/neutrino#1181
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
Please can this be reopened for further discussion? :-) |
Thanks @edmorley, I'll reopen. |
@platinumazure It looks like you've assigned this to yourself. Are you still championing this change? If so, should it go through the RFC process that we have that in place? |
For the v7.0.0 release, we're focusing on implementing RFC40 and the new |
We incorporated more validations into the new |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
See below.
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Used
CLIEngine
like so:What did you expect to happen?
For the invalid
CLIEngine
optionsettings
to trigger a schema validation error, like happens which an invalid option is found in an.eslintrc.js
when using the CLI:What actually happened? Please include the actual, raw output from ESLint.
The
CLIEngine
command silently ignores the invalid option, causing confusion - since I instead thought eslint-plugin-react was at fault.If there was a schema validation warning, I would have known sooner to search for how to pass options like
settings
when usingCLIEngine
(ie usingbaseConfig
instead). It seems that this has tripped up a few other people too - eg #7247, #4402 (and I'm presuming more for other differences between the CLI and CLIEngine).If it's too expensive/unwanted to add a schema validation check to
CLIEngine
(eg because the CLI does its own, and so pointless to do a second, if the CLI uses CLIEngine too) - then perhaps there can be a second schema validation method (for the CLIEngine options instead) that consumers of the API can call first if desired?Many thanks :-)
The text was updated successfully, but these errors were encountered: