标签: htmllint

如何在vs代码中启用HTML上的lint?

我正在使用visual studio代码开发angular2应用程序,我已经安装了以下扩展,

htmllint

htmlhint-ng2

我有如下组件模板,

@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>`
})
Run Code Online (Sandbox Code Playgroud)

Hml lint在vs代码上没有显示任何错误?问题是什么?

visual-studio-code htmllint angular

6
推荐指数
2
解决办法
3544
查看次数

防止gulp-htmllint跳过无效的html文件

我正在使用gulp-htmllint检查带有html片段的文件.但令我惊讶的是,它会跳过带有无效标记的文件.我希望得到"尽可能好"的linting,但至少我希望它失败/报告无效html上的错误.

这是一个复制品.首先gulpfile.js(npm install事先需要适当的命令):

var gulp = require("gulp"),
    gutil = require('gulp-util'),
    htmllint = require("gulp-htmllint"), 
    path = require('path');

gulp.task("default", [], function() {
    return gulp.src("src/*.html")
        .pipe(htmllint({}, reporter));
});

function reporter(filepath, issues) {
    var filename = path.basename(filepath);
    if (issues.length > 0) {
        issues.forEach(function (issue) {
            gutil.log(gutil.colors.cyan('[lintHtml] ') + gutil.colors.white(filename + ' [' + issue.line + ',' + issue.column + ']: ') + gutil.colors.red('(' + issue.code + ') ' + issue.msg));
        });
        process.exitCode = 1; …
Run Code Online (Sandbox Code Playgroud)

html gulp htmllint

2
推荐指数
1
解决办法
461
查看次数

标签 统计

htmllint ×2

angular ×1

gulp ×1

html ×1

visual-studio-code ×1