Skip to content

Commit

Permalink
Add htmlhint (simple html linter) (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
dante0624 authored Feb 22, 2024
1 parent 99f9375 commit 6f6d866
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Other dedicated linters that are built-in are:
| [DirectX Shader Compiler][dxc] | `dxc` |
| [hadolint][28] | `hadolint` |
| [hlint][32] | `hlint` |
| [htmlhint][htmlhint] | `htmlhint` |
| [HTML Tidy][12] | `tidy` |
| [Inko][17] | `inko` |
| [janet][janet] | `janet` |
Expand Down Expand Up @@ -495,3 +496,4 @@ busted tests/
[regal]: https://github.com/StyraInc/regal
[vala-lint]: https://github.com/vala-lang/vala-lint
[systemdlint]: https://github.com/priv-kweihmann/systemdlint
[htmlhint]: https://htmlhint.com/
24 changes: 24 additions & 0 deletions lua/lint/linters/htmlhint.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local pattern = '.*: line (%d+), col (%d+), (%a+) %- (.+) %((.+)%)'
local groups = { 'lnum', 'col', 'severity', 'message', 'code' }
local severities = {
error = vim.diagnostic.severity.ERROR,
warning = vim.diagnostic.severity.WARN,
}

return {
cmd = "htmlhint",
stdin = true,
args = {
"stdin",
"-f",
"compact",
},
stream = "stdout",
ignore_exitcode = true,
parser = require('lint.parser').from_pattern(
pattern,
groups,
severities,
{ source = "htmlhint" }
)
}

0 comments on commit 6f6d866

Please sign in to comment.