1 | ;
|
2 |
|
3 | /**
|
4 | * @param { import("../lib/css-analyzer") } analyzer
|
5 | */
|
6 | function rule(analyzer) {
|
7 | analyzer.setMetric("emptyRules");
|
8 |
|
9 | analyzer.on("rule", function (rule) {
|
10 | var properties = rule.declarations.filter(function (item) {
|
11 | return item.type === "declaration";
|
12 | });
|
13 |
|
14 | if (properties.length === 0) {
|
15 | analyzer.incrMetric("emptyRules");
|
16 | analyzer.addOffender("emptyRules", rule.selectors.join(", "));
|
17 | }
|
18 | });
|
19 | }
|
20 |
|
21 | rule.description = "Total number of empty CSS rules";
|
22 | module.exports = rule;
|