Skip to content

Incorrect links to rule docs #867

Closed
@pdehaan

Description

@pdehaan

Describe the bug

Also spotted that my JSON output when using the API gives me links like "https://github.com/thedaviddias/HTMLHint/wiki/alt-require", which seems to redirect to generic https://github.com/htmlhint/HTMLHint homepage.
Not sure if those should redirect to the rules/*.md files directly (a la https://github.com/htmlhint/HTMLHint/blob/master/docs/user-guide/rules/alt-require.md) or the website pages at https://htmlhint.com/docs/user-guide/rules/alt-require. I think the latter is preferred, but probably requires #698.

    {
      "type": "warning",
      "message": "An alt attribute must be present on <img> elements.",
      "raw": "<img src=\"/img/svg/vpn.svg\">",
      "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/vpn.svg\">",
      "line": 75,
      "col": 22,
      "rule": {
        "id": "alt-require",
        "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
        "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
      }
    },

To Reproduce
Lint some stuff using the API or just use the json formatter.

npx htmlhint https://monitor.firefox.com/ --rules=alt-require --format=json
[
  {
    "file": "https://monitor.firefox.com/",
    "messages": [
      {
        "type": "warning",
        "message": "An alt attribute must be present on <img> elements.",
        "raw": "<img src=\"/img/svg/laptop.svg\">",
        "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/laptop.svg\">",
        "line": 65,
        "col": 22,
        "rule": {
          "id": "alt-require",
          "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
          "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
        }
      },
      {
        "type": "warning",
        "message": "An alt attribute must be present on <img> elements.",
        "raw": "<img src=\"/img/svg/globe.svg\">",
        "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/globe.svg\">",
        "line": 70,
        "col": 22,
        "rule": {
          "id": "alt-require",
          "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
          "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
        }
      },
      {
        "type": "warning",
        "message": "An alt attribute must be present on <img> elements.",
        "raw": "<img src=\"/img/svg/vpn.svg\">",
        "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/vpn.svg\">",
        "line": 75,
        "col": 22,
        "rule": {
          "id": "alt-require",
          "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
          "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
        }
      }
    ],
    "time": 231
  }
]

Expected behavior
Rule links in JSON reporter/formatter should redirect to documentation.

Screenshots
n/a

Desktop (please complete the following information):

  • OS: macOS 12.1
  • Browser: Node 17.x
  • Version: n/a

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions