Skip to content

[BUG] lowercase rule does not check for lowercased doctype #410

@Nightfirecat

Description

@Nightfirecat

Describe the bug
Per the title, a file containing an uppercased doctype or attribute (eg. <!DOCTYPE html>, <!doctype HTML>, or any variety of capitalization) will not trip this rule nor be fixable.

To Reproduce
Run against any HTML file containing a doctype containing uppercase characters.

Expected behavior
Warnings and/or fixes available indicating the doctype not being fully lowercased.

Additional context
Per the current HTML spec, both the doctype opening and attribute are to be matched case-insensitively. This also seems to have been the case in the HTML5 spec, as old as 2011.

P.S. I've implemented this fix/feature in https://github.com/Nightfirecat/html-eslint/commits/feat-check-lowercase-doctype/ and would be happy to submit it for review if that would be helpful. I'm not wild about how much of the code is more or less copied from the existing check() function, but the type incompatibilities between Doctype and the existing Tag | StyleTag | ScriptTag check method worked against my attempts to use a single generalized check method.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions