Skip to content

Commit

Permalink
chore(htmlhint): adding support for a white list of elements that can…
Browse files Browse the repository at this point in the history
… be lower case. (#188)

When enabling the rule instead of using a boolean, use an array with the attributes (camelCased) that you want to ignore
```json
{
  "tagname-lowercase": ["clipPath"]
}
```
  • Loading branch information
aaronkahlhamer authored and thedaviddias committed Sep 3, 2018
1 parent d4972d4 commit 5cf8348
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rules/tagname-lowercase.js
@@ -1,11 +1,12 @@
HTMLHint.addRule({
id: 'tagname-lowercase',
description: 'All html element names must be in lowercase.',
init: function(parser, reporter){
init: function(parser, reporter, options){
var self = this;
var exceptions = Array.isArray(options) ? options : [];
parser.addListener('tagstart,tagend', function(event){
var tagName = event.tagName;
if(tagName !== tagName.toLowerCase()){
if (exceptions.indexOf(tagName) === -1 && tagName !== tagName.toLowerCase()){
reporter.error('The html element name of [ '+tagName+' ] must be in lowercase.', event.line, event.col, self, event.raw);
}
});
Expand Down

0 comments on commit 5cf8348

Please sign in to comment.