@atlaskit/eslint-plugin-ui-styling-standard 0.17.0 → 0.18.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 (152) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/presets/all.codegen.js +3 -2
  3. package/dist/cjs/presets/recommended.codegen.js +3 -2
  4. package/dist/cjs/rules/external-rules.js +3 -1
  5. package/dist/es2019/presets/all.codegen.js +3 -2
  6. package/dist/es2019/presets/recommended.codegen.js +3 -2
  7. package/dist/es2019/rules/external-rules.js +3 -1
  8. package/dist/esm/presets/all.codegen.js +3 -2
  9. package/dist/esm/presets/recommended.codegen.js +3 -2
  10. package/dist/esm/rules/external-rules.js +3 -1
  11. package/dist/types/index.codegen.d.ts +2 -0
  12. package/dist/types/presets/all.codegen.d.ts +2 -1
  13. package/dist/types/presets/recommended.codegen.d.ts +2 -1
  14. package/dist/types-ts4.5/index.codegen.d.ts +2 -0
  15. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  16. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
  17. package/package.json +2 -2
  18. package/afm-cc/tsconfig.json +0 -28
  19. package/afm-jira/tsconfig.json +0 -28
  20. package/build/tsconfig.json +0 -18
  21. package/constellation/atlaskit-theme/usage.mdx +0 -132
  22. package/constellation/consistent-css-prop-usage/usage.mdx +0 -7
  23. package/constellation/convert-props-syntax/usage.mdx +0 -130
  24. package/constellation/enforce-style-prop/usage.mdx +0 -47
  25. package/constellation/index/migration-guide.mdx +0 -309
  26. package/constellation/index/overview.mdx +0 -250
  27. package/constellation/index/props.mdx +0 -30
  28. package/constellation/local-cx-xcss/usage.mdx +0 -53
  29. package/constellation/no-array-arguments/usage.mdx +0 -49
  30. package/constellation/no-classname-prop/usage.mdx +0 -49
  31. package/constellation/no-container-queries/usage.mdx +0 -101
  32. package/constellation/no-css-tagged-template-expression/usage.mdx +0 -8
  33. package/constellation/no-dynamic-styles/usage.mdx +0 -130
  34. package/constellation/no-empty-styled-expression/usage.mdx +0 -8
  35. package/constellation/no-exported-css/usage.mdx +0 -8
  36. package/constellation/no-exported-keyframes/usage.mdx +0 -8
  37. package/constellation/no-exported-styles/usage.mdx +0 -87
  38. package/constellation/no-global-styles/usage.mdx +0 -60
  39. package/constellation/no-important-styles/usage.mdx +0 -33
  40. package/constellation/no-imported-style-values/usage.mdx +0 -157
  41. package/constellation/no-invalid-css-map/usage.mdx +0 -8
  42. package/constellation/no-js-xcss/usage.mdx +0 -7
  43. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -8
  44. package/constellation/no-nested-selectors/usage.mdx +0 -95
  45. package/constellation/no-styled/usage.mdx +0 -92
  46. package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -8
  47. package/constellation/no-suppress-xcss/usage.mdx +0 -28
  48. package/constellation/no-unsafe-selectors/usage.mdx +0 -370
  49. package/constellation/no-unsafe-values/usage.mdx +0 -318
  50. package/constellation/use-compiled/usage.mdx +0 -54
  51. package/index.js +0 -24
  52. package/scripts/codegen.tsx +0 -373
  53. package/src/index.codegen.tsx +0 -14
  54. package/src/index.tsx +0 -1
  55. package/src/presets/all.codegen.tsx +0 -79
  56. package/src/presets/recommended.codegen.tsx +0 -79
  57. package/src/rules/TEMPLATE.md +0 -29
  58. package/src/rules/__tests__/utils/_tester.tsx +0 -40
  59. package/src/rules/atlaskit-theme/README.md +0 -130
  60. package/src/rules/atlaskit-theme/__tests__/test.ts +0 -133
  61. package/src/rules/atlaskit-theme/index.ts +0 -134
  62. package/src/rules/convert-props-syntax/README.md +0 -128
  63. package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +0 -76
  64. package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +0 -584
  65. package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +0 -140
  66. package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +0 -69
  67. package/src/rules/convert-props-syntax/index.tsx +0 -414
  68. package/src/rules/enforce-style-prop/README.md +0 -45
  69. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +0 -243
  70. package/src/rules/enforce-style-prop/index.tsx +0 -172
  71. package/src/rules/external-rules.tsx +0 -175
  72. package/src/rules/index.codegen.tsx +0 -42
  73. package/src/rules/local-cx-xcss/README.md +0 -51
  74. package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +0 -102
  75. package/src/rules/local-cx-xcss/index.tsx +0 -62
  76. package/src/rules/no-array-arguments/README.md +0 -47
  77. package/src/rules/no-array-arguments/__tests__/rule.test.tsx +0 -107
  78. package/src/rules/no-array-arguments/index.tsx +0 -86
  79. package/src/rules/no-classname-prop/README.md +0 -47
  80. package/src/rules/no-classname-prop/__tests__/rule.test.tsx +0 -39
  81. package/src/rules/no-classname-prop/index.tsx +0 -34
  82. package/src/rules/no-container-queries/README.md +0 -99
  83. package/src/rules/no-container-queries/__tests__/rule.test.tsx +0 -139
  84. package/src/rules/no-container-queries/index.tsx +0 -94
  85. package/src/rules/no-dynamic-styles/README.md +0 -128
  86. package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +0 -135
  87. package/src/rules/no-dynamic-styles/index.tsx +0 -60
  88. package/src/rules/no-exported-styles/README.md +0 -85
  89. package/src/rules/no-exported-styles/__tests__/rule.test.tsx +0 -216
  90. package/src/rules/no-exported-styles/index.tsx +0 -52
  91. package/src/rules/no-global-styles/README.md +0 -58
  92. package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +0 -33
  93. package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +0 -46
  94. package/src/rules/no-global-styles/index.tsx +0 -82
  95. package/src/rules/no-important-styles/README.md +0 -31
  96. package/src/rules/no-important-styles/__tests__/rule.test.tsx +0 -165
  97. package/src/rules/no-important-styles/index.tsx +0 -70
  98. package/src/rules/no-imported-style-values/README.md +0 -155
  99. package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +0 -491
  100. package/src/rules/no-imported-style-values/index.tsx +0 -188
  101. package/src/rules/no-nested-selectors/README.md +0 -93
  102. package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +0 -335
  103. package/src/rules/no-nested-selectors/index.tsx +0 -99
  104. package/src/rules/no-styled/README.md +0 -90
  105. package/src/rules/no-styled/__tests__/rule.test.tsx +0 -73
  106. package/src/rules/no-styled/index.tsx +0 -45
  107. package/src/rules/no-unsafe-selectors/README.md +0 -368
  108. package/src/rules/no-unsafe-selectors/__tests__/no-ambiguous-pseudos.test.tsx +0 -368
  109. package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +0 -57
  110. package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +0 -73
  111. package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +0 -40
  112. package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +0 -101
  113. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +0 -131
  114. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +0 -132
  115. package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +0 -25
  116. package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +0 -35
  117. package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +0 -257
  118. package/src/rules/no-unsafe-selectors/constants.tsx +0 -91
  119. package/src/rules/no-unsafe-selectors/index.tsx +0 -198
  120. package/src/rules/no-unsafe-selectors/lint-selector.tsx +0 -155
  121. package/src/rules/no-unsafe-selectors/source-position-utils.tsx +0 -55
  122. package/src/rules/no-unsafe-selectors/walk-css-map.tsx +0 -226
  123. package/src/rules/no-unsafe-values/README.md +0 -316
  124. package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +0 -27
  125. package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +0 -37
  126. package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +0 -229
  127. package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +0 -267
  128. package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +0 -52
  129. package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +0 -106
  130. package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +0 -44
  131. package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +0 -48
  132. package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +0 -75
  133. package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +0 -121
  134. package/src/rules/no-unsafe-values/index.tsx +0 -94
  135. package/src/rules/no-unsafe-values/messages.tsx +0 -86
  136. package/src/rules/no-unsafe-values/utils.tsx +0 -387
  137. package/src/rules/use-compiled/README.md +0 -52
  138. package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +0 -73
  139. package/src/rules/use-compiled/__tests__/css.test.tsx +0 -126
  140. package/src/rules/use-compiled/__tests__/imports.test.tsx +0 -158
  141. package/src/rules/use-compiled/__tests__/keyframes.test.tsx +0 -140
  142. package/src/rules/use-compiled/__tests__/pragma.test.tsx +0 -108
  143. package/src/rules/use-compiled/__tests__/styled.test.tsx +0 -114
  144. package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +0 -15
  145. package/src/rules/use-compiled/index.tsx +0 -252
  146. package/src/rules/use-compiled/is-safe.tsx +0 -159
  147. package/src/rules/use-compiled/utils.tsx +0 -33
  148. package/src/rules/utils/create-rule-with-typed-config.tsx +0 -86
  149. package/src/rules/utils/create-rule.tsx +0 -13
  150. package/tsconfig.app.json +0 -47
  151. package/tsconfig.dev.json +0 -45
  152. package/tsconfig.json +0 -25
@@ -1,90 +0,0 @@
1
- Blocks the `styled` API, which creates unnecessary indirection.
2
-
3
- This indirection:
4
-
5
- - obfuscates which tag is being rendered
6
- - adds linting complexity
7
- - promotes exported styles
8
- - can complicate refactoring
9
-
10
- Use the `css` API instead. It has better performance and clarity.
11
-
12
- ## Examples
13
-
14
- ### Incorrect
15
-
16
- ```tsx
17
- import styled from 'styled-components';
18
-
19
- const Component = styled.div`
20
- color: red;
21
- `;
22
- export default styled.div({ color: 'red' });
23
- ```
24
-
25
- ```tsx
26
- import styled2 from '@emotion/styled';
27
-
28
- export const Component = styled2('div')`…`;
29
- ```
30
-
31
- ```tsx
32
- import styled from 'styled-components';
33
- import { styled as styled3 } from '@compiled/react';
34
-
35
- const Component = styled.div`color: red;`
36
- export const ComponentTwo = styled3(Component)({ … });
37
- ```
38
-
39
- ```tsx
40
- import styled from 'styled-components';
41
-
42
- export default styled.div.attrs((props) => ({ 'data-testid': props.testId }))({
43
- color: 'red',
44
- });
45
- ```
46
-
47
- ```tsx
48
- import styled from 'styled-components';
49
-
50
- export default styled.div.attrs((props) => ({ 'data-testid': props.testId }))`
51
- color: red;
52
- `;
53
- ```
54
-
55
- ### Correct
56
-
57
- ```tsx
58
- import { css, jsx } from '@emotion/react';
59
- import { token } from '@atlaskit/tokens';
60
-
61
- const styles = css({ color: token('color.text.subtlest') });
62
-
63
- const Component = ({ children }) => {
64
- return <div css={styles}>{children}</div>;
65
- };
66
- ```
67
-
68
- ```tsx
69
- import { Box, xcss } from '@atlaskit/primitives';
70
-
71
- const styles = xcss({
72
- color: 'color.text.subtlest',
73
- });
74
-
75
- const Component = ({ children }) => {
76
- return <Box xcss={styles}>{children}</Box>;
77
- };
78
- ```
79
-
80
- ## FAQ
81
-
82
- ### How will I extend like `styled(Button)`?
83
-
84
- Don't modify the styles of components you don't own, unless they provide an explicit bounded
85
- interface for doing so — such as the `xcss` prop.
86
-
87
- Use props (excluding `className` which is prohibited) to modify component styles instead.
88
-
89
- The Atlassian Design System, for example, no longer supports `styled(Button)` because it is unsafe
90
- for us to evolve the system with.
@@ -1,73 +0,0 @@
1
- import { tester } from '../../__tests__/utils/_tester';
2
- import rule from '../index';
3
-
4
- tester.run('no-styled', rule, {
5
- valid: [
6
- {
7
- code: `
8
- import { css, jsx } from '@emotion/react';
9
-
10
- const styles = css({ color: 'red' });
11
-
12
- const Component = ({ children }) => {
13
- return <div css={styles}>{children}</div>;
14
- };
15
- `,
16
- },
17
- {
18
- code: `
19
- import { Box, xcss } from '@atlaskit/primitives';
20
-
21
- const styles = xcss({
22
- color: 'color.text.subtlest',
23
- });
24
-
25
- const Component = ({ children }) => {
26
- return <Box xcss={styles}>{children}</Box>;
27
- };
28
- `,
29
- },
30
- ],
31
- invalid: [
32
- {
33
- code: `
34
- import styled from 'styled-components';
35
-
36
- const Component = styled.div\`color: red;\`
37
- `,
38
- errors: [{ messageId: 'no-styled' }],
39
- },
40
- {
41
- code: `
42
- import styled from 'styled-components';
43
-
44
- export default styled.div({ color: 'red' });
45
- `,
46
- errors: [{ messageId: 'no-styled' }],
47
- },
48
- {
49
- code: `
50
- import { styled as styled3 } from '@compiled/react';
51
-
52
- export const ComponentTwo = styled3(Component)({ color: 'blue' });
53
- `,
54
- errors: [{ messageId: 'no-styled' }],
55
- },
56
- {
57
- code: `
58
- import styled from 'styled-components';
59
-
60
- export default styled.div.attrs(props => ({ 'data-testid': props.testId }))({ color: 'red' });
61
- `,
62
- errors: [{ messageId: 'no-styled' }],
63
- },
64
- {
65
- code: `
66
- import styled from 'styled-components';
67
-
68
- export default styled.div.attrs(props => ({ 'data-testid': props.testId }))\`color: red\`;
69
- `,
70
- errors: [{ messageId: 'no-styled' }],
71
- },
72
- ],
73
- });
@@ -1,45 +0,0 @@
1
- import { type MemberExpression, type CallExpression } from 'eslint-codemod-utils';
2
- import { isStyled, getImportSources } from '@atlaskit/eslint-utils/is-supported-import';
3
-
4
- import { createLintRule } from '../utils/create-rule';
5
-
6
- export const rule = createLintRule({
7
- meta: {
8
- name: 'no-styled',
9
- docs: {
10
- description: 'Disallows usage of the `styled` imports',
11
- recommended: true,
12
- severity: 'error',
13
- },
14
- messages: {
15
- 'no-styled': "Avoid usages of styled, eg. styled.div, styled('div'), styled(Component), etc.",
16
- },
17
- type: 'problem',
18
- },
19
- create(context) {
20
- return {
21
- CallExpression: (node: CallExpression) => {
22
- const references = context.getScope().references;
23
- const importSources = getImportSources(context);
24
-
25
- if (isStyled(node, references, importSources)) {
26
- context.report({ node, messageId: 'no-styled' });
27
- }
28
- },
29
- MemberExpression: (node: MemberExpression) => {
30
- const references = context.getScope().references;
31
- const importSources = getImportSources(context);
32
-
33
- if (node.object.type === 'Identifier' && isStyled(node.object, references, importSources)) {
34
- const parent = context.getAncestors().at(-1);
35
- if (parent && (parent.type === 'CallExpression' || parent.type === 'MemberExpression')) {
36
- return;
37
- }
38
- context.report({ node, messageId: 'no-styled' });
39
- }
40
- },
41
- };
42
- },
43
- });
44
-
45
- export default rule;
@@ -1,368 +0,0 @@
1
- Blocks unsafe CSS selectors.
2
-
3
- Use alongside
4
- [no-nested-selectors](https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-nested-selectors/usage)
5
- which blocks nested CSS selectors.
6
-
7
- Blocking unsafe selectors enables static analysis and also prevents regressions and incidents when
8
- migrating styles at scale.
9
-
10
- ## Examples
11
-
12
- ### Keyframes
13
-
14
- #### Incorrect
15
-
16
- Don't use `@keyframes` at-rules in styles.
17
-
18
- ```tsx
19
- import { css } from '@compiled/react';
20
-
21
- css({
22
- '@keyframes fadeIn': {
23
- from: {
24
- opacity: 0,
25
- },
26
- to: {
27
- opacity: 1,
28
- },
29
- },
30
- animation: '1s ease-in fadeIn',
31
- });
32
- ```
33
-
34
- #### Correct
35
-
36
- Use the `keyframes` API.
37
-
38
- ```tsx
39
- import { css, keyframes } from '@compiled/react';
40
-
41
- const fadeIn = keyframes({
42
- from: {
43
- opacity: 0,
44
- },
45
- to: {
46
- opacity: 1,
47
- },
48
- });
49
-
50
- css({
51
- animation: `1s ease-in ${fadeIn}`,
52
- });
53
- ```
54
-
55
- ### Legacy pseudo-element syntax
56
-
57
- #### Incorrect
58
-
59
- Don't use the legacy single colon syntax for pseudo-elements.
60
-
61
- This issue is autofixable.
62
-
63
- ```tsx
64
- import { css } from '@compiled/react';
65
-
66
- css({
67
- '&:after': {
68
- content: '""',
69
- },
70
- });
71
- ```
72
-
73
- #### Correct
74
-
75
- Use the double colon syntax for pseudo-elements.
76
-
77
- ```tsx
78
- import { css } from '@compiled/react';
79
-
80
- css({
81
- '&::after': {
82
- content: '""',
83
- },
84
- });
85
- ```
86
-
87
- ### Increased specificity selectors
88
-
89
- #### Incorrect
90
-
91
- Don't use the nesting selector to increase specificity of styles.
92
-
93
- ```tsx
94
- import { css } from '@compiled/react';
95
- import { token } from '@atlaskit/tokens';
96
-
97
- css({
98
- '&&': {
99
- color: token('color.text'),
100
- },
101
- });
102
- ```
103
-
104
- #### Correct
105
-
106
- Use styles that do not require increased specificity.
107
-
108
- ```tsx
109
- import { css } from '@compiled/react';
110
- import { token } from '@atlaskit/tokens';
111
-
112
- css({
113
- color: token('color.text'),
114
- });
115
- ```
116
-
117
- ### At-rules
118
-
119
- #### Incorrect
120
-
121
- Don't use at-rules in styles (see **Correct** below for exceptions).
122
-
123
- ```tsx
124
- import { css } from '@compiled/react';
125
-
126
- css({
127
- '@scope (.article-body) to (figure)': {
128
- img: {
129
- display: 'block',
130
- },
131
- },
132
- });
133
- ```
134
-
135
- #### Correct
136
-
137
- Use only allowed at-rules:
138
-
139
- - `@media` (through our
140
- [breakpoints](https://atlassian.design/components/primitives/responsive/breakpoints/examples))
141
- - `@property`
142
- - `@supports`
143
-
144
- ```tsx
145
- import { css } from '@compiled/react';
146
- import { media } from '@atlaskit/primitives/responsive';
147
-
148
- css({
149
- [media.above.sm]: {
150
- display: 'block',
151
- },
152
- });
153
- ```
154
-
155
- ### Restricted pseudo-selectors
156
-
157
- #### Incorrect
158
-
159
- Don't use pseudo-classes which take arguments or implicitly rely on external context.
160
-
161
- ```tsx
162
- import { css } from '@compiled/react';
163
- import { token } from '@atlaskit/tokens';
164
-
165
- css({
166
- '&:hover': {
167
- backgroundColor: token('color.background.neutral.hovered'),
168
- },
169
- '&:not(:hover)': {
170
- backgroundColor: token('color.background.neutral'),
171
- }
172
- '&:first-child': {
173
- fontWeight: token('font.weight.bold'),
174
- },
175
- });
176
- ```
177
-
178
- #### Correct
179
-
180
- ```tsx
181
- import { css } from '@compiled/react';
182
- import { token } from '@atlaskit/tokens';
183
-
184
- type Props = { isFirstChild: boolean };
185
-
186
- const baseStyles = css({
187
- backgroundColor: token('color.background.neutral'),
188
- '&:hover': {
189
- backgroundColor: token('color.background.neutral.hovered'),
190
- },
191
- });
192
-
193
- const firstChildStyles = css({
194
- fontWeight: token('font.weight.bold'),
195
- });
196
-
197
- const Component = ({ isFirstChild }: Props) => (
198
- <div css={[baseStyles, isFirstChild && firstChildStyles]} />
199
- );
200
- ```
201
-
202
- ### Ambiguous pseudo-selectors
203
-
204
- #### Incorrect
205
-
206
- Don't use pseudo-selectors without a leading selector, as they are ambiguous and interpreted
207
- differently between contexts.
208
-
209
- For example some contexts will treat `:hover` as `&:hover` while others will treat it as `& :hover`
210
- (which targets descendants).
211
-
212
- This issue is autofixable. By default a nesting selector `&` is added unless the
213
- `shouldAlwaysInsertNestingSelectorForAmbiguousPseudos` option is disabled.
214
-
215
- ```tsx
216
- import { css } from '@compiled/react';
217
-
218
- css({
219
- /**
220
- * This pseudo-class has no leading selector and is ambiguous.
221
- */
222
- ':hover': {},
223
-
224
- /**
225
- * In some contexts the above is treated as implicitly containing a nesting selector.
226
- */
227
- '&:hover': {},
228
-
229
- /**
230
- * In other contexts it is treated as a descendant selector.
231
- *
232
- * (The selectors below are equivalent.)
233
- */
234
- '*:hover': {},
235
- '& :hover': {},
236
- '& *:hover': {},
237
- });
238
- ```
239
-
240
- #### Correct
241
-
242
- Use explicit selectors. Do not rely on implicit or undefined behavior for pseudo-selectors.
243
-
244
- ```tsx
245
-
246
- ```
247
-
248
- ### Grouped at-rules
249
-
250
- #### Incorrect
251
-
252
- Don't group at-rules with the `cssMap` API.
253
-
254
- ````tsx
255
- import { cssMap } from '@compiled/react';
256
-
257
- ```tsx
258
- cssMap({
259
- success: {
260
- '@media': {
261
- '(min-width: 900px)': {},
262
- '(min-width: 1200px)': {},
263
- },
264
- },
265
- });
266
- ````
267
-
268
- #### Correct
269
-
270
- Write flattened at-rules instead.
271
-
272
- ```tsx
273
- cssMap({
274
- success: {
275
- selectors: {
276
- '&:not(:active)': {
277
- backgroundColor: 'white',
278
- },
279
- },
280
- },
281
- });
282
- ```
283
-
284
- ### Correct
285
-
286
- ```tsx
287
- const fadeIn = keyframes({
288
- from: {
289
- opacity: 0,
290
- },
291
- to: {
292
- opacity: 1,
293
- },
294
- });
295
-
296
- css({
297
- animationName: fadeIn,
298
- });
299
- ```
300
-
301
- ```tsx
302
- css({
303
- '::after': {
304
- content: '""',
305
- width: 100,
306
- height: 100,
307
- backgroundColor: 'red',
308
- },
309
- });
310
- ```
311
-
312
- ```tsx
313
- css({
314
- '&:first-of-type': {
315
- width: 100,
316
- },
317
- });
318
- ```
319
-
320
- ```tsx
321
- css({
322
- '&:hover': {},
323
- });
324
- ```
325
-
326
- ```tsx
327
- cssMap({
328
- success: {
329
- '@media (min-width: 900px)': {},
330
- '@media (min-width: 1200px)': {},
331
- },
332
- });
333
- ```
334
-
335
- ```tsx
336
- cssMap({
337
- success: {
338
- backgroundColor: 'white',
339
- '&:active': {
340
- backgroundColor: 'green',
341
- },
342
- },
343
- });
344
- ```
345
-
346
- ## Options
347
-
348
- ### `importSources: string[]`
349
-
350
- By default, this rule will check styles using:
351
-
352
- - `@atlaskit/css`
353
- - `@atlaskit/primitives`
354
- - `@compiled/react`
355
- - `@emotion/react`
356
- - `@emotion/core`
357
- - `@emotion/styled`
358
- - `styled-components`
359
-
360
- Override this list with the `importSources` option, which accepts an array of package names.
361
-
362
- ### `shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: boolean`
363
-
364
- By default this rule will always fix ambiguous pseudo-selectors by inserting a leading `&` (nesting
365
- selector).
366
-
367
- Set `shouldAlwaysInsertNestingSelectorForAmbiguousPseudos` to `false` to disable this auto-fix. When
368
- disabled, a suggestion will be provided instead of an auto-fix.