When we are working on an angular project, when editing .ts files, we may not code so standardly, such as variable definitions, spaces, quotation marks, etc.
We can use the following command to check the warning warning generated in the project.
C:\project\colors>ng lint Linting "colors"...
ERROR: C:/project/colors/src/app/app.component.ts:1497:17 - Unnecessarily quoted property 'strength' found.
ERROR: C:/project/colors/src/app/app.component.ts:1497:17 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1517:1 - space indentation expected
ERROR: C:/project/colors/src/app/app.component.ts:1517:6 - Identifier 'a' is never reassigned; use 'const' instead of 'let'.
ERROR: C:/project/colors/src/app/app.component.ts:1517:10 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1518:5 - statements are not aligned
ERROR: C:/project/colors/src/app/app.component.ts:1519:5 - statements are not aligned
ERROR: C:/project/colors/src/app/app.component.ts:1522:25 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1523:1 - space indentation expected
ERROR: C:/project/colors/src/app/app.component.ts:1523:2 - statements are not aligned
ERROR: C:/project/colors/src/app/app.component.ts:1523:4 - missing whitespace
ERROR: C:/project/colors/src/app/app.component.ts:1523:17 - == should be ===
ERROR: C:/project/colors/src/app/app.component.ts:1523:20 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1523:24 - missing whitespace
ERROR: C:/project/colors/src/app/app.component.ts:1524:1 - space indentation expected
ERROR: C:/project/colors/src/app/app.component.ts:1524:15 - " should be '
ERROR: C:/project/colors/src/app/app.component.ts:1525:1 - space indentation expected
Lint errors found in the listed files.
As shown below:
How do I fix these warnings?
The command is as follows:
Errors that can be automatically fixed include: missing whitespace, Missing semicolon, " should be ', misplaced 'else', file should end with a newline, trailing whitespace, Unnecessary semicolon, Identifier 'XXX' is never reass
Using the auto-fix warning command may not fix all warnings,If it cannot be corrected automatically, we need to fix the warning manually。
|