やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

HTML Lintを試す

 最小限で。

前提

情報源

 紛らわしいけど、htmllinthtmlhintという別のツールがあるみたい。hintのほうが情報ありそうだが、lintしか成功しなかった。

手順

htmllint

インストールする

sudo npm install -gD htmllint-cli

バージョン&ヘルプ確認

$ htmllint --version
0.0.7
$ htmllint --help
Lints html files with htmllint.
Usage: htmllint [OPTIONS] [ARGS]

オプション:
  --help     ヘルプを表示                                                 [真偽]
  --version  バージョンを表示                                             [真偽]
  --rc       path to a htmllintrc file to use (json)          [デフォルト: null]
  --cwd      path to use for the current working directory    [デフォルト: null]

例:
  htmllint                lints all html files in the cwd and all child
                          directories
  htmllint init           creates a default .htmllintrc in the cwd
  htmllint *.html         lints all html files in the cwd
  htmllint public/*.html  lints all html files in the public directory

設定ファイルを作成する

htmllint init

テスト用HTMLファイルを作る

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>タイトル</title>
</head>
<body>
    <p>閉じタグ忘れ
</body>
</html>

実行する

$ npx htmllint
index.html: line 8, col 5, tag is not closed

[htmllint] found 1 errors out of 1 files

 出た。

htmllint

インストールする

sudo npm install -gD htmlhint-cli

 なんか怒られた。

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

added 79 packages, and audited 80 packages in 13s

5 packages are looking for funding
  run `npm fund` for details

10 vulnerabilities (9 high, 1 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

 使えねー。残念でした。

対象環境

$ uname -a
Linux raspberrypi 5.10.63-v7l+ #1496 SMP Wed Dec 1 15:58:56 GMT 2021 armv7l GNU/Linux