Skip to content

Fix emit warning error quiet - #46

Merged
ricardogobbosouza merged 5 commits into
webpack:masterfrom
michaelangeliu:fix-emit-warning-error-quiet
Jan 25, 2021
Merged

ricardogobbosouza merged 5 commits into
webpack:masterfrom
michaelangeliu:fix-emit-warning-error-quiet

Conversation

@michaelangeliu

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

@michaelangeliu
michaelangeliu force-pushed the fix-emit-warning-error-quiet branch from ea689ee to 45ede2e Compare November 18, 2020 08:41
@codecov

codecov Bot commented Nov 18, 2020 •

Copy link
Copy Markdown

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
Copy Markdown
Contributor Author

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

@alexander-akait

Copy link
Copy Markdown
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#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#19
@michaelangeliu
michaelangeliu force-pushed the fix-emit-warning-error-quiet branch from d64f75d to ec0d635 Compare January 23, 2021 06:40
@michaelangeliu

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