forked from stylelint/stylelint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
87 lines (83 loc) · 1.31 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
'use strict';
const { messages, ruleName } = require('..');
testRule({
ruleName,
config: 'never',
accept: [
{
code: 'a { color: #fff; }',
},
{
code: 'a { color: #ffffff; }',
},
],
reject: [
{
code: 'a { color: #ffff; }',
message: messages.unexpected('#ffff'),
line: 1,
column: 11,
},
],
});
testRule({
ruleName,
config: 'always',
accept: [
{
code: 'a { color: #ffff; }',
},
{
code: 'a { color: #ffffffff; }',
},
{
code: 'a { background: linear-gradient(to left, #fffa, red 100%); }',
},
{
code: 'a { background: url(#fff); }',
},
],
reject: [
{
code: 'a { color:#fff; }',
message: messages.expected('#fff'),
line: 1,
column: 11,
},
{
code: 'a { color:#ffffff; }',
message: messages.expected('#ffffff'),
line: 1,
column: 11,
},
{
code: 'a { background: linear-gradient(to left, #fff, red 100%); }',
message: messages.expected('#fff'),
line: 1,
column: 42,
},
],
});
testRule({
ruleName,
config: ['never'],
syntax: 'scss',
accept: [
{
code: 'a { color: #{ff}; }',
description: 'scss interpolation',
},
{
code: 'a { $var: #fff;}',
description: 'scss interpolation',
},
],
reject: [
{
code: 'a { $var: #fffa;}',
message: messages.expected('#fff'),
line: 1,
column: 8,
},
],
});