@atlaskit/eslint-plugin-ui-styling-standard 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/constellation/index/migration-guide.mdx +309 -0
- package/constellation/index/overview.mdx +4 -0
- package/constellation/index/props.mdx +9 -5
- package/dist/cjs/rules/no-nested-selectors/index.js +68 -49
- package/dist/es2019/rules/no-nested-selectors/index.js +63 -45
- package/dist/esm/rules/no-nested-selectors/index.js +64 -49
- package/dist/types/rules/no-unsafe-selectors/constants.d.ts +1 -4
- package/index.js +9 -9
- package/package.json +3 -3
- package/scripts/codegen.tsx +223 -284
- package/src/rules/__tests__/utils/_tester.tsx +24 -24
- package/src/rules/atlaskit-theme/README.md +21 -19
- package/src/rules/atlaskit-theme/__tests__/test.ts +53 -53
- package/src/rules/atlaskit-theme/index.ts +107 -115
- package/src/rules/convert-props-syntax/README.md +32 -22
- package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +46 -46
- package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +175 -175
- package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +52 -52
- package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +33 -33
- package/src/rules/convert-props-syntax/index.tsx +356 -386
- package/src/rules/enforce-style-prop/README.md +21 -18
- package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +90 -96
- package/src/rules/enforce-style-prop/index.tsx +144 -160
- package/src/rules/external-rules.tsx +163 -164
- package/src/rules/local-cx-xcss/README.md +10 -6
- package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +26 -26
- package/src/rules/local-cx-xcss/index.tsx +46 -56
- package/src/rules/no-array-arguments/README.md +2 -1
- package/src/rules/no-array-arguments/__tests__/rule.test.tsx +37 -46
- package/src/rules/no-array-arguments/index.tsx +68 -69
- package/src/rules/no-classname-prop/README.md +7 -4
- package/src/rules/no-classname-prop/__tests__/rule.test.tsx +22 -22
- package/src/rules/no-classname-prop/index.tsx +25 -25
- package/src/rules/no-container-queries/README.md +11 -9
- package/src/rules/no-container-queries/__tests__/rule.test.tsx +47 -50
- package/src/rules/no-container-queries/index.tsx +75 -81
- package/src/rules/no-dynamic-styles/README.md +16 -19
- package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +58 -67
- package/src/rules/no-dynamic-styles/index.tsx +45 -48
- package/src/rules/no-exported-styles/README.md +17 -12
- package/src/rules/no-exported-styles/__tests__/rule.test.tsx +102 -111
- package/src/rules/no-exported-styles/index.tsx +36 -36
- package/src/rules/no-global-styles/README.md +15 -14
- package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +28 -28
- package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +37 -37
- package/src/rules/no-global-styles/index.tsx +59 -62
- package/src/rules/no-important-styles/README.md +5 -3
- package/src/rules/no-important-styles/__tests__/rule.test.tsx +66 -66
- package/src/rules/no-important-styles/index.tsx +49 -49
- package/src/rules/no-imported-style-values/README.md +23 -15
- package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +123 -123
- package/src/rules/no-imported-style-values/index.tsx +116 -120
- package/src/rules/no-nested-selectors/README.md +15 -13
- package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +186 -149
- package/src/rules/no-nested-selectors/index.tsx +92 -105
- package/src/rules/no-styled/README.md +14 -9
- package/src/rules/no-styled/__tests__/rule.test.tsx +31 -31
- package/src/rules/no-styled/index.tsx +34 -41
- package/src/rules/no-unsafe-selectors/README.md +103 -93
- package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +21 -24
- package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +44 -44
- package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +21 -21
- package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +57 -57
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +58 -58
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +85 -85
- package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +12 -12
- package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +23 -23
- package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +114 -114
- package/src/rules/no-unsafe-selectors/constants.tsx +69 -77
- package/src/rules/no-unsafe-selectors/source-position-utils.tsx +38 -38
- package/src/rules/no-unsafe-selectors/walk-css-map.tsx +178 -184
- package/src/rules/no-unsafe-values/README.md +34 -40
- package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +13 -13
- package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +104 -104
- package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +128 -128
- package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +23 -23
- package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +38 -38
- package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +28 -28
- package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +47 -47
- package/src/rules/no-unsafe-values/index.tsx +76 -78
- package/src/rules/no-unsafe-values/messages.tsx +12 -12
- package/src/rules/no-unsafe-values/utils.tsx +370 -382
- package/src/rules/use-compiled/README.md +11 -8
- package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +32 -32
- package/src/rules/use-compiled/__tests__/css.test.tsx +53 -53
- package/src/rules/use-compiled/__tests__/imports.test.tsx +90 -95
- package/src/rules/use-compiled/__tests__/keyframes.test.tsx +47 -47
- package/src/rules/use-compiled/__tests__/pragma.test.tsx +64 -64
- package/src/rules/use-compiled/__tests__/styled.test.tsx +53 -53
- package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +10 -10
- package/src/rules/use-compiled/index.tsx +203 -226
- package/src/rules/use-compiled/is-safe.tsx +113 -117
- package/src/rules/use-compiled/utils.tsx +14 -18
- package/src/rules/utils/create-rule-with-typed-config.tsx +62 -63
- package/src/rules/utils/create-rule.tsx +3 -6
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
Disallows unsafe selectors in CSS-in-JS style objects.
|
|
2
2
|
|
|
3
|
-
This enables static analysis and prevents regressions and incidents when migrating between styling
|
|
3
|
+
This enables static analysis and prevents regressions and incidents when migrating between styling
|
|
4
|
+
APIs.
|
|
4
5
|
|
|
5
|
-
Use this rule alongside
|
|
6
|
+
Use this rule alongside
|
|
7
|
+
[no-nested-selectors](https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-nested-selectors/usage)
|
|
8
|
+
as the rules are complementary.
|
|
6
9
|
|
|
7
10
|
## Examples
|
|
8
11
|
|
|
@@ -14,14 +17,14 @@ Use the `keyframes` CSS-in-JS API instead.
|
|
|
14
17
|
|
|
15
18
|
```ts
|
|
16
19
|
css({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
'@keyframes fadeIn': {
|
|
21
|
+
from: {
|
|
22
|
+
opacity: 0,
|
|
23
|
+
},
|
|
24
|
+
to: {
|
|
25
|
+
opacity: 1,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
25
28
|
});
|
|
26
29
|
```
|
|
27
30
|
|
|
@@ -33,12 +36,12 @@ _Auto-fixer is available for this violation._
|
|
|
33
36
|
|
|
34
37
|
```ts
|
|
35
38
|
css({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
':after': {
|
|
40
|
+
content: '""',
|
|
41
|
+
width: 100,
|
|
42
|
+
height: 100,
|
|
43
|
+
backgroundColor: 'red',
|
|
44
|
+
},
|
|
42
45
|
});
|
|
43
46
|
```
|
|
44
47
|
|
|
@@ -48,9 +51,9 @@ Use styles that do not require increased specificity.
|
|
|
48
51
|
|
|
49
52
|
```ts
|
|
50
53
|
css({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
'&&': {
|
|
55
|
+
color: 'red',
|
|
56
|
+
},
|
|
54
57
|
});
|
|
55
58
|
```
|
|
56
59
|
|
|
@@ -58,11 +61,11 @@ css({
|
|
|
58
61
|
|
|
59
62
|
```ts
|
|
60
63
|
css({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
'@scope (.article-body) to (figure)': {
|
|
65
|
+
img: {
|
|
66
|
+
display: 'block',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
66
69
|
});
|
|
67
70
|
```
|
|
68
71
|
|
|
@@ -70,44 +73,49 @@ css({
|
|
|
70
73
|
|
|
71
74
|
```ts
|
|
72
75
|
css({
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
'&:first-child': {
|
|
77
|
+
width: 100,
|
|
78
|
+
},
|
|
76
79
|
});
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
**No ambiguous pseudos**
|
|
80
83
|
|
|
81
|
-
A pseudo-selector without a leading selector is ambiguous and is interpreted differently between
|
|
84
|
+
A pseudo-selector without a leading selector is ambiguous and is interpreted differently between
|
|
85
|
+
contexts.
|
|
82
86
|
|
|
83
|
-
Most CSS-in-JS libraries will implicitly add the nesting selector `&` before ambiguous
|
|
87
|
+
Most CSS-in-JS libraries will implicitly add the nesting selector `&` before ambiguous
|
|
88
|
+
pseudo-selectors. This is often the desired behavior.
|
|
84
89
|
|
|
85
|
-
The CSS nesting specification, CSS pre-processors, newer versions of `styled-components` (version
|
|
90
|
+
The CSS nesting specification, CSS pre-processors, newer versions of `styled-components` (version
|
|
91
|
+
6+) and potentially future versions of `@emotion/*` will treat ambiguous pseudo-selectors as
|
|
92
|
+
descendant selectors.
|
|
86
93
|
|
|
87
94
|
Use explicit selectors. Do not rely on implicit behavior for pseudo-selectors.
|
|
88
95
|
|
|
89
|
-
_Auto-fixer is available for this violation. By default a nesting selector `&` is added unless the
|
|
96
|
+
_Auto-fixer is available for this violation. By default a nesting selector `&` is added unless the
|
|
97
|
+
`shouldAlwaysInsertNestingSelectorForAmbiguousPseudos` option is disabled._
|
|
90
98
|
|
|
91
99
|
```ts
|
|
92
100
|
css({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
/**
|
|
102
|
+
* This pseudo-class has no leading selector and is ambiguous.
|
|
103
|
+
*/
|
|
104
|
+
':hover': {},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* In some contexts the above is treated as implicitly containing a nesting selector.
|
|
108
|
+
*/
|
|
109
|
+
'&:hover': {},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* In other contexts it is treated as a descendant selector.
|
|
113
|
+
*
|
|
114
|
+
* (The selectors below are equivalent.)
|
|
115
|
+
*/
|
|
116
|
+
'*:hover': {},
|
|
117
|
+
'& :hover': {},
|
|
118
|
+
'& *:hover': {},
|
|
111
119
|
});
|
|
112
120
|
```
|
|
113
121
|
|
|
@@ -119,12 +127,12 @@ Write flattened at-rules instead.
|
|
|
119
127
|
|
|
120
128
|
```ts
|
|
121
129
|
cssMap({
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
success: {
|
|
131
|
+
'@media': {
|
|
132
|
+
'(min-width: 900px)': {},
|
|
133
|
+
'(min-width: 1200px)': {},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
128
136
|
});
|
|
129
137
|
```
|
|
130
138
|
|
|
@@ -136,13 +144,13 @@ Refactor your styles so it is not required.
|
|
|
136
144
|
|
|
137
145
|
```ts
|
|
138
146
|
cssMap({
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
success: {
|
|
148
|
+
selectors: {
|
|
149
|
+
'&:not(:active)': {
|
|
150
|
+
backgroundColor: 'white',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
146
154
|
});
|
|
147
155
|
```
|
|
148
156
|
|
|
@@ -150,61 +158,61 @@ cssMap({
|
|
|
150
158
|
|
|
151
159
|
```ts
|
|
152
160
|
const fadeIn = keyframes({
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
161
|
+
from: {
|
|
162
|
+
opacity: 0,
|
|
163
|
+
},
|
|
164
|
+
to: {
|
|
165
|
+
opacity: 1,
|
|
166
|
+
},
|
|
159
167
|
});
|
|
160
168
|
|
|
161
169
|
css({
|
|
162
|
-
|
|
170
|
+
animationName: fadeIn,
|
|
163
171
|
});
|
|
164
172
|
```
|
|
165
173
|
|
|
166
174
|
```ts
|
|
167
175
|
css({
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
'::after': {
|
|
177
|
+
content: '""',
|
|
178
|
+
width: 100,
|
|
179
|
+
height: 100,
|
|
180
|
+
backgroundColor: 'red',
|
|
181
|
+
},
|
|
174
182
|
});
|
|
175
183
|
```
|
|
176
184
|
|
|
177
185
|
```ts
|
|
178
186
|
css({
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
'&:first-of-type': {
|
|
188
|
+
width: 100,
|
|
189
|
+
},
|
|
182
190
|
});
|
|
183
191
|
```
|
|
184
192
|
|
|
185
193
|
```ts
|
|
186
194
|
css({
|
|
187
|
-
|
|
195
|
+
'&:hover': {},
|
|
188
196
|
});
|
|
189
197
|
```
|
|
190
198
|
|
|
191
199
|
```ts
|
|
192
200
|
cssMap({
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
201
|
+
success: {
|
|
202
|
+
'@media (min-width: 900px)': {},
|
|
203
|
+
'@media (min-width: 1200px)': {},
|
|
204
|
+
},
|
|
197
205
|
});
|
|
198
206
|
```
|
|
199
207
|
|
|
200
208
|
```ts
|
|
201
209
|
cssMap({
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
success: {
|
|
211
|
+
backgroundColor: 'white',
|
|
212
|
+
'&:active': {
|
|
213
|
+
backgroundColor: 'green',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
208
216
|
});
|
|
209
217
|
```
|
|
210
218
|
|
|
@@ -222,11 +230,13 @@ By default, this rule will check `css` usages from:
|
|
|
222
230
|
- `@emotion/styled`
|
|
223
231
|
- `styled-components`
|
|
224
232
|
|
|
225
|
-
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
226
|
-
This will override the built-in allow-list.
|
|
233
|
+
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
234
|
+
array of package names (strings). This will override the built-in allow-list.
|
|
227
235
|
|
|
228
236
|
### `shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: boolean`
|
|
229
237
|
|
|
230
|
-
By default this rule will always fix ambiguous pseudo-selectors by inserting a leading `&` (nesting
|
|
238
|
+
By default this rule will always fix ambiguous pseudo-selectors by inserting a leading `&` (nesting
|
|
239
|
+
selector).
|
|
231
240
|
|
|
232
|
-
Set `shouldAlwaysInsertNestingSelectorForAmbiguousPseudos` to `false` to disable this auto-fix. When
|
|
241
|
+
Set `shouldAlwaysInsertNestingSelectorForAmbiguousPseudos` to `false` to disable this auto-fix. When
|
|
242
|
+
disabled, a suggestion will be provided instead of an auto-fix.
|
|
@@ -2,11 +2,11 @@ import { tester } from '../../__tests__/utils/_tester';
|
|
|
2
2
|
import rule from '../index';
|
|
3
3
|
|
|
4
4
|
tester.run('no-grouped-at-rules', rule, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
valid: [],
|
|
6
|
+
invalid: [
|
|
7
|
+
{
|
|
8
|
+
name: '@media grouping',
|
|
9
|
+
code: `
|
|
10
10
|
import { cssMap } from '@compiled/react';
|
|
11
11
|
|
|
12
12
|
cssMap({
|
|
@@ -18,11 +18,11 @@ tester.run('no-grouped-at-rules', rule, {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
`,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
errors: [{ messageId: 'no-grouped-at-rules' }],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: '@keyframes grouping',
|
|
25
|
+
code: `
|
|
26
26
|
import { cssMap } from '@compiled/react';
|
|
27
27
|
|
|
28
28
|
cssMap({
|
|
@@ -33,14 +33,11 @@ tester.run('no-grouped-at-rules', rule, {
|
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
`,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
name: '@scope grouping',
|
|
43
|
-
code: `
|
|
36
|
+
errors: [{ messageId: 'no-grouped-at-rules' }, { messageId: 'no-keyframes-at-rules' }],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: '@scope grouping',
|
|
40
|
+
code: `
|
|
44
41
|
import { cssMap } from '@compiled/react';
|
|
45
42
|
|
|
46
43
|
cssMap({
|
|
@@ -51,10 +48,10 @@ tester.run('no-grouped-at-rules', rule, {
|
|
|
51
48
|
}
|
|
52
49
|
});
|
|
53
50
|
`,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
errors: [
|
|
52
|
+
{ messageId: 'no-grouped-at-rules' },
|
|
53
|
+
{ messageId: 'no-restricted-at-rules', data: { atRule: '@scope' } },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
60
57
|
});
|
|
@@ -2,72 +2,72 @@ import { tester } from '../../__tests__/utils/_tester';
|
|
|
2
2
|
import rule from '../index';
|
|
3
3
|
|
|
4
4
|
tester.run('no-increased-specificity', rule, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
valid: [
|
|
6
|
+
{
|
|
7
|
+
name: 'multiple & in selector list',
|
|
8
|
+
code: `
|
|
9
9
|
import { css } from '@compiled/react';
|
|
10
10
|
|
|
11
11
|
css({
|
|
12
12
|
'&:hover, &:active': {},
|
|
13
13
|
});
|
|
14
14
|
`,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
invalid: [
|
|
18
|
+
{
|
|
19
|
+
name: 'single &',
|
|
20
|
+
code: `
|
|
21
21
|
import { css } from '@compiled/react';
|
|
22
22
|
|
|
23
23
|
css({
|
|
24
24
|
'&': {},
|
|
25
25
|
});
|
|
26
26
|
`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
errors: [
|
|
28
|
+
{
|
|
29
|
+
messageId: 'no-increased-specificity',
|
|
30
|
+
line: 5,
|
|
31
|
+
column: 12,
|
|
32
|
+
endColumn: 13,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'double &',
|
|
38
|
+
code: `
|
|
39
39
|
import { css } from '@compiled/react';
|
|
40
40
|
|
|
41
41
|
css({
|
|
42
42
|
'&&': {},
|
|
43
43
|
});
|
|
44
44
|
`,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
errors: [
|
|
46
|
+
{
|
|
47
|
+
messageId: 'no-increased-specificity',
|
|
48
|
+
line: 5,
|
|
49
|
+
column: 12,
|
|
50
|
+
endColumn: 14,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'longer chain of &',
|
|
56
|
+
code: `
|
|
57
57
|
import { css } from '@compiled/react';
|
|
58
58
|
|
|
59
59
|
css({
|
|
60
60
|
'&&&&&&&&&': {},
|
|
61
61
|
});
|
|
62
62
|
`,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
errors: [
|
|
64
|
+
{
|
|
65
|
+
messageId: 'no-increased-specificity',
|
|
66
|
+
line: 5,
|
|
67
|
+
column: 12,
|
|
68
|
+
endColumn: 21,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
73
|
});
|
|
@@ -2,26 +2,26 @@ import { tester } from '../../__tests__/utils/_tester';
|
|
|
2
2
|
import rule from '../index';
|
|
3
3
|
|
|
4
4
|
tester.run('no-keyframes-at-rules', rule, {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
valid: [],
|
|
6
|
+
invalid: [
|
|
7
|
+
{
|
|
8
|
+
name: '@keyframes',
|
|
9
|
+
code: `
|
|
10
10
|
import { css } from '@compiled/react';
|
|
11
11
|
|
|
12
12
|
css({
|
|
13
13
|
'@keyframes fadeIn': {}
|
|
14
14
|
});
|
|
15
15
|
`,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
errors: [
|
|
17
|
+
{
|
|
18
|
+
messageId: 'no-keyframes-at-rules',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: '@keyframes in cssMap',
|
|
24
|
+
code: `
|
|
25
25
|
import { cssMap } from '@compiled/react';
|
|
26
26
|
|
|
27
27
|
cssMap({
|
|
@@ -30,11 +30,11 @@ tester.run('no-keyframes-at-rules', rule, {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
`,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
errors: [
|
|
34
|
+
{
|
|
35
|
+
messageId: 'no-keyframes-at-rules',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
40
|
});
|