mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
* [htmlhint] Add type definition for version 1.1.0 * add private methods/properties Co-authored-by: Martin Badin <MBadin@gohealth.com>
35 lines
890 B
TypeScript
35 lines
890 B
TypeScript
import { HTMLHint } from 'htmlhint';
|
|
import { Rule, Ruleset } from 'htmlhint/types';
|
|
|
|
const htmlHintRules: Ruleset = {
|
|
'tagname-lowercase': true,
|
|
'attr-lowercase': true,
|
|
'attr-value-double-quotes': true,
|
|
'doctype-first': true,
|
|
'tag-pair': true,
|
|
'spec-char-escape': true,
|
|
'id-unique': true,
|
|
'src-not-empty': true,
|
|
'attr-no-duplication': true,
|
|
'title-require': true,
|
|
'space-tab-mixed-disabled': 'tab',
|
|
};
|
|
|
|
const rule: Rule = {
|
|
id: 'custom-rule',
|
|
description: 'Custom rule',
|
|
link: '../custom-rule',
|
|
init(parser, reporter) {
|
|
parser; // $ExpectType HTMLParser
|
|
reporter; // $ExpectType Reporter
|
|
},
|
|
};
|
|
|
|
HTMLHint.addRule(rule); // $ExpectType void
|
|
|
|
// $ExpectType Hint[]
|
|
const result = HTMLHint.verify('<span></span>', htmlHintRules);
|
|
|
|
// $ExpectType string[]
|
|
const formatted = HTMLHint.format(result, { indent: 2 });
|