webpack-contrib / eslint-webpack-plugin

A ESLint plugin for webpack
MIT License
254 stars 47 forks source link

eslint-webpack-plugin failing the build despite having failOnError set to false #51

Closed wojciechpolak closed 3 years ago

wojciechpolak commented 3 years ago

Expected Behavior

Show all ESLint errors and warnings, but do not fail the build process. Build should be successful no matter what linting errors are presented.

Actual Behavior

Despite having failOnError set to false, the build is always failing.

Code

      plugins: [
          ...
          new ESLintPlugin({
              extensions: 'ts',
              exclude: 'node_modules',
              emitError: true,
              failOnError: false,
              emitWarning: true,
              failOnWarning: false
          })
      ]

Failure:

[09:43:19] webpack built b7ea99f302259f7f4bac in 56785ms
✖ 「wdm」: Built at: 11/24/2020 9:43:19 AM

ERROR in 
/[redacted]/foobar.ts
  63:15  error  Multiple spaces found before '('              no-multi-spaces
  63:15  error  Unexpected space before function parentheses  space-before-function-paren
  63:23  error  Missing space before opening brace            space-before-blocks

✖ 3 problems (3 errors, 0 warnings)
  3 errors and 0 warnings potentially fixable with the `--fix` option.

ℹ 「wdm」: Failed to compile.

I'm also trying an alternative config and it doesn't fail, but it also doesn't show any error or warning:

          new ESLintPlugin({
             extensions: 'ts',
              exclude: 'node_modules',
              emitWarning: true,
              failOnWarning: false
          }),

Additionally, setting Webpack's noEmitOnErrors to false doesn't affect the build failure:

      optimization: {
          noEmitOnErrors: false
      }

I also must keep .eslintrc configuring rules as error and not warn for IDE reporting.

In summary, no matter what config I set, the linting errors are visible and the build is failing (unacceptable) or the build is successful, but nothing about the errors is visible, so at this point the plugin is useless in my case.

jnardone commented 3 years ago

Seeing the same thing - failures even with explicit failOnError: false and failOnWarning: false

larcho commented 3 years ago

On the same bote. As a side note, using NextJS, might have something to do with it.

theBork commented 3 years ago

Same issue with Styleguidist

ricardogobbosouza commented 3 years ago

Hi @wojciechpolak Provide a repository to reproduce Sorry for late response

wictorwilen commented 3 years ago

The issues comes down to the webpack mode parameter, when set to production it will not generate any output (that is wepback "fails"), but generates output when set to development. Here's a sample repo with a repo: https://github.com/wictorwilen/eslintplugin-build-fail