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

Docs: Clarify the CLIEngine options #10995

Merged
merged 1 commit into from Dec 8, 2018

Conversation

edmorley
Copy link
Contributor

@edmorley edmorley commented Oct 19, 2018

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

[X] Documentation update

What changes did you make? (Give an overview)

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 Validate options passed to CLIEngine API #10272).

Refs:
#4402
#5179
#6605
#7247
#7967
#10272
webpack-contrib/eslint-loader#173
webpack-contrib/eslint-loader#252
neutrinojs/neutrino#1181

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

Nothing specifically :-)

@jsf-clabot
Copy link

jsf-clabot commented Oct 19, 2018

CLA assistant check
All committers have signed the CLA.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Oct 19, 2018
@platinumazure platinumazure added documentation Relates to ESLint's documentation cli Relates to ESLint's command-line interface and removed triage An ESLint team member will look at this issue soon labels Oct 19, 2018
Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

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

This LGTM, but I just left one question (inline) that I would like answered before I approve the changes.

Thanks for contributing!

* `fix` - This can be a boolean or a function which will be provided each linting message and should return a boolean. True indicates that fixes should be included with the output report, and that errors and warnings should not be listed if they can be fixed. However, the files on disk will not be changed. To persist changes to disk, call [`outputFixes()`](#cliengineoutputfixes).
* `globals` - An array of global variables to declare (default: empty array). Corresponds to `--global`.
* `globals` - An array of global variables to declare (default: empty array). Corresponds to `--global`. Note: This differs from `.eslintrc.*` / `baseConfig`, where `globals` is an object.
Copy link
Member

Choose a reason for hiding this comment

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

Question: Do we support passing in string values that are parsed as key/value pairs (e.g., "window:true" to signify that the window global variable should be considered writable)? If so, that may be worth calling out here.

I think --ext does allow the global readable/writable configuration, so I would expect it to be supported here too. Just wanted to double check.

@platinumazure
Copy link
Member

@edmorley Friendly ping: Have you had a chance to look into the question I raised? Thanks!

@edmorley
Copy link
Contributor Author

@platinumazure hi! Sorry for the delayed reply. I've tested locally and setting globals to ['foo:true'] works. I'll update the PR to mention that too.

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
Copy link
Member

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@not-an-aardvark not-an-aardvark merged commit 9f3573d into eslint:master Dec 8, 2018
@edmorley
Copy link
Contributor Author

edmorley commented Dec 8, 2018

Thank you for the review/merge :-)

@edmorley edmorley deleted the clarify-cliengine-options branch December 8, 2018 09:03
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jun 7, 2019
@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 7, 2019
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 cli Relates to ESLint's command-line interface documentation Relates to ESLint's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants