@atlaskit/eslint-plugin-ui-styling-standard 0.15.0 → 0.15.2
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 +189 -172
- package/constellation/atlaskit-theme/usage.mdx +17 -17
- package/constellation/convert-props-syntax/usage.mdx +14 -14
- package/constellation/enforce-style-prop/usage.mdx +17 -17
- package/constellation/index/overview.mdx +70 -70
- package/constellation/local-cx-xcss/usage.mdx +4 -4
- package/constellation/no-array-arguments/usage.mdx +7 -7
- package/constellation/no-container-queries/usage.mdx +14 -14
- package/constellation/no-dynamic-styles/usage.mdx +19 -19
- package/constellation/no-exported-styles/usage.mdx +15 -15
- package/constellation/no-global-styles/usage.mdx +13 -13
- package/constellation/no-important-styles/usage.mdx +2 -2
- package/constellation/no-imported-style-values/usage.mdx +16 -16
- package/constellation/no-nested-selectors/usage.mdx +18 -18
- package/constellation/no-styled/usage.mdx +6 -6
- package/constellation/no-unsafe-selectors/usage.mdx +90 -90
- package/constellation/no-unsafe-values/usage.mdx +33 -33
- package/dist/cjs/index.codegen.js +1 -1
- package/dist/cjs/presets/all.codegen.js +1 -1
- package/dist/cjs/presets/recommended.codegen.js +1 -1
- package/dist/cjs/rules/index.codegen.js +1 -1
- package/dist/cjs/rules/no-nested-selectors/index.js +68 -49
- package/dist/cjs/rules/no-unsafe-selectors/index.js +4 -1
- package/dist/cjs/rules/no-unsafe-selectors/lint-selector.js +10 -1
- package/dist/es2019/index.codegen.js +1 -1
- package/dist/es2019/presets/all.codegen.js +1 -1
- package/dist/es2019/presets/recommended.codegen.js +1 -1
- package/dist/es2019/rules/index.codegen.js +1 -1
- package/dist/es2019/rules/no-nested-selectors/index.js +63 -45
- package/dist/es2019/rules/no-unsafe-selectors/index.js +4 -1
- package/dist/es2019/rules/no-unsafe-selectors/lint-selector.js +10 -1
- package/dist/esm/index.codegen.js +1 -1
- package/dist/esm/presets/all.codegen.js +1 -1
- package/dist/esm/presets/recommended.codegen.js +1 -1
- package/dist/esm/rules/index.codegen.js +1 -1
- package/dist/esm/rules/no-nested-selectors/index.js +64 -49
- package/dist/esm/rules/no-unsafe-selectors/index.js +4 -1
- package/dist/esm/rules/no-unsafe-selectors/lint-selector.js +10 -1
- package/dist/types/presets/all.codegen.d.ts +1 -1
- package/dist/types/presets/recommended.codegen.d.ts +1 -1
- package/dist/types/rules/no-unsafe-selectors/lint-selector.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-unsafe-selectors/lint-selector.d.ts +1 -0
- package/package.json +2 -4
- package/src/index.codegen.tsx +3 -3
- package/src/presets/all.codegen.tsx +70 -73
- package/src/presets/recommended.codegen.tsx +70 -73
- package/src/rules/index.codegen.tsx +18 -18
- package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +93 -56
- package/src/rules/no-nested-selectors/index.tsx +92 -105
- package/src/rules/no-unsafe-selectors/__tests__/no-ambiguous-pseudos.test.tsx +211 -201
- package/src/rules/no-unsafe-selectors/index.tsx +174 -177
- package/src/rules/no-unsafe-selectors/lint-selector.tsx +128 -141
- package/tsconfig.app.json +45 -45
- package/tsconfig.dev.json +43 -43
|
@@ -4,10 +4,10 @@ import { tester } from '../../__tests__/utils/_tester';
|
|
|
4
4
|
import rule from '../index';
|
|
5
5
|
|
|
6
6
|
tester.run('no-ambiguous-pseudos', rule, {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
valid: [
|
|
8
|
+
{
|
|
9
|
+
name: '& is used',
|
|
10
|
+
code: `
|
|
11
11
|
import { css } from '@compiled/react';
|
|
12
12
|
|
|
13
13
|
css({
|
|
@@ -15,20 +15,20 @@ tester.run('no-ambiguous-pseudos', rule, {
|
|
|
15
15
|
'&:focus, &:active': {},
|
|
16
16
|
});
|
|
17
17
|
`,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: '& is used with compound selector',
|
|
21
|
+
code: `
|
|
22
22
|
import { css } from '@compiled/react';
|
|
23
23
|
|
|
24
24
|
css({
|
|
25
25
|
'&:hover:focus': {}
|
|
26
26
|
});
|
|
27
27
|
`,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: '* is used',
|
|
31
|
+
code: `
|
|
32
32
|
import { css } from '@compiled/react';
|
|
33
33
|
|
|
34
34
|
css({
|
|
@@ -37,322 +37,332 @@ tester.run('no-ambiguous-pseudos', rule, {
|
|
|
37
37
|
'*:hover:focus': {},
|
|
38
38
|
});
|
|
39
39
|
`,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'missing & after attribute',
|
|
43
|
+
code: `
|
|
44
44
|
import { css } from '@compiled/react';
|
|
45
45
|
|
|
46
46
|
css({
|
|
47
47
|
'[data-testid]:hover': {}
|
|
48
48
|
});
|
|
49
49
|
`,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'missing & after attribute with value',
|
|
53
|
+
code: `
|
|
54
54
|
import { css } from '@compiled/react';
|
|
55
55
|
|
|
56
56
|
css({
|
|
57
57
|
'[data-testid="abc"]:hover': {}
|
|
58
58
|
});
|
|
59
59
|
`,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'missing & after descendant selector',
|
|
63
|
+
code: `
|
|
64
64
|
import { css } from '@compiled/react';
|
|
65
65
|
|
|
66
66
|
css({
|
|
67
67
|
'& :hover': {},
|
|
68
68
|
});
|
|
69
69
|
`,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'missing & after sibling selector',
|
|
73
|
+
code: `
|
|
74
74
|
import { css } from '@compiled/react';
|
|
75
75
|
|
|
76
76
|
css({
|
|
77
77
|
'& + :hover': {},
|
|
78
78
|
});
|
|
79
79
|
`,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'should ignore xcss',
|
|
83
|
+
code: `
|
|
84
|
+
import { xcss } from '@atlaskit/primitives';
|
|
85
|
+
|
|
86
|
+
xcss({
|
|
87
|
+
':hover': {},
|
|
88
|
+
});
|
|
89
|
+
`,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
invalid: [
|
|
93
|
+
{
|
|
94
|
+
name: 'missing &',
|
|
95
|
+
code: outdent`
|
|
86
96
|
import { css } from '@compiled/react';
|
|
87
97
|
|
|
88
98
|
css({
|
|
89
99
|
':hover': {},
|
|
90
100
|
});
|
|
91
101
|
`,
|
|
92
|
-
|
|
102
|
+
output: outdent`
|
|
93
103
|
import { css } from '@compiled/react';
|
|
94
104
|
|
|
95
105
|
css({
|
|
96
106
|
'&:hover': {},
|
|
97
107
|
});
|
|
98
108
|
`,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
errors: [
|
|
110
|
+
{
|
|
111
|
+
messageId: 'no-ambiguous-pseudos',
|
|
112
|
+
line: 4,
|
|
113
|
+
column: 4,
|
|
114
|
+
endColumn: 10,
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'multiple selectors in list with missing &',
|
|
120
|
+
code: outdent`
|
|
111
121
|
import { css } from '@compiled/react';
|
|
112
122
|
|
|
113
123
|
css({
|
|
114
124
|
':hover, :focus': {},
|
|
115
125
|
});
|
|
116
126
|
`,
|
|
117
|
-
|
|
127
|
+
output: outdent`
|
|
118
128
|
import { css } from '@compiled/react';
|
|
119
129
|
|
|
120
130
|
css({
|
|
121
131
|
'&:hover, &:focus': {},
|
|
122
132
|
});
|
|
123
133
|
`,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
errors: [
|
|
135
|
+
{
|
|
136
|
+
messageId: 'no-ambiguous-pseudos',
|
|
137
|
+
line: 4,
|
|
138
|
+
column: 4,
|
|
139
|
+
endColumn: 10,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
messageId: 'no-ambiguous-pseudos',
|
|
143
|
+
line: 4,
|
|
144
|
+
column: 12,
|
|
145
|
+
endColumn: 18,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'multiple selectors in list with one missing &',
|
|
151
|
+
code: outdent`
|
|
142
152
|
import { css } from '@compiled/react';
|
|
143
153
|
|
|
144
154
|
css({
|
|
145
155
|
'&:hover, :focus': {},
|
|
146
156
|
});
|
|
147
157
|
`,
|
|
148
|
-
|
|
158
|
+
output: outdent`
|
|
149
159
|
import { css } from '@compiled/react';
|
|
150
160
|
|
|
151
161
|
css({
|
|
152
162
|
'&:hover, &:focus': {},
|
|
153
163
|
});
|
|
154
164
|
`,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
errors: [
|
|
166
|
+
{
|
|
167
|
+
messageId: 'no-ambiguous-pseudos',
|
|
168
|
+
line: 4,
|
|
169
|
+
column: 13,
|
|
170
|
+
endColumn: 19,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'compound selector with missing &',
|
|
176
|
+
code: outdent`
|
|
167
177
|
import { css } from '@compiled/react';
|
|
168
178
|
|
|
169
179
|
css({
|
|
170
180
|
':hover:focus': {},
|
|
171
181
|
});
|
|
172
182
|
`,
|
|
173
|
-
|
|
183
|
+
output: outdent`
|
|
174
184
|
import { css } from '@compiled/react';
|
|
175
185
|
|
|
176
186
|
css({
|
|
177
187
|
'&:hover:focus': {},
|
|
178
188
|
});
|
|
179
189
|
`,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
errors: [
|
|
191
|
+
{
|
|
192
|
+
messageId: 'no-ambiguous-pseudos',
|
|
193
|
+
line: 4,
|
|
194
|
+
column: 4,
|
|
195
|
+
endColumn: 10,
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
190
200
|
});
|
|
191
201
|
|
|
192
202
|
tester.run(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
203
|
+
'no-ambiguous-pseudos with shouldAlwaysInsertNestingSelectorForAmbiguousPseudos disabled',
|
|
204
|
+
rule,
|
|
205
|
+
{
|
|
206
|
+
valid: [],
|
|
207
|
+
invalid: [
|
|
208
|
+
{
|
|
209
|
+
name: 'missing &',
|
|
210
|
+
code: outdent`
|
|
201
211
|
import { css } from '@compiled/react';
|
|
202
212
|
|
|
203
213
|
css({
|
|
204
214
|
':hover': {},
|
|
205
215
|
});
|
|
206
216
|
`,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
options: [
|
|
218
|
+
{
|
|
219
|
+
shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
errors: [
|
|
223
|
+
{
|
|
224
|
+
messageId: 'no-ambiguous-pseudos',
|
|
225
|
+
line: 4,
|
|
226
|
+
column: 4,
|
|
227
|
+
endColumn: 10,
|
|
228
|
+
suggestions: [
|
|
229
|
+
{
|
|
230
|
+
messageId: 'insert-nesting-selector',
|
|
231
|
+
output: outdent`
|
|
222
232
|
import { css } from '@compiled/react';
|
|
223
233
|
|
|
224
234
|
css({
|
|
225
235
|
'&:hover': {},
|
|
226
236
|
});
|
|
227
237
|
`,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'multiple selectors in list with missing &',
|
|
245
|
+
code: outdent`
|
|
236
246
|
import { css } from '@compiled/react';
|
|
237
247
|
|
|
238
248
|
css({
|
|
239
249
|
':hover, :focus': {},
|
|
240
250
|
});
|
|
241
251
|
`,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
252
|
+
options: [
|
|
253
|
+
{
|
|
254
|
+
shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
errors: [
|
|
258
|
+
{
|
|
259
|
+
messageId: 'no-ambiguous-pseudos',
|
|
260
|
+
line: 4,
|
|
261
|
+
column: 4,
|
|
262
|
+
endColumn: 10,
|
|
263
|
+
suggestions: [
|
|
264
|
+
{
|
|
265
|
+
messageId: 'insert-nesting-selector',
|
|
266
|
+
output: outdent`
|
|
257
267
|
import { css } from '@compiled/react';
|
|
258
268
|
|
|
259
269
|
css({
|
|
260
270
|
'&:hover, :focus': {},
|
|
261
271
|
});
|
|
262
272
|
`,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
messageId: 'no-ambiguous-pseudos',
|
|
278
|
+
line: 4,
|
|
279
|
+
column: 12,
|
|
280
|
+
endColumn: 18,
|
|
281
|
+
suggestions: [
|
|
282
|
+
{
|
|
283
|
+
messageId: 'insert-nesting-selector',
|
|
284
|
+
output: outdent`
|
|
275
285
|
import { css } from '@compiled/react';
|
|
276
286
|
|
|
277
287
|
css({
|
|
278
288
|
':hover, &:focus': {},
|
|
279
289
|
});
|
|
280
290
|
`,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: 'multiple selectors in list with one missing &',
|
|
298
|
+
code: outdent`
|
|
289
299
|
import { css } from '@compiled/react';
|
|
290
300
|
|
|
291
301
|
css({
|
|
292
302
|
'&:hover, :focus': {},
|
|
293
303
|
});
|
|
294
304
|
`,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
305
|
+
options: [
|
|
306
|
+
{
|
|
307
|
+
shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
errors: [
|
|
311
|
+
{
|
|
312
|
+
messageId: 'no-ambiguous-pseudos',
|
|
313
|
+
line: 4,
|
|
314
|
+
column: 13,
|
|
315
|
+
endColumn: 19,
|
|
316
|
+
suggestions: [
|
|
317
|
+
{
|
|
318
|
+
messageId: 'insert-nesting-selector',
|
|
319
|
+
output: outdent`
|
|
310
320
|
import { css } from '@compiled/react';
|
|
311
321
|
|
|
312
322
|
css({
|
|
313
323
|
'&:hover, &:focus': {},
|
|
314
324
|
});
|
|
315
325
|
`,
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: 'compound selector with missing &',
|
|
333
|
+
code: outdent`
|
|
324
334
|
import { css } from '@compiled/react';
|
|
325
335
|
|
|
326
336
|
css({
|
|
327
337
|
':hover:focus': {},
|
|
328
338
|
});
|
|
329
339
|
`,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
340
|
+
options: [
|
|
341
|
+
{
|
|
342
|
+
shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
errors: [
|
|
346
|
+
{
|
|
347
|
+
messageId: 'no-ambiguous-pseudos',
|
|
348
|
+
line: 4,
|
|
349
|
+
column: 4,
|
|
350
|
+
endColumn: 10,
|
|
351
|
+
suggestions: [
|
|
352
|
+
{
|
|
353
|
+
messageId: 'insert-nesting-selector',
|
|
354
|
+
output: outdent`
|
|
345
355
|
import { css } from '@compiled/react';
|
|
346
356
|
|
|
347
357
|
css({
|
|
348
358
|
'&:hover:focus': {},
|
|
349
359
|
});
|
|
350
360
|
`,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
361
|
+
},
|
|
362
|
+
],
|
|
363
|
+
},
|
|
364
|
+
],
|
|
365
|
+
},
|
|
366
|
+
],
|
|
367
|
+
},
|
|
358
368
|
);
|