Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to do auto Tslint in Intellij

I am using Intellij for doing angular project. I am getting a lot of tslint errors while writing the code.Is there any way to fix all the these lint errors in by using a command in intellij ?

like image 398
ark Avatar asked Jan 13 '18 16:01

ark


People also ask

What is the difference between TSLint and ESLint?

The biggest practical difference between TSLint and ESLint is the format of their configuration file, which stores the rules the linter uses to validate your code. We'll also need to update Angular to use ESLint when we run “ng lint”. Fortunately, angular-eslint's schematic handles both of these changes!

How do I turn off TS lint rule?

Comment flags in source code 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.

What does TSLint JSON do?

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.


2 Answers

You can create File Watcher in Settings > Tools by the following configuration:

enter image description here

On save (Ctrl + s), your current file will be fixed.

like image 150
Gregor Albert Avatar answered Oct 13 '22 03:10

Gregor Albert


One of the quick way to fix all the tslint errors would be to install visual studio code.

It will have the auto-fix option to fix option to fix all the issues

Event intellij has the option to do the same

Alt-Enter on the highlighted problem and select either TSLint: fix current problem to fix only this particular issue or TSLint: fix current file to apply the fixes when possible to the whole file.

enter image description here

like image 38
Sajeetharan Avatar answered Oct 13 '22 03:10

Sajeetharan