Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 3x 3x 3x 14x 3x 11x 11x 11x 11x 11x 4x 7x 7x 7x | import { utils } from "stylelint";
import { namespace } from "../../utils";
const declarationValueIndex = require("../../utils/declarationValueIndex");
export const ruleName = namespace("font-weight-no-ignored-values");
export const messages = utils.ruleMessages(ruleName, {
rejected: (weight) => `Unexpected font-weight "${weight}"`
});
const acceptedWeights = ["400", "700", "normal", "bold"];
export default function (actual) {
return function (root, result) {
const validOptions = utils.validateOptions(result, ruleName, {
actual
});
Iif (!validOptions) {
return;
}
root.walkDecls(/^font-weight$/i, (decl) => {
if (acceptedWeights.indexOf(decl.value) > -1) {
return;
}
const weightValueOffset = decl.value.indexOf(decl.value);
const index = declarationValueIndex(decl) + weightValueOffset;
utils.report({
message: messages.rejected(decl.value),
node: decl,
result,
ruleName,
index
});
});
};
}
|