UNPKG

458 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 analyzer.setMetric("mediaQueries");
10
11 analyzer.on("media", function (query, rules) {
12 analyzer.incrMetric("mediaQueries");
13 analyzer.addOffender(
14 "mediaQueries",
15 format("@media %s (%d rules)", query, rules.length)
16 );
17 });
18}
19
20rule.description = "Reports media queries";
21module.exports = rule;