1 | 'use strict';
|
2 |
|
3 | const hasLessInterpolation = require('../utils/hasLessInterpolation');
|
4 | const hasPsvInterpolation = require('../utils/hasPsvInterpolation');
|
5 | const hasScssInterpolation = require('../utils/hasScssInterpolation');
|
6 | const hasTplInterpolation = require('../utils/hasTplInterpolation');
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | module.exports = function (url) {
|
15 | if (url.length === 0) {
|
16 | return true;
|
17 | }
|
18 |
|
19 |
|
20 | if (hasScssInterpolation(url) || hasTplInterpolation(url) || hasPsvInterpolation(url)) {
|
21 | return false;
|
22 | }
|
23 |
|
24 |
|
25 | if ((url.startsWith(`'`) && url.endsWith(`'`)) || (url.startsWith(`"`) && url.endsWith(`"`))) {
|
26 | if (hasLessInterpolation(url)) {
|
27 | return false;
|
28 | }
|
29 |
|
30 | return true;
|
31 | }
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | if (url.startsWith('@') && /^@@?[\w-]+$/.test(url)) {
|
37 | return false;
|
38 | }
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | if (url.includes('$') && /^[$\sA-Za-z0-9+-/*_'"/]+$/.test(url) && !url.endsWith('/')) {
|
44 | return false;
|
45 | }
|
46 |
|
47 | return true;
|
48 | };
|