1 | 'use strict';
|
2 |
|
3 | const _ = require('lodash');
|
4 | const isCustomPropertySet = require('../utils/isCustomPropertySet');
|
5 | const isStandardSyntaxSelector = require('../utils/isStandardSyntaxSelector');
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | module.exports = function (rule) {
|
14 |
|
15 | const selector = _.get(rule, 'raws.selector.raw', rule.selector);
|
16 |
|
17 | if (!isStandardSyntaxSelector(rule.selector)) {
|
18 | return false;
|
19 | }
|
20 |
|
21 |
|
22 | if (isCustomPropertySet(rule)) {
|
23 | return false;
|
24 | }
|
25 |
|
26 |
|
27 |
|
28 | if (rule.mixin) {
|
29 | return false;
|
30 | }
|
31 |
|
32 |
|
33 | if (selector.startsWith('@') && selector.endsWith(':')) {
|
34 | return false;
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 | if (rule.extend) {
|
40 | return false;
|
41 | }
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | if (rule.params && rule.params[0]) {
|
47 | return false;
|
48 | }
|
49 |
|
50 |
|
51 | if (selector.endsWith(')') && !selector.includes(':')) {
|
52 | return false;
|
53 | }
|
54 |
|
55 |
|
56 | if (/when\s+(not\s+)*\(/.test(selector)) {
|
57 | return false;
|
58 | }
|
59 |
|
60 |
|
61 | if (selector.endsWith(':')) {
|
62 | return false;
|
63 | }
|
64 |
|
65 | return true;
|
66 | };
|