This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15367|Reply: 1

[Angular] Angular ng lint warning warning fix

[Copy link]
Posted on 5/26/2020 5:36:47 PM | | | |
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





Previous:cmd to set the permanent environment variable command
Next:js string inversion
 Landlord| Posted on 10/24/2024 3:04:57 PM |
ESLint is an open-source project that can help you find and fix problems in your JavaScript code. Whether your JavaScript is in the browser or on the server, using frameworks or not, ESLint can help make your code better.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com