1 | "use strict";
|
2 |
|
3 | const format = require("util").format;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | function rule(analyzer) {
|
9 | analyzer.setMetric("importants");
|
10 |
|
11 | analyzer.on("declaration", function (rule, property, value) {
|
12 | if (value.indexOf("!important") > -1) {
|
13 | analyzer.incrMetric("importants");
|
14 | analyzer.addOffender(
|
15 | "importants",
|
16 | format("%s {%s: %s}", rule.selectors.join(", "), property, value)
|
17 | );
|
18 | }
|
19 | });
|
20 | }
|
21 |
|
22 | rule.description = "Number of properties with value forced by !important";
|
23 | module.exports = rule;
|