@josundt/htmlhint-config

1.0.5 • Public • Published

@josundt/htmlhint-config

Ruleset for HTML code style and linting

Usage

  1. Install this package

  2. Add npm task in package.json

    {
      "scripts": {
        "lint:html": "htmlhint src -c ./node_modules/@josundt/htmlhint-config/.htmlhintrc --format unix"
      }
    }
  3. When using Visual Studio Code:

    a) Install the htmllint extension ("htmlhint.vscode-htmlhint"), and add it to the VSCode recommmended extensions for the workspace (".vscode/extensions.json").
    Then make sure the following two propeties are added to VSCode workspace settings (".vscode/settings.json"):

    {
      // ...
      "htmlhint.documentSelector": ["html", "ejs"],
      "htmlhint.configFile": "./node_modules/@josundt/htmlhint-config/.htmlhintrc",
      // ...
    }

    b) Add a task in ".vscode/tasks.json" to run sass-lint as a VSCode task for the whole workspace:

    {
      "version": "2.0.0",
      "runner": "terminal",
      "tasks": [
        {
          "label": "lint:html",
          "type": "shell",
          "command": "npx",
          "args": [
            "htmlhint",
            "src",
            "-c",
            "./node_modules/@josundt/htmlhint-config/.htmlhintrc",
            "--format",
            "unix"
          ],
          "group": "build",
          "presentation": {
            "echo": true,
            "reveal": "silent",
            "focus": false,
            "panel": "shared"
          },
          "problemMatcher": {
            "applyTo": "allDocuments",
            "severity": "error",
            "fileLocation": "absolute",
            "source": "lint:sass",
            "pattern": [
              {
                "regexp": "(.*):(\\d+):(\\d+): (.*)",
                "file": 1,
                "line": 2,
                "column": 3,
                "message": 4
              }
            ]
          }
        }
      ]
    }

Readme

Keywords

Package Sidebar

Install

npm i @josundt/htmlhint-config

Weekly Downloads

0

Version

1.0.5

License

ISC

Unpacked Size

6.08 kB

Total Files

3

Last publish

Collaborators

  • josundt