简体   繁体   中英

How config vscode for avoid the warnings on angular development

I am trying to find out how to avoid alert messages other than those that are directed to errors as such. Trying to follow some tutorials to learn angular I have found that the editor, in my case vs code, marks many errors, but these are warning.

For example:

Doctype must be declared first.(doctype-first)

Where it clearly says that DOCTYPE is needed like any html file, but it should be remembered that in angular, only that is done in the index or main html file.

The attribute name of [ *ngIf ] must be in lowercase.(attr-lowercase)

And in this case, it says that everything must be in lowercase, when they are embedded methods of the same framework and is stipulated in that way.

警告 1

The other

Properties should be separated by semicolons (semicolon)tslint(1)

When it is clearly in JSON format, which as an object is separated by commas mostly time.

警告 2

EDIT: After fixing the commas with semi-colons to create valid JSON, I still receive the following complaining about the String variable type:

警告 3


Here is the code in full in a GitHub Repo

That's strange, the HTML template error, as it seems like a vs code issue. Can you please try to ensure that you have the latest version of vs code or just try restarting your editor.

The error where it complains about the semicolon is a valid tslint rule based on tslint.json. Possible solutions to this is disable this rule by hovering over bulb icon on the error in your file and click on any suggestions you get to disable the rule for this file. Second approach is to go to your tslint.json and disable the rule for all files. Third one, if you don't want your vscode to show linting errors at all, you can just uninstall tslint or any other linting plugin that you may have added.

Ideally you should follow the linting rules. If I were you I would do neither of three and stick to what the angular team put in tslint file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM