Skip to content

[WIP] Update: add htmlhint - #758

Closed
aladdin-add wants to merge 1 commit into
masterfrom
unknown repository
Closed

[WIP] Update: add htmlhint#758
aladdin-add wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@aladdin-add

Copy link
Copy Markdown
Contributor

fixes #210

@maxmilton

maxmilton commented Jun 23, 2017

Copy link
Copy Markdown

Should we provide a .htmlhintrc file with some preset defaults too?

Edit: Just read https://github.com/yaniswang/HTMLHint/wiki/Usage#how-to-use and saw if .htmlhintrc is missing it will use a default set of rules:

{
    "tagname-lowercase": true,
    "attr-lowercase": true,
    "attr-value-double-quotes": true,
    "doctype-first": true,
    "tag-pair": true,
    "spec-char-escape": true,
    "id-unique": true,
    "src-not-empty": true,
    "attr-no-duplication": true,
    "title-require": true
}

Seems reasonable but maybe we should have a comment with a link to that page? Or to: https://github.com/yaniswang/HTMLHint/wiki/Rules

@maxmilton

maxmilton commented Jun 23, 2017

Copy link
Copy Markdown

Also, should this be an option together with ESLint or should it be a separate option during vue-cli init time? I'm not sure which is better to be honest. Thoughts anyone?

@nickmessing

Copy link
Copy Markdown

@aladdin-add, @maxmilton, I think having a separate option would be better than combining it with eslint since the whole vue ecosystem is non-opinionated and highly configurable, even tho I think nobody will use just one of them.

test: /\.html/,
enforce: 'pre',
loader: 'htmlhint-loader',
exclude: /node_modules/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be wrapped in {{#lint}}...{{/lint}} just like eslint-loader or have another key in meta.js something like htmlLint

Comment thread template/package.json
"eslint-friendly-formatter": "^2.0.7",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^2.0.0",
"htmlhint-loader": "1.3.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above comment

@nickmessing

Copy link
Copy Markdown

I think, just like @maxmilton said, there should be .htmlhintrc and it would be nice to add htmllint src/**/*.vue to scripts in package.json I think.

@aladdin-add aladdin-add changed the title Update: add htmlhint [WIP] Update: add htmlhint Jun 23, 2017
@aladdin-add

Copy link
Copy Markdown
Contributor Author

I got an error running npm run dev, after adding this loader.
image

there are two issues here:

  • showing "Failed to compile with 1 errors", it is no much helpful to a user. can we change some config to show more info?
  • why this error? I just followed the htmlhint-loader's docs, did I forget something?

@maxmilton

Copy link
Copy Markdown

Looks like there might soon be a solution for the blank error in friendly-errors-webpack-plugin, see this PR: geowarin/friendly-errors-webpack-plugin#52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants