TS linter

Edit on GitHub
No longer supported

Since the 202307.0 release, this tool is no longer supported and has been replaced by ESLint. To migrate to ESLint, follow Migration guide - Switch from TSLint to ESLint.

TS Linter allows you to find and fix code style mistakes. It helps a team follow the same standards and make code more readable.

To analyze and fix files, TSLint is used.

Installation

For details about how to install the TS Linter for your project, see the TS Linter integration file.

Using TS Linter

To execute the TS Linter, do the following:

  1. Install the Node.js modules:
npm ci
  1. Execute the TS Linter in:
  • validation mode:
npm run yves:tslint
  • fix mode:
npm run yves:tslint:fix

TS Linter config

The config for tslint resides in /tslint.json.

To redefine the path for the config, adjust /frontend/libs/tslint.js and use other rules for the TS Linter.

The TS Linter rules related to formatting aren’t included in tslint.json to avoid duplication with the Prettier rules.

CI checks and pre-commit hook

The TS Linter is integrated into:

  • Pre-commit hooks.

The function that executes TS Linter before the commit resides in /.githook

- GitHook\Command\FileCommand\PreCommit\TsLintCommand
  • Travis.

Command to run the TS Linter is integrated into .travis.yml

- node ./frontend/libs/tslint --format stylish
Important

If you commit without the pre-commit hooks, you should run the TS Linter manually to avoid issues with Travis.

Pre-commit hooks weren’t integrated into B2B and B2C Demo Shops, only in the Shop Suite.