htmlhint / htmlhint/HTMLHint

Support EJS files/tags

Open
#492 7 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core feature request keep-unstale triage
Dominant language
JavaScript
Stars
3.3k
Forks
474
Avg merge
1d 11h
Merged PRs (30d)
12

Description

Is your feature request related to a problem? Please describe.
HTMLHint appears to work well on *.ejs (EJS - Embedded JavaScript) files for the HTML parts, but the EJS templates trigger the spec-char-escape rule on the <% open and %> close tags for the embedded JS templating.

Describe the solution you'd like
In *.ejs files, HTMLHint should recognize the EJS start/stop tags and ignore the spec-char-escape tags at the minimum.

It's possible that everything between the tags should also be ignored, although there aren't many tags in EJS (plan <%, <%= for just variables, etc.) and most of it is just plain javascript.

Ideally, all the EJS tags and the javascript itself would all be linted.

Describe alternatives you've considered
I looked for other linters for EJS, at least supported by VS Code, didn't see anything.

I do use .htmlhintrc to disable the spec-char-escape rule:

{
    "spec-char-escape": false
}

but this is a less-than-ideal solution as it disables checking for that rule in all normal HTML code as well.

Additional context
In VS Code, this shows up as follows:
image

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by tracing how HTMLHint handles .ejs files and how the spec-char-escape rule processes EJS delimiters; define expected behavior for the supported tags, then add focused coverage for those cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.