UNPKG

556 BJavaScriptView Raw
1"use strict";
2
3var format = require("util").format;
4
5/**
6 * @param { import("../lib/css-analyzer") } analyzer
7 */
8function rule(analyzer) {
9 var re = /^expression/i;
10
11 analyzer.setMetric("expressions");
12
13 analyzer.on("declaration", function (rule, property, value) {
14 if (re.test(value)) {
15 analyzer.incrMetric("expressions");
16 analyzer.addOffender(
17 "expressions",
18 format("%s {%s: %s}", rule.selectors.join(", "), property, value)
19 );
20 }
21 });
22}
23
24rule.description = "Reports CSS expressions";
25module.exports = rule;