1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1 37 35 2 2 1 1 | /** * @file rule: doctype * @author nighca<nighca@live.cn> */ module.exports = { name: 'doctype', desc: 'DOCTYPE needed.', lint: function (enable, document, reporter) { if (!enable || !document.querySelector('html')) { return; } var doctype = document.doctype; if (doctype) { Iif (doctype.data !== '!DOCTYPE html') { reporter.warn(doctype, '028', 'DOCTYPE must be html5'); } } else { reporter.warn(document, '009', 'DOCTYPE needed.'); } } }; |