Reputation: 726
It seems wrong that Typescript compilation fails with non-critical errors, although the strict code analysis is very helpful.
eg Consecutive blank lines are forbidden
, or with unused variables/definitions when in development. Particularly the first one, since they are being compiled out.
Is there a way of downgrading or removing error messages based on type? I know we can....
// @ts-ignore
... for individual errors, but I am looking for a broader brush.
Upvotes: 1
Views: 1903
Reputation: 3396
I believe Consecutive blank lines are forbidden
is coming from the linter. It can be disabled in tslint.json
with the following configurtion (TSLint core rules):
"no-consecutive-blank-lines": false,
"no-unused-variable": false
Each rule can also be associated with an object containing severity: "default" | "error" | "warning" | "off"
(Configuring TSLint). So you could use the following to downgrade to warnings:
"no-consecutive-blank-lines": { "severity": "warning" },
"no-unused-variable": { "severity": "warning" }
No unused variables/definitions may also have to be disabled in tsconfig.json
(TypeScript compiler options):
"noUnusedLocals": false
I would like to note tslint has options to autofix the errors like consecutive blank lines using the --fix
flag. VS Code for example has an option to autofix linting errors on save, with this enabled the linter is a lot less of a hindrance during dev.
Upvotes: 3