Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Why is the typescript-eslint project written in typescript?


Asked by Brynn Richardson on Dec 13, 2021 TypeScript



Because the typescript-eslint project is written in TypeScript, your rule and its configuration are completely typesafe. If you make a typo while writing the message id, the compiler will not compile and throw an error at you. This is also the case if the rule can be configured, which comes in handy while writing tests for configurable rules.
Additionally,
To add ESLint to a TypeScript project, we need to install the eslint npm package: We need a couple of additional packages to allow ESLint to work with TypeScript: @typescript-eslint/parser: This parses TypeScript code to be linted. @typescript-eslint/eslint-plugin: This contains some standard linting rules for TypeScript code.
Also Know, When it comes to linting TypeScript code, there are two major linting options to choose from: TSLint and ESLint. TSLint is a linter than can only be used for TypeScript, while ESLint supports both JavaScript and TypeScript.
Indeed,
ESLint is a JavaScript linter that enables you to enforce a set of style, formatting, and coding standards for your codebase. It looks at your code, and tells you when you're not following the standard that you set in place. You may have also heard of TSLint, the TypeScript equivalent.
Subsequently,
In the TypeScript 2019 Roadmap, the TypeScript core team explains that ESLint has a more performant architecture than TSLint and that they will only be focusing on ESLint when providing editor linting integration for TypeScript. For that reason, I would recommend using ESLint for linting TypeScript projects.