-
-
Notifications
You must be signed in to change notification settings - Fork 929
/
index.js
102 lines (95 loc) · 2.06 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
"use strict";
const rule = require("..");
const { messages, ruleName } = rule;
testRule(rule, {
ruleName,
config: [true],
accept: [
{
code: "a { color: pink; }"
},
{
code: "a { color: #000; }"
},
{
code: "a { something: #000, #fff, #ababab; }"
},
{
code: "a { color: #0000ffcc; }",
description: "eight digits"
},
{
code: "a { color:#00fc; }",
description: "four digits"
},
{
code: "a { padding: 000; }"
},
{
code: 'a::before { content: "#ababa"; }'
},
{
code: "a { border-#$side: 0; }",
description: "ignore sass-like interpolation"
},
{
code: "a { box-sizing: #$type-box; }",
description: "ignore sass-like interpolation"
},
{
code:
"@font-face {\n" +
"font-family: dashicons;\n" +
'src: url(data:application/font-woff;charset=utf-8;base64, ABCDEF==) format("woff"),\n' +
'url(../fonts/dashicons.ttf) format("truetype"),\n' +
'url(../fonts/dashicons.svg#dashicons) format("svg");\n' +
"font-weight: normal;\n" +
"font-style: normal;\n" +
"}"
}
],
reject: [
{
code: "a { color: #ababa; }",
message: messages.rejected("#ababa"),
line: 1,
column: 12
},
{
code: "a { something: #00, #fff, #ababab; }",
message: messages.rejected("#00"),
line: 1,
column: 16
},
{
code: "a { something: #000, #fff1az, #ababab; }",
message: messages.rejected("#fff1az"),
line: 1,
column: 22
},
{
code: "a { something:#000,#fff,#12345aa; }",
message: messages.rejected("#12345aa"),
line: 1,
column: 25
}
]
});
testRule(rule, {
ruleName,
config: [true],
syntax: "css-in-js",
accept: [
{
code: 'export default <h1 style={{ color: "#ffff" }}>Test</h1>;'
}
],
reject: [
{
code: 'export default <h1 style={{ color: "#fffff" }}>Test</h1>;',
message: messages.rejected("#fffff"),
line: 1,
column: 36
}
]
});