How ESLint Helps Developers to Write Better Code

By September 9, 2020AMA, Blog, ESLint

In the OpenJS Foundation “Ask Me Anything” (AMA) series, we get to hear from many inspiring leaders in the JavaScript community. We will highlight the key questions answered by the panel members and provide resources to help developers save time and improve their code. This month, we feature ESLint.

In the middle of a project it can be difficult to identify redundant or problematic sections of code. Frustrations compound when multiple developers, all using different styles, need to collaborate and write using a unified format. However, the aforementioned problems can be avoided with gentle reminders and automated feedback.

This is where linters come in. Linters are essentially spell checkers for code. They highlight syntax errors, refactoring opportunities and style/formatting issues as code is written. This helps developers to notice and fix small errors before they become a major problem. ESLint is an especially powerful tool that identifies problematic sections of code based on the user’s plugins, rules and configurations. Due to its flexibility, it has become an incredibly popular addition to many projects. Kai Cataldo, a maintainer of ESLint, and Brandon Mills, a member of the Technical Steering Committee, answered questions and explained how to get started with the OpenJS project in a recent AMA. 

In the talk, Cataldo clarified that ESLint is designed to help developers write the code they want. It should not tell them whether their code is “right” or “wrong” unless the error is code-breaking. The default settings of ESLint help developers to recognize syntax errors early on, but the tool can be made more powerful with the addition of user defined rules or downloadable configurations. Additionally, teams can standardize code across a team by defining a set of rules for the linter. Therefore, developers save time by writing consistent code that can be easily understood by other members. 

Cataldo and Mills also revealed future plans for ESLint — updated documentation, simplified configuration and parallel linting. They also discussed common problems of linters and how developers can contribute to the project to make ESLint even more powerful. 

Full AMA Replay

You can find the full AMA broken up by section below: 

0:57 Member Introductions 

3:19 Background of ESLint

5:55 What is a linter?

11:42 Why ESLint is moving away from correcting styling “errors” 

13:32 Future plans for ESLint

21:57 Will you add HTML linting? 

26:15 Exciting features in newest release

27:35 What is the most controversial linting rule? 

29:39 How to get started

32:25 Why doesn’t ESLint have default configurations? 

36:44 How to contribute

For those interested in becoming involved in the projects please check out the following resources: