How to use the stylelint/lib/utils/isCustomSelector 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 YozhikM / stylelint-a11y / src / rules / media-prefers-reduced-motion / index.js View on Github external
function check(selector, node) {
  const declarations = node.nodes;
  const params = node.parent.params;
  const parentNodes = node.parent.nodes;

  if (!declarations) return true;

  if (!isStandardSyntaxSelector(selector)) {
    return true;
  }

  if (isCustomSelector(selector)) {
    return true;
  }

  let currentSelector = null;

  const declarationsIsMatched = declarations.some(declaration => {
    const noMatchedParams = !params || params.indexOf('prefers-reduced-motion') === -1;
    const index = targetProperties.indexOf(declaration.prop);
    currentSelector = targetProperties[index];
    if (targetProperties.indexOf(declaration.prop) >= 0 && declaration.value === 'none') {
      return false;
    }

    return index >= 0 && noMatchedParams;
  });