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

Confusion around how --quiet and --fix should behave together #8675

Closed
platinumazure opened this issue Jun 1, 2017 · 14 comments · Fixed by homezen/eslint-config-homezen#43
Closed
Assignees
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 cli Relates to ESLint's command-line interface

Comments

@platinumazure
Copy link
Member

See #8353 for background.

I think the best way to fix this is to allow users the option to go either way and to be very explicit about how the options work.

Here's one proposal along those lines:

  • Rename --quiet to --no-report-warnings (supporting --quiet as an alias and preserving its behavior), to avoid reporting warnings but possibly fix them
  • Add option --no-fix-warnings to support not running autofix on warnings but possibly report them (no effect if --fix not specified)
  • Users can use both to completely ignore warnings altogether

With this proposal, our CLI options become more clear and more flexible with regard to whether warnings are reported/logged (--quiet/--no-report-warnings) and whether warnings are fixed (--no-fix-warnings).

I'll champion.

@platinumazure platinumazure self-assigned this Jun 1, 2017
@platinumazure platinumazure added cli Relates to ESLint's command-line interface evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion feature This change adds a new feature to ESLint labels Jun 1, 2017
@eslintbot eslintbot added triage An ESLint team member will look at this issue soon and removed cli Relates to ESLint's command-line interface evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion feature This change adds a new feature to ESLint labels Jun 1, 2017
@platinumazure platinumazure added cli Relates to ESLint's command-line interface evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion feature This change adds a new feature to ESLint and removed triage An ESLint team member will look at this issue soon labels Jun 1, 2017
@soda0289
Copy link
Member

soda0289 commented Jun 3, 2017

Maybe we could add a third option to not report and not fix, something like --ignore-warnings.

@not-an-aardvark
Copy link
Member

Could that be achieved by using --no-fix-warnings and --no-report-warnings at the same time?

@platinumazure
Copy link
Member Author

platinumazure commented Jun 3, 2017 via email

@soda0289
Copy link
Member

soda0289 commented Jun 3, 2017

It could it would just alias those two options. I understand that adding too many options to the CLI would be a problem. I'm fine with just having the two options.

@mysticatea
Copy link
Member

In my first impression, it's surprisable that warnings still fix code with --no-report-warnings. I think better that people cannot choose "not reported but fixed".

How about?

Option Reported Fixed
(default) Yes Yes
--ignore-warnings=fix Yes No
--ignore-warnings=full (alias --quiet) No No

@platinumazure
Copy link
Member Author

@mysticatea Yes, I think you're right, that behavior is unexpected (and was the root of the original issue). I like the direction you're going, but maybe we could bikeshed the name a little bit?

How about this?

  • --warnings=report-and-fix (default)
  • --warnings=report-only (no fix, but report warnings)
  • --warnings=none (don't report or fix warnings, alias --quiet)

@not-an-aardvark
Copy link
Member

So are we proposing that the behavior of --quiet should change to not fix warnings? At the moment, warnings are fixed but are not reported with --quiet.

@platinumazure
Copy link
Member Author

platinumazure commented Jun 5, 2017 via email

@not-an-aardvark
Copy link
Member

I wonder if it would be better to just change --quiet to not fix warnings, and not introduce any other options. Then --warnings=report-and-fix would just be the default with --fix, and --warnings=report-only could be simulated by running with --fix --quiet once, and then again without --fix.

I'm not sure I like that the --warnings option would be meaningless unless --fix is also used.

@mysticatea
Copy link
Member

Just arranged.
Granted, looks good to me if we change that ※ as a bug.

Option Error reported Error fixed Warning reported Warning fixed
(default)
--quiet
--fix
--fix --quiet

※ Currently, warnings are fixed but not reported.

@platinumazure
Copy link
Member Author

I am 100% behind @mysticatea's latest proposal (just fix --quiet). If a few other people (especially TSC) get behind it, I'll change the top post and reclassify this as a bug.

I'm not super attached to adding a "report but don't fix warnings" option in this PR. The thing I'm really championing here is making it so people can completely silence warnings (both report and fix), which --quiet should probably do.

@platinumazure
Copy link
Member Author

Created #8699 for if we want to treat this as a bugfix. If we decide this should be treated as a feature or enhancement, I can close that PR.

@alberto
Copy link
Member

alberto commented Jun 8, 2017

ping @gyandeeps since you disagreed with changing --quiet behaviour

Another possibility would be to add options to --fix: all (default), error, warning (not sure this one makes a lot of sense)

@platinumazure
Copy link
Member Author

If @gyandeeps still disagrees with changing --quiet behavior, should this perhaps go on TSC agenda?

Now that #8730 is merged, I'm willing to write a PR using that functionality to avoid autofixing warnings when --quiet is passed. I might hold off a day or two to see if TSC might want this to go a different direction.

@platinumazure platinumazure added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion feature This change adds a new feature to ESLint labels Jul 1, 2017
@alberto alberto closed this as completed in f00854e Jul 4, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@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 Feb 6, 2018
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 cli Relates to ESLint's command-line interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants