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: quiet flag only prints when set to false #60

Merged
merged 2 commits into from
Jan 17, 2017

Conversation

JaKXz
Copy link
Contributor

@JaKXz JaKXz commented Jan 17, 2017

No description provided.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.667% when pulling 4e47a5e on fix/quiet-strictly-false into e2f33b8 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.667% when pulling 4e47a5e on fix/quiet-strictly-false into e2f33b8 on master.

Copy link
Contributor

@sergesemashko sergesemashko left a comment

Choose a reason for hiding this comment

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

@JaKXz, here is the issue - #61

@@ -26,8 +26,8 @@ module.exports = function runCompilation (options, compiler, done) {
return file.errored;
});

if (!options.quiet) {
console.log(chalk.yellow(options.formatter(results)));
if (options.quiet === false) {
Copy link
Contributor

@sergesemashko sergesemashko Jan 17, 2017

Choose a reason for hiding this comment

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

Hey @JaKXz, I tested this locally.
It seems like this change has no effect, because quite is set to false by default here.
Wonder what is the reason of using quite here if webpack outputs warnings and errors to the console as well in onCompilation?
Maybe we could move it to onCompilation and have something like this:

compiler.plugin('after-emit', function onCompilation (compilation, callback) {
    if (warnings.length) {
      if (options.quiet === false) {
        compilation.warnings.push(chalk.yellow(options.formatter(warnings)));
      }
      warnings = [];
    }

    if (errors.length) {
      if (options.quiet === false) {
        compilation.errors.push(chalk.red(options.formatter(errors)));
      }
      errors = [];
    }

    callback();
  });

If at least something should be in the output, it can be:

if (warnings.length) {
  var formattedWarnings = chalk.yellow(options.formatter(warnings));
  if (options.quiet === false) {
    compilation.warnings.push(formattedWarnings);
  } else {
    console.log(formattedWarnings);
  }
  warnings = [];
}

what do you think?

Copy link
Contributor Author

@JaKXz JaKXz Jan 17, 2017

Choose a reason for hiding this comment

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

I removed the default quiet value in this change though. I'll take a closer look at your suggestion later, but could you try installing this branch locally and I think it will solve the problem.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 98.684% when pulling d0635bb on fix/quiet-strictly-false into e2f33b8 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 98.684% when pulling d0635bb on fix/quiet-strictly-false into e2f33b8 on master.

@JaKXz
Copy link
Contributor Author

JaKXz commented Jan 17, 2017

@sergesemashko I'm going to merge this for now so we can test stylelint-webpack-plugin#master.

@JaKXz JaKXz merged commit b17a4a7 into master Jan 17, 2017
@JaKXz JaKXz deleted the fix/quiet-strictly-false branch January 17, 2017 23:12
@sergesemashko
Copy link
Contributor

Looks good, duplicates are gone now

joshwiens pushed a commit that referenced this pull request Mar 31, 2018
* refactor: pull out errorMessage constant
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.

3 participants