Open dagda1 opened 5 years ago
Problems occur with webpack 4
together with gulp/webpack-stream
. In this case the fileName is omitted completely leaving:
[3, 17]: Type boolean trivially inferred from a boolean literal, remove type annotation
while e.g ts-loader
displays:
[tsl] ERROR in path/to.ts(35,5)
TS2531: Object is possibly 'null'.
@almondtools any workaround? I'm experiencing the same issue. Super frustrating when enabling tslint on an existing codebase. Could take a long time to hunt down these errors.
I tried to fix this issue in a fork, yet this lets every unit test fail. So this would have meant a complete API change and I think it should be confirmed by the project owner.
However I found out that a custom formatter has access to more information. Look at the file customFormatter.js and prepend failure.fileName
to positionTuple
. To include a custom formatter you have to configure the formatter directory and the name of the new formatter.
Took some trial-and-error to get it right.
Options:
{
formatter: 'michael',
formattersDirectory: 'tslint-formatters'
}
I created the file tslint-formatters/michaelFormatter.js
and copied/pasted the contents of customFormatter.js linked above. I made the one tweak @almondtools mentioned. No need to change the Formatter name in the file.
Thanks for the help!
I have my tslint-loader configured like this:
Is there a way to improve the error messages from this: