Sha256: d5d7a8d4949b9aa1015bb7e7be158d4565f9dbce9b2a086a25dc6241cce25d88
Contents?: true
Size: 1.52 KB
Versions: 24
Compression:
Stored size: 1.52 KB
Contents
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = _default; exports.messages = exports.ruleName = void 0; var _utils = require("../../utils"); var _stylelint = require("stylelint"); var ruleName = (0, _utils.namespace)("at-if-no-null"); exports.ruleName = ruleName; var messages = _stylelint.utils.ruleMessages(ruleName, { equals_null: "Expected @if not statement rather than @if statement == null", not_equals_null: "Expected @if statement rather than @if statement != null" }); exports.messages = messages; function _default(expectation) { return function (root, result) { var validOptions = _stylelint.utils.validateOptions(result, ruleName, { actual: expectation }); if (!validOptions) { return; } root.walkAtRules(function (atrule) { // Do nothing if it's not an @if if (atrule.name !== "if") { return; } // If rule != null and (expr), skip if (atrule.params.match(/\(?[ \t]*.* != null and .*\)?/)) { return; } if (atrule.params.match(/\(?[ \t]*.* == null[ \t]*\)?/)) { _stylelint.utils.report({ message: messages.equals_null, node: atrule, result: result, ruleName: ruleName }); } else if (atrule.params.match(/\(?[ \t]*.* != null[ \t]*\)?/)) { _stylelint.utils.report({ message: messages.not_equals_null, node: atrule, result: result, ruleName: ruleName }); } }); }; }
Version data entries
24 entries across 24 versions & 1 rubygems