webpack-contrib/stylelint-webpack-plugin

Stop the compilation when 'failOnError' setted to false

Applelo opened this issue · 4 comments

  • Operating System: Mac OS 10.14
  • Node Version: v10.17.0
  • NPM Version: 6.11.3
  • webpack Version: 4.41.3
  • stylelint-webpack-plugin Version: 1.1.2

Expected Behavior

I would like to show stylelint errors but not stop the build of my app.

Actual Behavior

Stylelint webpack plugin stop the compilation of the app when I have an error even if I have set the configuration to prevent that.

Code

new StyleLintPlugin({
          configFile: Path.resolve(__dirname, '.stylelintrc.json'),
          context: Path.join(SrcDirPath, 'stylesheets'),
          files: '**/*.scss',
          failOnError: false,
          emitErrors: true,
          syntax: 'scss',
})
ERROR in 
static/src/stylesheets/components/ui/_form.scss
  9:5  ⚠  Unexpected browser feature "flexbox" is only partially supported by IE 11        plugin/no-unsupported-browser-features
 33:3  ⚠  Unexpected browser feature "outline" is only partially supported by IE 11, IE    plugin/no-unsupported-browser-features
          Mobile 11                                                                                                              
 50:5  ⚠  Unexpected browser feature "css-resize" is not supported by IE 11, Edge 17,18,   plugin/no-unsupported-browser-features
          iOS Safari 11.3-11.4,12.0-12.1,12.2-12.3, IE Mobile 11, KaiOS Browser 2.5                                              
 52:5  ✖  Expected ".input-group:not(.input-group--error) &:invalid:focus" to      selector-max-pseudo-class             
          have no more than 2 pseudo-classes                                                                                     
 69:3  ⚠  Unexpected browser feature "flexbox" is only partially supported by IE 11        plugin/no-unsupported-browser-features


npm ERR! code ELIFECYCLE

How Do We Reproduce?

I can't share my current project but I can make a repository to reproduce the bug.

@Applelo If you can create a repository I appreciate

You can find an example where I was able to reproduce this issue:
https://github.com/Applelo/stylelint-webpack-plugin-issue-200

@Applelo come on:

failOnError if enabled will stop compilation and display errors.
emitError if enabled will show all errors and warnings as errors.
emitWarning if enabled will show all errors and warnings as warnings.

We cannot issue an error to webpack without failing, you can try this:

new StyleLintPlugin({
  configFile: Path.resolve(__dirname, '.stylelintrc.json'),
  context: Path.join(SrcDirPath, 'stylesheets'),
  files: '**/*.scss',
  emitWarning: true,
  syntax: 'scss',
})

Thanks for your answer, it's this option I was looking for. Sorry for my misunderstanding but your answer is more clear than the readme and the name of the options.

Have a good year.