htmlcs
Version:
html hint tool, focused on semantic code style.
31 lines (23 loc) • 625 B
JavaScript
/**
* @file rule: attr-lowercase
* @author nighca<nighca@live.cn>
*/
module.exports = {
name: 'attr-lowercase',
desc: 'Attribute name must be lowercase.',
target: 'parser',
lint: function (getCfg, parser, reporter) {
parser.tokenizer.on('attribname', function (name) {
if (!getCfg()) {
return;
}
if (name !== name.toLowerCase()) {
reporter.warn(
this._sectionStart,
'029',
'Attribute name must be lowercase.'
);
}
});
}
};