Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

Angular tslint rules

Suggested Videos
Part 12 - Angular cli generate directives, pipes and routing guards | Text | Slides
Part 13 - Angular cli generate class, interface and enum | Text | Slides
Part 14 - Linting TypeScript | Text | Slides

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.

angular cli tutorial for beginners

No comments:

Post a Comment

If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.