UNPKG

730 BJavaScriptView Raw
1'use strict';
2
3/**
4 * Check whether a at-rule is standard
5 *
6 * @param {import('postcss').AtRule | import('postcss-less').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 if ('mixin' in atRule && atRule.mixin) {
17 return false;
18 }
19
20 // Ignore Less detached ruleset `@detached-ruleset: { background: red; }; .top { @detached-ruleset(); }`
21 if (
22 ('variable' in atRule && atRule.variable) ||
23 (!atRule.nodes && atRule.raws.afterName === '' && atRule.params[0] === '(')
24 ) {
25 return false;
26 }
27
28 return true;
29};