isStandardSyntaxRule.js 521 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const isStandardSyntaxSelector = require('../utils/isStandardSyntaxSelector');
  3. /**
  4. * Check whether a Node is a standard rule
  5. *
  6. * @param {import('postcss').Rule | import('postcss-less').Rule} rule
  7. * @returns {boolean}
  8. */
  9. module.exports = function isStandardSyntaxRule(rule) {
  10. if (rule.type !== 'rule') {
  11. return false;
  12. }
  13. // Ignore Less &:extend rule
  14. if ('extend' in rule && rule.extend) {
  15. return false;
  16. }
  17. if (!isStandardSyntaxSelector(rule.selector)) {
  18. return false;
  19. }
  20. return true;
  21. };