-
-
Notifications
You must be signed in to change notification settings - Fork 428
Closed
Description
Describe the bug
None of my custom rules seem to work.
Bellow is a testing rule I have setup (linting/htmlhint/no-div.js):
module.exports = HTMLHint => {
HTMLHint.addRule({
id: 'no-div',
description: 'Description of my rule',
init(parser, reporter) {
const self = this;
parser.addListener('tagstart', event => {
const tagName = event.tagName.toLowerCase();
if (tagName === 'div') {
reporter.warn('Do not use divs!', event.line, event.col, self, event.raw);
}
});
},
});
};.htmlhintrc:
{
"rulesdir": ["linting/htmlhint"],
"no-div": true,
"tagname-lowercase": false,
"attr-lowercase": false,
"attr-value-double-quotes": true,
"doctype-first": false,
"tag-pair": true,
"spec-char-escape": true,
"id-unique": true,
"src-not-empty": true,
"attr-no-duplication": true,
"title-require": true
}test file (test.html):
<div>test</div>I run npx htmlhint, which finds the right config file, but my rule does not trigger.
To Reproduce
Steps to reproduce the behavior:
- Use
npm install --save-dev htmlhint@1.1.4 - Recreate the file structure as described in the description
- run
npx htmlhint, which finds the right config file, but my rule does not trigger. - No linting errors reported
Expected behavior
An error should be reported that I am using a div
Edit: I already tried the following;
- Using differnet paths for the
rulesdiroption - Different implementations for my rule file
Metadata
Metadata
Assignees
Labels
No labels
