I am developing angular2 app with visual studio code, I have installed the following extensions,
htmllint
and
htmlhint-ng2
I have the component template as follows,
@Component({
selector: 'userprofile',
template: `
<div class="profilecontainer">
<div class="row">
<img [src]="profile.profilePic" />
<div class="row">
<h2>{{profile.firstName}} {{profile.lastName}} </h2>
<a target="_blank" href="{{profile.detailUrl}}"> View profile</a>
<a target="-blank" href="{{profile.editUrl}}">Edit profile</a>
</div>
</div>`
})
Hml lint does not show any errors on vs code? what is the issue?
Go to the Extensions view (Ctrl+Shift+X) and type 'html' to see a list of relevant extensions to help with creating and editing HTML.
Right now, you can't.
In order to add extra features (i.e. linting) to VS Code you must use an extension made for it and unfortunately, by the time of this answer, there isn't any htmllint
VS Code extension.
Please note that both links you shared are node modules and not extensions. Installing something with with npm
(i.e. npm install htmllint
) will not make it work with VS Code.
You can browse and install extensions from within VS Code, as describe in it docs, like this:
Bring up the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of VS Code or the View: Extensions command (⇧⌘X).
If you can't find the extension you need, you have a few options:
Suggested Alternative:
npm i htmlhint-ng2 -D
)Add its cli command to a package.json
script:
"scripts": {
"lint:html": "htmlhint-ng2 src/**/*.html"
}
npm run lint:html
npm i npm-watch -D
Add the watch script and config to package.json
"watch": {
"lint:html": "src/**/*.html"
},
"scripts": {
"lint:html": "htmlhint-ng2 src/**/*.html"
"watch": "npm-watch"
}
npm run watch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With