HI WELCOME TO SIRIS

Angular tslint rules

Leave a Comment

In this video we will discuss some of the common angular linting rules in tslint.json file. You may modify these rules depending on your project requirements.


Here are some of the common linting rules
  • quotemark rule specifies whether you want single or double quotes
  • no-trailing-whitespace rule disallows trailing whitespace at the end of a line
  • semicolon rule specifies that a line should be terminated with a semicolon
  • comment-format rule specifies that all single-line comments must begin with a space
  • component-class-suffix rule enforces that a component class should end with the suffix Component
  • use-life-cycle-interface rule enforces that you add the implements keyword for every lifecycle hook you use

Some of the linting errors support automatic fix. To have these linting errors fixed automatically, run ng lint command with the --fix option.
ng lint --fix

To see the options that can be used with ng lint command, use
ng lint --help

At the moment, Visual Studio Code is not able to show any linting rule violations. In our next video, we will discuss how to display linting errors in Visual Studio Code so we can fix them as we are writing code.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.