1 | 'use strict';
|
2 |
|
3 | const isScssVariable = require('./isScssVariable');
|
4 | const { isRoot } = require('./typeGuards');
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function isStandardSyntaxLang(lang) {
|
10 | return lang && (lang === 'css' || lang === 'custom-template' || lang === 'template-literal');
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | module.exports = function (decl) {
|
19 | const prop = decl.prop;
|
20 | const parent = decl.parent;
|
21 |
|
22 |
|
23 | if (
|
24 | isRoot(parent) &&
|
25 | parent.source &&
|
26 | !isStandardSyntaxLang(
|
27 | (parent.source).lang,
|
28 | )
|
29 | ) {
|
30 | return false;
|
31 | }
|
32 |
|
33 |
|
34 | if (isScssVariable(prop)) {
|
35 | return false;
|
36 | }
|
37 |
|
38 |
|
39 | if (prop[0] === '@' && prop[1] !== '{') {
|
40 | return false;
|
41 | }
|
42 |
|
43 |
|
44 | if (
|
45 |
|
46 | parent.selector &&
|
47 |
|
48 | parent.selector[parent.selector.length - 1] === ':' &&
|
49 |
|
50 | parent.selector.substring(0, 2) !== '--'
|
51 | ) {
|
52 | return false;
|
53 | }
|
54 |
|
55 |
|
56 |
|
57 | if (decl.extend) {
|
58 | return false;
|
59 | }
|
60 |
|
61 | return true;
|
62 | };
|