1 | "use strict";
|
2 |
|
3 | var debug = require("debug")("analyze-css:prefixes"),
|
4 | format = require("util").format;
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function rule(analyzer) {
|
10 | var data = require(__dirname + "/prefixes.json"),
|
11 | prefixes = data.prefixes;
|
12 |
|
13 | debug("Using data generated on %s", data.generated);
|
14 | analyzer.setMetric("oldPropertyPrefixes");
|
15 |
|
16 | analyzer.on("declaration", function (rule, property, value) {
|
17 | var prefixData = prefixes[property];
|
18 |
|
19 |
|
20 | if (prefixData && !prefixData.keep) {
|
21 | analyzer.incrMetric("oldPropertyPrefixes");
|
22 | analyzer.addOffender(
|
23 | "oldPropertyPrefixes",
|
24 | format(
|
25 | "%s { %s: %s } // %s",
|
26 | rule.selectors.join(", "),
|
27 | property,
|
28 | value,
|
29 | prefixData.msg
|
30 | )
|
31 | );
|
32 | }
|
33 | });
|
34 | }
|
35 |
|
36 | rule.description = "Reports outdated vendor prefixes";
|
37 | module.exports = rule;
|