@atlaskit/eslint-plugin-ui-styling-standard 0.15.0 → 0.15.1

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +180 -172
  2. package/constellation/atlaskit-theme/usage.mdx +17 -17
  3. package/constellation/convert-props-syntax/usage.mdx +14 -14
  4. package/constellation/enforce-style-prop/usage.mdx +17 -17
  5. package/constellation/index/overview.mdx +70 -70
  6. package/constellation/local-cx-xcss/usage.mdx +4 -4
  7. package/constellation/no-array-arguments/usage.mdx +7 -7
  8. package/constellation/no-container-queries/usage.mdx +14 -14
  9. package/constellation/no-dynamic-styles/usage.mdx +19 -19
  10. package/constellation/no-exported-styles/usage.mdx +15 -15
  11. package/constellation/no-global-styles/usage.mdx +13 -13
  12. package/constellation/no-important-styles/usage.mdx +2 -2
  13. package/constellation/no-imported-style-values/usage.mdx +16 -16
  14. package/constellation/no-nested-selectors/usage.mdx +18 -18
  15. package/constellation/no-styled/usage.mdx +6 -6
  16. package/constellation/no-unsafe-selectors/usage.mdx +90 -90
  17. package/constellation/no-unsafe-values/usage.mdx +33 -33
  18. package/dist/cjs/index.codegen.js +1 -1
  19. package/dist/cjs/presets/all.codegen.js +1 -1
  20. package/dist/cjs/presets/recommended.codegen.js +1 -1
  21. package/dist/cjs/rules/index.codegen.js +1 -1
  22. package/dist/cjs/rules/no-unsafe-selectors/index.js +4 -1
  23. package/dist/cjs/rules/no-unsafe-selectors/lint-selector.js +10 -1
  24. package/dist/es2019/index.codegen.js +1 -1
  25. package/dist/es2019/presets/all.codegen.js +1 -1
  26. package/dist/es2019/presets/recommended.codegen.js +1 -1
  27. package/dist/es2019/rules/index.codegen.js +1 -1
  28. package/dist/es2019/rules/no-unsafe-selectors/index.js +4 -1
  29. package/dist/es2019/rules/no-unsafe-selectors/lint-selector.js +10 -1
  30. package/dist/esm/index.codegen.js +1 -1
  31. package/dist/esm/presets/all.codegen.js +1 -1
  32. package/dist/esm/presets/recommended.codegen.js +1 -1
  33. package/dist/esm/rules/index.codegen.js +1 -1
  34. package/dist/esm/rules/no-unsafe-selectors/index.js +4 -1
  35. package/dist/esm/rules/no-unsafe-selectors/lint-selector.js +10 -1
  36. package/dist/types/presets/all.codegen.d.ts +1 -1
  37. package/dist/types/presets/recommended.codegen.d.ts +1 -1
  38. package/dist/types/rules/no-unsafe-selectors/lint-selector.d.ts +1 -0
  39. package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -1
  40. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -1
  41. package/dist/types-ts4.5/rules/no-unsafe-selectors/lint-selector.d.ts +1 -0
  42. package/package.json +2 -4
  43. package/src/index.codegen.tsx +3 -3
  44. package/src/presets/all.codegen.tsx +70 -73
  45. package/src/presets/recommended.codegen.tsx +70 -73
  46. package/src/rules/index.codegen.tsx +18 -18
  47. package/src/rules/no-unsafe-selectors/__tests__/no-ambiguous-pseudos.test.tsx +211 -201
  48. package/src/rules/no-unsafe-selectors/index.tsx +174 -177
  49. package/src/rules/no-unsafe-selectors/lint-selector.tsx +128 -141
  50. package/tsconfig.app.json +45 -45
  51. 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
- valid: [
8
- {
9
- name: '& is used',
10
- code: `
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
- name: '& is used with compound selector',
21
- code: `
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
- name: '* is used',
31
- code: `
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
- name: 'missing & after attribute',
43
- code: `
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
- name: 'missing & after attribute with value',
53
- code: `
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
- name: 'missing & after descendant selector',
63
- code: `
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
- name: 'missing & after sibling selector',
73
- code: `
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
- invalid: [
83
- {
84
- name: 'missing &',
85
- code: outdent`
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
- output: outdent`
102
+ output: outdent`
93
103
  import { css } from '@compiled/react';
94
104
 
95
105
  css({
96
106
  '&:hover': {},
97
107
  });
98
108
  `,
99
- errors: [
100
- {
101
- messageId: 'no-ambiguous-pseudos',
102
- line: 4,
103
- column: 4,
104
- endColumn: 10,
105
- },
106
- ],
107
- },
108
- {
109
- name: 'multiple selectors in list with missing &',
110
- code: outdent`
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
- output: outdent`
127
+ output: outdent`
118
128
  import { css } from '@compiled/react';
119
129
 
120
130
  css({
121
131
  '&:hover, &:focus': {},
122
132
  });
123
133
  `,
124
- errors: [
125
- {
126
- messageId: 'no-ambiguous-pseudos',
127
- line: 4,
128
- column: 4,
129
- endColumn: 10,
130
- },
131
- {
132
- messageId: 'no-ambiguous-pseudos',
133
- line: 4,
134
- column: 12,
135
- endColumn: 18,
136
- },
137
- ],
138
- },
139
- {
140
- name: 'multiple selectors in list with one missing &',
141
- code: outdent`
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
- output: outdent`
158
+ output: outdent`
149
159
  import { css } from '@compiled/react';
150
160
 
151
161
  css({
152
162
  '&:hover, &:focus': {},
153
163
  });
154
164
  `,
155
- errors: [
156
- {
157
- messageId: 'no-ambiguous-pseudos',
158
- line: 4,
159
- column: 13,
160
- endColumn: 19,
161
- },
162
- ],
163
- },
164
- {
165
- name: 'compound selector with missing &',
166
- code: outdent`
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
- output: outdent`
183
+ output: outdent`
174
184
  import { css } from '@compiled/react';
175
185
 
176
186
  css({
177
187
  '&:hover:focus': {},
178
188
  });
179
189
  `,
180
- errors: [
181
- {
182
- messageId: 'no-ambiguous-pseudos',
183
- line: 4,
184
- column: 4,
185
- endColumn: 10,
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
- 'no-ambiguous-pseudos with shouldAlwaysInsertNestingSelectorForAmbiguousPseudos disabled',
194
- rule,
195
- {
196
- valid: [],
197
- invalid: [
198
- {
199
- name: 'missing &',
200
- code: outdent`
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
- options: [
208
- {
209
- shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
210
- },
211
- ],
212
- errors: [
213
- {
214
- messageId: 'no-ambiguous-pseudos',
215
- line: 4,
216
- column: 4,
217
- endColumn: 10,
218
- suggestions: [
219
- {
220
- messageId: 'insert-nesting-selector',
221
- output: outdent`
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
- name: 'multiple selectors in list with missing &',
235
- code: outdent`
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
- options: [
243
- {
244
- shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
245
- },
246
- ],
247
- errors: [
248
- {
249
- messageId: 'no-ambiguous-pseudos',
250
- line: 4,
251
- column: 4,
252
- endColumn: 10,
253
- suggestions: [
254
- {
255
- messageId: 'insert-nesting-selector',
256
- output: outdent`
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
- messageId: 'no-ambiguous-pseudos',
268
- line: 4,
269
- column: 12,
270
- endColumn: 18,
271
- suggestions: [
272
- {
273
- messageId: 'insert-nesting-selector',
274
- output: outdent`
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
- name: 'multiple selectors in list with one missing &',
288
- code: outdent`
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
- options: [
296
- {
297
- shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
298
- },
299
- ],
300
- errors: [
301
- {
302
- messageId: 'no-ambiguous-pseudos',
303
- line: 4,
304
- column: 13,
305
- endColumn: 19,
306
- suggestions: [
307
- {
308
- messageId: 'insert-nesting-selector',
309
- output: outdent`
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
- name: 'compound selector with missing &',
323
- code: outdent`
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
- options: [
331
- {
332
- shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: false,
333
- },
334
- ],
335
- errors: [
336
- {
337
- messageId: 'no-ambiguous-pseudos',
338
- line: 4,
339
- column: 4,
340
- endColumn: 10,
341
- suggestions: [
342
- {
343
- messageId: 'insert-nesting-selector',
344
- output: outdent`
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
  );