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 | 1 37 36 1 4 2 | /** * @file rule: rel-stylesheet * @author nighca<nighca@live.cn> */ module.exports = { name: 'rel-stylesheet', desc: 'Attribute "rel" of <link> should be set as "stylesheet".', lint: function (enable, document, reporter) { if (!enable) { return; } document.querySelectorAll('link').forEach(function (element) { if (!element.getAttribute('rel')) { reporter.warn(element, '022', 'Attribute "rel" of <link> should be set as "stylesheet".'); } }); } }; |