Type ng lint
C:\Windows\System32\AngularDemo>ng lint
Linting "AngularDemo"...
All files pass linting.
Linting "AngularDemo-e2e"...
All files pass linting.
-------------------------------------------------------------------------------------------------------------------------
See the above. When we type ng lint it will check all type of errors in the current project. If it found any errors then it will immediately report.
linting is the tool that checks TypeScript code for programmatic and stylistic errors as well as non-adherence to coding standards and conventions. tslint.json is the configuration file for linting. This file contains all the default rules for linting.
linting rules:
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 install the linting extension in Visual studio code:
Different option for lint
To see the options that can be used with ng lint command, use
ng lint --help
Runs linting tools on Angular app code in a given project folder.
usage: ng lint <project> [options]
arguments:
project
The name of the project to lint.
options:
--configuration (-c)
Specify the configuration to use.
--exclude
Files to exclude from linting.
--files
Files to include in linting.
--fix
Fixes linting errors (may overwrite linted files).
--force
Succeeds even if there were linting errors.
--format
Output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist).
--help
Shows a help message for this command in the console.
--silent
Show output text.
--ts-config
The name of the TypeScript configuration file.
--tslint-config
The name of the TSLint configuration file.
--type-check
Controls the type check for linting.
C:\Windows\System32\AngularDemo>ng lint
Linting "AngularDemo"...
All files pass linting.
Linting "AngularDemo-e2e"...
All files pass linting.
-------------------------------------------------------------------------------------------------------------------------
See the above. When we type ng lint it will check all type of errors in the current project. If it found any errors then it will immediately report.
linting is the tool that checks TypeScript code for programmatic and stylistic errors as well as non-adherence to coding standards and conventions. tslint.json is the configuration file for linting. This file contains all the default rules for linting.
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 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 install the linting extension in Visual studio code:
- Click on the "View" menu in "Visual Studi Code" and select "Extensions" from the context menu
- In the "Search Extensions in Marketplace" textbox type TSLint
- Click the "install" button
- Once installed, restart Visual Studio Code to activate TSLint
- Click on the "View" menu in "Visual Studi Code" and select "Extensions" from the context menu
- In the "EXTENSIONS" window, expand "INSTALLED" section
- Click the "SETTINGS" icon against TSLint extension
- Select "Disable (Always)" option
Different option for lint
To see the options that can be used with ng lint command, use
ng lint --help
Runs linting tools on Angular app code in a given project folder.
usage: ng lint <project> [options]
arguments:
project
The name of the project to lint.
options:
--configuration (-c)
Specify the configuration to use.
--exclude
Files to exclude from linting.
--files
Files to include in linting.
--fix
Fixes linting errors (may overwrite linted files).
--force
Succeeds even if there were linting errors.
--format
Output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist).
--help
Shows a help message for this command in the console.
--silent
Show output text.
--ts-config
The name of the TypeScript configuration file.
--tslint-config
The name of the TSLint configuration file.
--type-check
Controls the type check for linting.
No comments:
Post a Comment