I use react-scripts-ts
to generate React App and it supplies TSLint.
It seems like there's no option to tell react-scripts-ts
to exclude TSLint from the build pipeline. Is it possible to disable TSLint via tslint.json
?
P.S.
It's possible to disable it by adding comment to the file, but I don't want to add such comment to every TS file in the project.
In addition to global configuration, you may also enable/disable linting for a subset of lint rules within a file with the following comment rule flags: /* tslint:disable */ - Disable all rules for the rest of the file. /* tslint:enable */ - Enable all rules for the rest of the file.
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.
However, the TSLint team deprecated the project in 2019 and Angular followed suit in November 2020. Fortunately, thanks to tools from the Angular ecosystem migrating to ESLint is easier than you think.
If you don't want any TSLint rules to be enforced and are prepared to edit the tslint.json
file, you can just set its content to:
{}
With no rules defined, you will see this message written to the console:
No valid rules have been specified
But the TSLint process with terminate with an exit code of 0
and should not interfere with your build pipeline.
Or, if the message bugs you, define a single rule that's switched off:
{ "rules": { "no-var-keyword": false } }
Using @cartant's answer, I got some annoying output in the console saying something like 'Tried to lint a file, but found no valid/enabled rules...' for every single file in my project.
Anyways, in my tslint.json file, if I changed the extends property:
"extends": [
"tslint:recommended"
],
to be an empty array:
"extends": [],
It turned everything off for me and there was no longer any lint related warnings or noise in the console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With