wbuchwalter / tslint-loader

tslint loader for webpack
193 stars 65 forks source link

add options to failOnHint to ignore warnings and display warnings #90

Closed eddyw closed 3 years ago

eddyw commented 6 years ago

It's related to #74 and #85 The idea is to allow users to customize options on failOnHint to take into account the severity of the rules. For instance, rules whose severity is warning shouldn't break the build process. For instance:

rules: {
  "no-console": { "severity": "warning" },
}

This PR allows failOnHint property to be an object that accepts these optional properties:

          failOnHint: {
            ignoreWarnings: true,
            displayWarnings: true,
            silent: true,
          }

When ignoreWarnings is set to true, when there are only warnings, they are ignored and the compilation succeeds. However, if there is at least one error, both errors and warnings are shown and the compilation fails (this way doesn't break existing configuration)

When displayWarnings is set to true, compilation succeeds but warnings are shown (webpackInstance.emitWarning)

silent doesn't throw an error only displays error output (webpackInstance.emitError). It's useful together with emitErrors: true and webpack.NoEmitOnErrorsPlugin webpack plugin. We can get a nice and clean output by combining these, specially with the plugin.

sonicoder86 commented 6 years ago

Can you add tests for these use cases?

bricss commented 6 years ago

@eddyw @blacksonic Any updates on this? Really needed feature 😬

eddyw commented 6 years ago

@bricss it's been quite some time since I opened the PR. Currently I'm no longer using tslint-loader and I have little time to be able to implement the tests. If anybody is willing to help with that, it'd be cool.

Anyway, I will see if I can make some time this month to implement the tests.

adanski commented 5 years ago

Any updates? It would be a really convenient addition.

eddyw commented 5 years ago

@adanski I haven't had time to continue with this. Sorry, I've even forgotten about it. I've switched from Webpack to using FuseBox bundler because it has first class TS support which seemed more suitable for my projects.

The changes were small and only tests are missing if anybody is interested in taking over.

bricss commented 5 years ago

Everyone who needs proper TS linting without artefacts, try to use https://github.com/Realytics/fork-ts-checker-webpack-plugin