How to use the stylelint.utils.validateOptions function in stylelint

To help you get started, we’ve selected a few stylelint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kristerkari / stylelint-scss / src / rules / at-mixin-argumentless-call-parentheses / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(result, ruleName, {
      actual: value,
      possible: ["always", "never"]
    });

    if (!validOptions) {
      return;
    }

    root.walkAtRules("include", mixinCall => {
      // If it is "No parens in argumentless calls"
      if (
        value === "never" &&
        mixinCall.params.search(/\(\s*?\)\s*?$/) === -1
      ) {
        return;
      }
github kristerkari / stylelint-scss / src / rules / at-rule-no-unknown / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(
      result,
      ruleName,
      {
        actual: primaryOption
      },
      {
        actual: secondaryOptions,
        possible: {
          ignoreAtRules: [isRegExp, isString]
        },
        optional: true
      }
    );

    if (!validOptions) {
      return;
github kristerkari / stylelint-scss / src / rules / dollar-variable-empty-line-before / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(
      result,
      ruleName,
      {
        actual: expectation,
        possible: ["always", "never"]
      },
      {
        actual: options,
        possible: {
          except: ["first-nested", "after-comment", "after-dollar-variable"],
          ignore: ["after-comment", "inside-single-line-block"],
          disableFix: isBoolean
        },
        optional: true
      }
    );
github kristerkari / stylelint-scss / src / rules / at-mixin-named-arguments / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(
      result,
      ruleName,
      {
        actual: expectation,
        possible: ["always", "never"]
      },
      {
        actual: options,
        possible: {
          ignore: ["single-argument"]
        },
        optional: true
      }
    );

    if (!validOptions) {
github kristerkari / stylelint-scss / src / rules / at-if-closing-brace-newline-after / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(
      result,
      ruleName,
      {
        actual: expectation,
        possible: ["always-last-in-chain"]
      },
      {
        actual: options,
        possible: {
          disableFix: isBoolean
        },
        optional: true
      }
    );

    if (!validOptions) {
github YozhikM / stylelint-a11y / src / rules / selector-pseudo-class-focus / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(result, ruleName, { actual });

    if (!validOptions || !actual) {
      return;
    }

    root.walkRules(rule => {
      let selector = null;

      if (!isStandardSyntaxRule(rule)) {
        return;
      }

      selector = rule.selector;

      if (!selector) {
        return;
github kristerkari / stylelint-scss / src / rules / double-slash-comment-whitespace-inside / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(result, ruleName, {
      actual: expectation,
      possible: ["always", "never"]
    });

    if (!validOptions) {
      return;
    }

    eachRoot(root, checkRoot);

    function checkRoot(root) {
      const rootString = root.source.input.css;

      if (rootString.trim() === "") {
        return;
      }
github kristerkari / stylelint-scss / src / rules / dollar-variable-colon-space-before / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(result, ruleName, {
      actual: expectation,
      possible: ["always", "never"]
    });

    if (!validOptions) {
      return;
    }

    variableColonSpaceChecker({
      root,
      result,
      locationChecker: checker.before,
      checkedRuleName: ruleName,
      position: "before",
      expectation,
      context
github kristerkari / stylelint-react-native / src / rules / css-property-no-unknown / index.js View on Github external
return function(root, result) {
    const validOptions = utils.validateOptions(
      result,
      ruleName,
      {
        actual
      },
      {
        actual: options,
        possible: {
          ignoreProperties: [isString]
        },
        optional: true
      }
    );

    if (!validOptions) {
      return;
github kristerkari / stylelint-scss / src / rules / no-duplicate-mixins / index.js View on Github external
return (root, result) => {
    const validOptions = utils.validateOptions(result, ruleName, {
      actual: value
    });

    if (!validOptions) {
      return;
    }

    const mixins = {};

    root.walkAtRules(decl => {
      const isMixin = decl.name === "mixin";

      if (!isMixin) {
        return;
      }