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 emit warning error quiet #46

Conversation

michaelangeliu
Copy link
Contributor

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

There are technically three different states for the flags emitError and emitWarning.
The flags can be undefined, true, or false. In the eslint-loader plugin, when the flag
is set to false, it suppresses the errors or warnings, allowing for the respective
alternative to be more visible. A popular use case would be if a file has both errors
and warnings, if emitWarning were set to false, it should only show the errors in the
file
#19

Breaking Changes

POTENTIAL BREAKING CHANGE: Updates to emitError and emitWarning

Setting only emitError to true will no longer exclusively print files with errors
and disregard the files with warnings. Similarly, setting only emitWarning to true
will no longer exclusively print files with warnings disregard the files with errors.

Additional Info

fix #19

@codecov
Copy link

codecov bot commented Nov 18, 2020

Codecov Report

Merging #46 (ec0d635) into master (f819203) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #46   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          240       249    +9     
  Branches        66        69    +3     
=========================================
+ Hits           240       249    +9     
Impacted Files Coverage Δ
src/linter.js 100.00% <100.00%> (ø)
src/options.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f819203...ec0d635. Read the comment docs.

@michaelangeliu
Copy link
Contributor Author

I have actually signed the CLA. I'm not really sure why it's not recognizing that though.

@alexander-akait
Copy link
Member

@michaelangeliu First commits from unknown user (look at them, they are not have avatar)

- when linting a file that has both warnings and errors, if
the quiet flag is set, then the errors should be emited, but
the warnings should not
- replace force-emit-error and force-emit-warning tests with more
robust tests that match the functionality of eslint-loader
- if emitError is undefined or true, it should emit errors, otherwise
if emitError is false, it should suppress errors
- if emitWarning is undefined or true, it should emit warnings, otherwise
if emitWarning is false, it should suppress warnings
- print errors only when emitError is undefined or true,
otherwise suppress errors
- print warnings only when emitWarning is undefined or true,
otherwise suppress warnings
- this allows the config to be set up to lint a file that has
both warnings and errors and only show the relevant errors or
warnings

fix webpack-contrib#19

BREAKING CHANGE: Updates to emitError and emitWarning

Setting only emitError to true will no longer exclusively print files with errors
and disregard the files with warnings. Similarly, setting only emitWarning to true
will no longer exclusively print files with warnings disregard the files with errors.
- quiet is essentially syntactic sugar for setting emitError to true
and emitWarning to false

fix webpack-contrib#19
@michaelangeliu
Copy link
Contributor Author

@alexander-akait Thank you! I think I fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

emitWarning option dont work
3 participants