UNPKG

768 BJavaScriptView Raw
1'use strict';
2
3/**
4 * Check whether a at-rule is standard
5 *
6 * @param {import('postcss').AtRule} atRule postcss at-rule node
7 * @return {boolean} If `true`, the declaration is standard
8 */
9module.exports = function (atRule) {
10 // Ignore scss `@content` inside mixins
11 if (!atRule.nodes && atRule.params === '') {
12 return false;
13 }
14
15 // Ignore Less mixins
16 // @ts-ignore TODO TYPES Is this property really exists?
17 if (atRule.mixin) {
18 return false;
19 }
20
21 // Ignore Less detached ruleset `@detached-ruleset: { background: red; }; .top { @detached-ruleset(); }`
22 if (
23 // @ts-ignore TODO TYPES Is this property really exists?
24 atRule.variable ||
25 (!atRule.nodes && atRule.raws.afterName === '' && atRule.params[0] === '(')
26 ) {
27 return false;
28 }
29
30 return true;
31};