A linter is a tool that analizes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. In particular, it helps teams to keep the code consistent between their members.
For example, with ESLint, the rule
@typescript-eslint/quotes: single enforces the use of single quotes throughout the code.
const foo = 'bar';
const foo = "bar";
ESLint & TypeScript
You can run the linting with this command:
npm run lint
And if the linting issues can be automatically fixed, you can also fix them with this command:
npm run lint:fix
Configuration with VSCode
Instructions to configure VSCode with ESLint and TypeScript can be found here.
Adding New Rules
The rules are specified in the
.eslintrc configuration file located at the root of the project.
Migrating from TSLint
In order to migrate from TSLint to ESLint, you can refer to this page. It lists all TSLint rules along side rules from the ESLint ecosystem that are identical or similar.