@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.
Files changed (99) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/constellation/index/migration-guide.mdx +309 -0
  3. package/constellation/index/overview.mdx +4 -0
  4. package/constellation/index/props.mdx +9 -5
  5. package/dist/cjs/rules/no-nested-selectors/index.js +68 -49
  6. package/dist/es2019/rules/no-nested-selectors/index.js +63 -45
  7. package/dist/esm/rules/no-nested-selectors/index.js +64 -49
  8. package/dist/types/rules/no-unsafe-selectors/constants.d.ts +1 -4
  9. package/index.js +9 -9
  10. package/package.json +3 -3
  11. package/scripts/codegen.tsx +223 -284
  12. package/src/rules/__tests__/utils/_tester.tsx +24 -24
  13. package/src/rules/atlaskit-theme/README.md +21 -19
  14. package/src/rules/atlaskit-theme/__tests__/test.ts +53 -53
  15. package/src/rules/atlaskit-theme/index.ts +107 -115
  16. package/src/rules/convert-props-syntax/README.md +32 -22
  17. package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +46 -46
  18. package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +175 -175
  19. package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +52 -52
  20. package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +33 -33
  21. package/src/rules/convert-props-syntax/index.tsx +356 -386
  22. package/src/rules/enforce-style-prop/README.md +21 -18
  23. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +90 -96
  24. package/src/rules/enforce-style-prop/index.tsx +144 -160
  25. package/src/rules/external-rules.tsx +163 -164
  26. package/src/rules/local-cx-xcss/README.md +10 -6
  27. package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +26 -26
  28. package/src/rules/local-cx-xcss/index.tsx +46 -56
  29. package/src/rules/no-array-arguments/README.md +2 -1
  30. package/src/rules/no-array-arguments/__tests__/rule.test.tsx +37 -46
  31. package/src/rules/no-array-arguments/index.tsx +68 -69
  32. package/src/rules/no-classname-prop/README.md +7 -4
  33. package/src/rules/no-classname-prop/__tests__/rule.test.tsx +22 -22
  34. package/src/rules/no-classname-prop/index.tsx +25 -25
  35. package/src/rules/no-container-queries/README.md +11 -9
  36. package/src/rules/no-container-queries/__tests__/rule.test.tsx +47 -50
  37. package/src/rules/no-container-queries/index.tsx +75 -81
  38. package/src/rules/no-dynamic-styles/README.md +16 -19
  39. package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +58 -67
  40. package/src/rules/no-dynamic-styles/index.tsx +45 -48
  41. package/src/rules/no-exported-styles/README.md +17 -12
  42. package/src/rules/no-exported-styles/__tests__/rule.test.tsx +102 -111
  43. package/src/rules/no-exported-styles/index.tsx +36 -36
  44. package/src/rules/no-global-styles/README.md +15 -14
  45. package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +28 -28
  46. package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +37 -37
  47. package/src/rules/no-global-styles/index.tsx +59 -62
  48. package/src/rules/no-important-styles/README.md +5 -3
  49. package/src/rules/no-important-styles/__tests__/rule.test.tsx +66 -66
  50. package/src/rules/no-important-styles/index.tsx +49 -49
  51. package/src/rules/no-imported-style-values/README.md +23 -15
  52. package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +123 -123
  53. package/src/rules/no-imported-style-values/index.tsx +116 -120
  54. package/src/rules/no-nested-selectors/README.md +15 -13
  55. package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +186 -149
  56. package/src/rules/no-nested-selectors/index.tsx +92 -105
  57. package/src/rules/no-styled/README.md +14 -9
  58. package/src/rules/no-styled/__tests__/rule.test.tsx +31 -31
  59. package/src/rules/no-styled/index.tsx +34 -41
  60. package/src/rules/no-unsafe-selectors/README.md +103 -93
  61. package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +21 -24
  62. package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +44 -44
  63. package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +21 -21
  64. package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +57 -57
  65. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +58 -58
  66. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +85 -85
  67. package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +12 -12
  68. package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +23 -23
  69. package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +114 -114
  70. package/src/rules/no-unsafe-selectors/constants.tsx +69 -77
  71. package/src/rules/no-unsafe-selectors/source-position-utils.tsx +38 -38
  72. package/src/rules/no-unsafe-selectors/walk-css-map.tsx +178 -184
  73. package/src/rules/no-unsafe-values/README.md +34 -40
  74. package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +13 -13
  75. package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +18 -18
  76. package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +104 -104
  77. package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +128 -128
  78. package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +23 -23
  79. package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +38 -38
  80. package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +18 -18
  81. package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +18 -18
  82. package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +28 -28
  83. package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +47 -47
  84. package/src/rules/no-unsafe-values/index.tsx +76 -78
  85. package/src/rules/no-unsafe-values/messages.tsx +12 -12
  86. package/src/rules/no-unsafe-values/utils.tsx +370 -382
  87. package/src/rules/use-compiled/README.md +11 -8
  88. package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +32 -32
  89. package/src/rules/use-compiled/__tests__/css.test.tsx +53 -53
  90. package/src/rules/use-compiled/__tests__/imports.test.tsx +90 -95
  91. package/src/rules/use-compiled/__tests__/keyframes.test.tsx +47 -47
  92. package/src/rules/use-compiled/__tests__/pragma.test.tsx +64 -64
  93. package/src/rules/use-compiled/__tests__/styled.test.tsx +53 -53
  94. package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +10 -10
  95. package/src/rules/use-compiled/index.tsx +203 -226
  96. package/src/rules/use-compiled/is-safe.tsx +113 -117
  97. package/src/rules/use-compiled/utils.tsx +14 -18
  98. package/src/rules/utils/create-rule-with-typed-config.tsx +62 -63
  99. package/src/rules/utils/create-rule.tsx +3 -6
@@ -1,7 +1,8 @@
1
1
  Ensures usage of `@compiled/react` over other CSS-in-JS libraries like Emotion or styled-components.
2
2
 
3
- **WARNING**
4
- It may be unsafe to mix usages of `@compiled/react` with other CSS-in-JS libraries on the same component. When converting to `@compiled/react` verify ALL changes. For this reason, the auto-fixer has been disabled by default, but it may be useful to enable to empower a migration.
3
+ **WARNING** It may be unsafe to mix usages of `@compiled/react` with other CSS-in-JS libraries on
4
+ the same component. When converting to `@compiled/react` verify ALL changes. For this reason, the
5
+ auto-fixer has been disabled by default, but it may be useful to enable to empower a migration.
5
6
 
6
7
  ## Examples
7
8
 
@@ -20,21 +21,22 @@ import styled, { css } from 'styled-components';
20
21
 
21
22
  ### Correct
22
23
 
23
- We expect usage of `xcss` with `@atlaskit/primitives` when working with Primitives, and `css` with `@compiled/react` when working with custom or native code. 
24
+ We expect usage of `xcss` with `@atlaskit/primitives` when working with Primitives, and `css` with
25
+ `@compiled/react` when working with custom or native code.
24
26
 
25
27
  ```js
26
28
  /** @jsx jsx */
27
29
  import { jsx, css, styled } from '@compiled/react';
28
30
 
29
31
  const styles = css({ color: 'var(--ds-color-text)' });
30
- export default () => <div css={styles}>…</div>
32
+ export default () => <div css={styles}>…</div>;
31
33
  ```
32
34
 
33
35
  ```js
34
36
  import { xcss, Box } from '@atlaskit/primitives';
35
37
 
36
38
  const styles = xcss({ color: 'color.text' });
37
- export default () => <Box xcss={styles}>…</Box>
39
+ export default () => <Box xcss={styles}>…</Box>;
38
40
  ```
39
41
 
40
42
  ## Options
@@ -43,7 +45,8 @@ export default () => <Box xcss={styles}>…</Box>
43
45
 
44
46
  Determines whether or not the auto-fixer is enabled.
45
47
 
46
- Defaults to `false` due to safety concerns when mixing Compiled and other CSS-in-JS libraries on the same component.
48
+ Defaults to `false` due to safety concerns when mixing Compiled and other CSS-in-JS libraries on the
49
+ same component.
47
50
 
48
- Even when enabled, the auto-fixer will only convert usages that are deemed safe.
49
- Currently this is limited to purely static styles where all keys and values are simple literals.
51
+ Even when enabled, the auto-fixer will only convert usages that are deemed safe. Currently this is
52
+ limited to purely static styles where all keys and values are simple literals.
@@ -3,27 +3,27 @@ import { tester } from '../../__tests__/utils/_tester';
3
3
  import rule from '../index';
4
4
 
5
5
  const invalid: RuleTester.InvalidTestCase[] = [
6
- {
7
- name: 'css API',
8
- code: `
6
+ {
7
+ name: 'css API',
8
+ code: `
9
9
  import { css } from '@emotion/react';
10
10
 
11
11
  const Component = css({
12
12
  color: 'red',
13
13
  });
14
14
  `,
15
- errors: [{ messageId: 'use-compiled' }],
16
- },
17
- {
18
- name: 'imports',
19
- code: `
15
+ errors: [{ messageId: 'use-compiled' }],
16
+ },
17
+ {
18
+ name: 'imports',
19
+ code: `
20
20
  import { css as c, keyframes as kf } from '@emotion/core';
21
21
  `,
22
- errors: [{ messageId: 'use-compiled' }],
23
- },
24
- {
25
- name: `keyframes API`,
26
- code: `
22
+ errors: [{ messageId: 'use-compiled' }],
23
+ },
24
+ {
25
+ name: `keyframes API`,
26
+ code: `
27
27
  import { keyframes } from 'styled-components';
28
28
 
29
29
  const fadeIn = keyframes({
@@ -35,39 +35,39 @@ const invalid: RuleTester.InvalidTestCase[] = [
35
35
  }
36
36
  });
37
37
  `,
38
- errors: [{ messageId: 'use-compiled' }],
39
- },
40
- {
41
- name: 'pragma fix',
42
- code: `
38
+ errors: [{ messageId: 'use-compiled' }],
39
+ },
40
+ {
41
+ name: 'pragma fix',
42
+ code: `
43
43
  /** @jsxImportSource @emotion/react */
44
44
 
45
45
  import { css } from '@compiled/react';
46
46
  `,
47
- errors: [{ messageId: 'use-compiled' }],
48
- },
49
- {
50
- name: `styles are a plain object with literal values`,
51
- code: `
47
+ errors: [{ messageId: 'use-compiled' }],
48
+ },
49
+ {
50
+ name: `styles are a plain object with literal values`,
51
+ code: `
52
52
  import styled from '@emotion/styled';
53
53
 
54
54
  const Component = styled.div({
55
55
  color: 'red',
56
56
  });
57
57
  `,
58
- errors: [{ messageId: 'use-compiled' }],
59
- },
58
+ errors: [{ messageId: 'use-compiled' }],
59
+ },
60
60
  ];
61
61
 
62
62
  tester.run('canAutoFix is not provided', rule, {
63
- valid: [],
64
- invalid,
63
+ valid: [],
64
+ invalid,
65
65
  });
66
66
 
67
67
  tester.run('canAutoFix is false', rule, {
68
- valid: [],
69
- invalid: invalid.map((testCase) => ({
70
- ...testCase,
71
- options: [{ canAutoFix: false }],
72
- })),
68
+ valid: [],
69
+ invalid: invalid.map((testCase) => ({
70
+ ...testCase,
71
+ options: [{ canAutoFix: false }],
72
+ })),
73
73
  });
@@ -4,28 +4,28 @@ import rule from '../index';
4
4
  const importSources = ['@emotion/core', '@emotion/react', 'styled-components'];
5
5
 
6
6
  tester.run('css API - fixable', rule, {
7
- valid: [],
8
- invalid: importSources.flatMap((importSource) => [
9
- {
10
- name: `[${importSource}] styles are a plain object with literal values`,
11
- code: `
7
+ valid: [],
8
+ invalid: importSources.flatMap((importSource) => [
9
+ {
10
+ name: `[${importSource}] styles are a plain object with literal values`,
11
+ code: `
12
12
  import { css } from '${importSource}';
13
13
 
14
14
  const Component = css({
15
15
  color: 'red',
16
16
  });
17
17
  `,
18
- output: `
18
+ output: `
19
19
  import { css } from '@compiled/react';
20
20
 
21
21
  const Component = css({
22
22
  color: 'red',
23
23
  });
24
24
  `,
25
- errors: [{ messageId: 'use-compiled' }],
26
- options: [{ canAutoFix: true }],
27
- },
28
- ]),
25
+ errors: [{ messageId: 'use-compiled' }],
26
+ options: [{ canAutoFix: true }],
27
+ },
28
+ ]),
29
29
  });
30
30
 
31
31
  /**
@@ -33,35 +33,35 @@ tester.run('css API - fixable', rule, {
33
33
  * them unsafe to automatically convert.
34
34
  */
35
35
  tester.run('css API - not fixable', rule, {
36
- valid: [],
37
- invalid: importSources.flatMap((importSource) => [
38
- {
39
- name: `[${importSource}] function as style argument`,
40
- code: `
36
+ valid: [],
37
+ invalid: importSources.flatMap((importSource) => [
38
+ {
39
+ name: `[${importSource}] function as style argument`,
40
+ code: `
41
41
  import { css } from '${importSource}';
42
42
 
43
43
  const Component = css(() => ({
44
44
  color: 'red',
45
45
  }));
46
46
  `,
47
- errors: [{ messageId: 'use-compiled' }],
48
- options: [{ canAutoFix: true }],
49
- },
50
- {
51
- name: `[${importSource}] function as style object value`,
52
- code: `
47
+ errors: [{ messageId: 'use-compiled' }],
48
+ options: [{ canAutoFix: true }],
49
+ },
50
+ {
51
+ name: `[${importSource}] function as style object value`,
52
+ code: `
53
53
  import { css } from '${importSource}';
54
54
 
55
55
  const Component = css({
56
56
  color: () => 'red',
57
57
  });
58
58
  `,
59
- errors: [{ messageId: 'use-compiled' }],
60
- options: [{ canAutoFix: true }],
61
- },
62
- {
63
- name: `[${importSource}] identifier as style object value`,
64
- code: `
59
+ errors: [{ messageId: 'use-compiled' }],
60
+ options: [{ canAutoFix: true }],
61
+ },
62
+ {
63
+ name: `[${importSource}] identifier as style object value`,
64
+ code: `
65
65
  import { css } from '${importSource}';
66
66
 
67
67
  const textColor = 'red';
@@ -69,16 +69,16 @@ tester.run('css API - not fixable', rule, {
69
69
  color: textColor,
70
70
  });
71
71
  `,
72
- errors: [{ messageId: 'use-compiled' }],
73
- options: [{ canAutoFix: true }],
74
- },
75
- {
76
- /**
77
- * We could auto-fix this safely but intentionally
78
- * keeping this rule very simple for now.
79
- */
80
- name: `[${importSource}] function call as style object value`,
81
- code: `
72
+ errors: [{ messageId: 'use-compiled' }],
73
+ options: [{ canAutoFix: true }],
74
+ },
75
+ {
76
+ /**
77
+ * We could auto-fix this safely but intentionally
78
+ * keeping this rule very simple for now.
79
+ */
80
+ name: `[${importSource}] function call as style object value`,
81
+ code: `
82
82
  import { css } from '${importSource}';
83
83
  import { token } from '@atlaskit/tokens';
84
84
 
@@ -86,24 +86,24 @@ tester.run('css API - not fixable', rule, {
86
86
  color: token('color.text'),
87
87
  });
88
88
  `,
89
- errors: [{ messageId: 'use-compiled' }],
90
- options: [{ canAutoFix: true }],
91
- },
92
- {
93
- name: `[${importSource}] with unsupported named import`,
94
- code: `
89
+ errors: [{ messageId: 'use-compiled' }],
90
+ options: [{ canAutoFix: true }],
91
+ },
92
+ {
93
+ name: `[${importSource}] with unsupported named import`,
94
+ code: `
95
95
  import { css, type CSSObject } from '${importSource}';
96
96
 
97
97
  const Component = css({
98
98
  color: 'red',
99
99
  });
100
100
  `,
101
- errors: [{ messageId: 'use-compiled' }],
102
- options: [{ canAutoFix: true }],
103
- },
104
- {
105
- name: `[${importSource}] with unsafe usage of other import`,
106
- code: `
101
+ errors: [{ messageId: 'use-compiled' }],
102
+ options: [{ canAutoFix: true }],
103
+ },
104
+ {
105
+ name: `[${importSource}] with unsafe usage of other import`,
106
+ code: `
107
107
  import { css, keyframes } from '${importSource}';
108
108
 
109
109
  const Component = css({
@@ -119,8 +119,8 @@ tester.run('css API - not fixable', rule, {
119
119
  }
120
120
  })
121
121
  `,
122
- errors: [{ messageId: 'use-compiled' }],
123
- options: [{ canAutoFix: true }],
124
- },
125
- ]),
122
+ errors: [{ messageId: 'use-compiled' }],
123
+ options: [{ canAutoFix: true }],
124
+ },
125
+ ]),
126
126
  });
@@ -3,137 +3,132 @@ import outdent from 'outdent';
3
3
  import { tester } from '../../__tests__/utils/_tester';
4
4
  import rule from '../index';
5
5
 
6
- const importSources = [
7
- '@emotion/core',
8
- '@emotion/react',
9
- '@emotion/styled',
10
- 'styled-components',
11
- ];
6
+ const importSources = ['@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components'];
12
7
 
13
8
  tester.run('imports - ignored', rule, {
14
- valid: [
15
- {
16
- name: '[@atlaskit/primitives.xcss] - is ignored (it\'s okay to use, for now)',
17
- code: `
9
+ valid: [
10
+ {
11
+ name: "[@atlaskit/primitives.xcss] - is ignored (it's okay to use, for now)",
12
+ code: `
18
13
  import { xcss, Box } from '@atlaskit/primitives';
19
14
  `,
20
- },
21
- {
22
- name: '[@atlaskit/css] - is ignored (it\'s okay to use)',
23
- code: `
15
+ },
16
+ {
17
+ name: "[@atlaskit/css] - is ignored (it's okay to use)",
18
+ code: `
24
19
  import { cssMap, keyframes } from '@atlaskit/css';
25
20
  `,
26
- },
27
- {
28
- name: '[@stylexjs/stylex] - is ignored (we don\'t maintain a list of all CSS-in-JS libraries, but we could)',
29
- code: `
21
+ },
22
+ {
23
+ name: "[@stylexjs/stylex] - is ignored (we don't maintain a list of all CSS-in-JS libraries, but we could)",
24
+ code: `
30
25
  import * as stylex from '@stylexjs/stylex';
31
26
  `,
32
- }
33
- ],
34
- invalid: [],
27
+ },
28
+ ],
29
+ invalid: [],
35
30
  });
36
31
 
37
32
  tester.run('imports - fixable', rule, {
38
- valid: [],
39
- invalid: [
40
- {
41
- name: '[@emotion/core] - supported imports with aliasing',
42
- code: `
33
+ valid: [],
34
+ invalid: [
35
+ {
36
+ name: '[@emotion/core] - supported imports with aliasing',
37
+ code: `
43
38
  import { css as c, keyframes as kf } from '@emotion/core';
44
39
  `,
45
- output: `
40
+ output: `
46
41
  import { css as c, keyframes as kf } from '@compiled/react';
47
42
  `,
48
- errors: [{ messageId: 'use-compiled' }],
49
- options: [{ canAutoFix: true }],
50
- },
51
- {
52
- name: '[@emotion/react] - supported imports with aliasing',
53
- code: `
43
+ errors: [{ messageId: 'use-compiled' }],
44
+ options: [{ canAutoFix: true }],
45
+ },
46
+ {
47
+ name: '[@emotion/react] - supported imports with aliasing',
48
+ code: `
54
49
  import { css as c, keyframes as kf } from '@emotion/react';
55
50
  `,
56
- output: `
51
+ output: `
57
52
  import { css as c, keyframes as kf } from '@compiled/react';
58
53
  `,
59
- errors: [{ messageId: 'use-compiled' }],
60
- options: [{ canAutoFix: true }],
61
- },
62
- {
63
- name: '[@emotion/styled] - supported imports with aliasing',
64
- code: `
54
+ errors: [{ messageId: 'use-compiled' }],
55
+ options: [{ canAutoFix: true }],
56
+ },
57
+ {
58
+ name: '[@emotion/styled] - supported imports with aliasing',
59
+ code: `
65
60
  import s from '@emotion/styled';
66
61
  `,
67
- output: `
62
+ output: `
68
63
  import { styled as s } from '@compiled/react';
69
64
  `,
70
- errors: [{ messageId: 'use-compiled' }],
71
- options: [{ canAutoFix: true }],
72
- },
73
- {
74
- name: '[styled-components] - supported imports with aliasing',
75
- code: `
65
+ errors: [{ messageId: 'use-compiled' }],
66
+ options: [{ canAutoFix: true }],
67
+ },
68
+ {
69
+ name: '[styled-components] - supported imports with aliasing',
70
+ code: `
76
71
  import s, { css as c, keyframes as kf } from 'styled-components';
77
72
  `,
78
- output: `
73
+ output: `
79
74
  import { css as c, keyframes as kf, styled as s } from '@compiled/react';
80
75
  `,
81
- errors: [{ messageId: 'use-compiled' }],
82
- options: [{ canAutoFix: true }],
83
- },
84
- {
85
- name: '[@emotion/core] - with existing compiled import',
86
- code: outdent`
76
+ errors: [{ messageId: 'use-compiled' }],
77
+ options: [{ canAutoFix: true }],
78
+ },
79
+ {
80
+ name: '[@emotion/core] - with existing compiled import',
81
+ code: outdent`
87
82
  import { css } from '@emotion/core';
88
83
  import { styled } from '@compiled/react';
89
84
  `,
90
- output: outdent`
85
+ output: outdent`
91
86
 
92
87
  import { styled, css } from '@compiled/react';
93
88
  `,
94
- errors: [{ messageId: 'use-compiled' }],
95
- options: [{ canAutoFix: true }],
96
- },
97
- {
98
- name: '[@emotion/react] - with existing compiled import',
99
- code: outdent`
89
+ errors: [{ messageId: 'use-compiled' }],
90
+ options: [{ canAutoFix: true }],
91
+ },
92
+ {
93
+ name: '[@emotion/react] - with existing compiled import',
94
+ code: outdent`
100
95
  import { css } from '@emotion/react';
101
96
  import { styled } from '@compiled/react';
102
97
  `,
103
- output: outdent`
98
+ output: outdent`
104
99
 
105
100
  import { styled, css } from '@compiled/react';
106
101
  `,
107
- errors: [{ messageId: 'use-compiled' }],
108
- options: [{ canAutoFix: true }],
109
- },
110
- {
111
- name: '[@emotion/styled] - with existing compiled import',
112
- code: outdent`
102
+ errors: [{ messageId: 'use-compiled' }],
103
+ options: [{ canAutoFix: true }],
104
+ },
105
+ {
106
+ name: '[@emotion/styled] - with existing compiled import',
107
+ code: outdent`
113
108
  import styled from '@emotion/styled';
114
109
  import { css } from '@compiled/react';
115
110
  `,
116
- output: outdent`
111
+ output: outdent`
117
112
 
118
113
  import { css, styled } from '@compiled/react';
119
114
  `,
120
- errors: [{ messageId: 'use-compiled' }],
121
- options: [{ canAutoFix: true }],
122
- },
123
- {
124
- name: '[styled-components] - with existing compiled import',
125
- code: outdent`
115
+ errors: [{ messageId: 'use-compiled' }],
116
+ options: [{ canAutoFix: true }],
117
+ },
118
+ {
119
+ name: '[styled-components] - with existing compiled import',
120
+ code: outdent`
126
121
  import styled from 'styled-components';
127
122
  import { css } from '@compiled/react';
128
123
  `,
129
- output: outdent`
124
+ output: outdent`
130
125
 
131
126
  import { css, styled } from '@compiled/react';
132
127
  `,
133
- errors: [{ messageId: 'use-compiled' }],
134
- options: [{ canAutoFix: true }],
135
- },
136
- ],
128
+ errors: [{ messageId: 'use-compiled' }],
129
+ options: [{ canAutoFix: true }],
130
+ },
131
+ ],
137
132
  });
138
133
 
139
134
  /**
@@ -141,23 +136,23 @@ tester.run('imports - fixable', rule, {
141
136
  * them unsafe to automatically convert.
142
137
  */
143
138
  tester.run('imports - not fixable', rule, {
144
- valid: [],
145
- invalid: importSources.flatMap((importSource) => [
146
- {
147
- name: `[${importSource}] namespace import`,
148
- code: `
139
+ valid: [],
140
+ invalid: importSources.flatMap((importSource) => [
141
+ {
142
+ name: `[${importSource}] namespace import`,
143
+ code: `
149
144
  import * as namespace from '${importSource}';
150
145
  `,
151
- errors: [{ messageId: 'use-compiled' }],
152
- options: [{ canAutoFix: true }],
153
- },
154
- {
155
- name: `[${importSource}] unsupported import`,
156
- code: `
146
+ errors: [{ messageId: 'use-compiled' }],
147
+ options: [{ canAutoFix: true }],
148
+ },
149
+ {
150
+ name: `[${importSource}] unsupported import`,
151
+ code: `
157
152
  import { type CSSObject } from '${importSource}';
158
153
  `,
159
- errors: [{ messageId: 'use-compiled' }],
160
- options: [{ canAutoFix: true }],
161
- },
162
- ]),
154
+ errors: [{ messageId: 'use-compiled' }],
155
+ options: [{ canAutoFix: true }],
156
+ },
157
+ ]),
163
158
  });