Make ESLint or TSLint Automatic in IntelliJ

Batuhan Kök
2 min readApr 7, 2023

--

Static code analysis is an essential part of the development life cycle (SDLC) for every platform. It brings numerous benefits to our lives, such as ensuring code readability, maintaining uniform styling across the team, and preventing unnecessary conflicts.

Before automating the process, we must understand what ESLint and TSLint are and why we use them.

What is ESLint?

ESLint is an open-source project that assists in identifying and resolving issues in your JavaScript code. Whether you’re writing JavaScript in a browser or on a server, with or without a framework, ESLint can help improve the quality of your code.

Additionally, ESLint is integrated into most text editors, and you can execute it as part of your continuous integration pipeline.

What is TSLint?

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, TSLint is currently deprecated, and the recommended alternative is to migrate to Angular ESLint (even though TSLint is still usable).

How Can We Do?

It’s really easy and straightforward. You need to follow the instructions below. The example provided is for TSLint, but it can also be used for ESLint. However, you must update the “Program” field accordingly.

  1. Open Intellij Webstorm
  2. On the menu navigate to File > Settings
  3. Find and open Tools > File Watchers
  4. Click the Plus(+) button
How to create a new file watcher in Intellij Webstorm

You can use all information in the screenshot by modifying the “Program” fields to use the local path of TSLint. Additionally, if your “tslint.json” file is not located in the root folder of the project, you need to set it correctly in the “Arguments” field.

File Watcher Settings in Intellij Webstorm

Example TSLint.json

I suggest you to use ESLint or migrate to it but if you want to continue to use TSLint, you can find an example tslint.json here.

Good luck!

--

--