@atlaskit/eslint-plugin-ui-styling-standard 0.15.2 → 0.16.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 (105) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/constellation/consistent-css-prop-usage/usage.mdx +3 -1
  3. package/constellation/index/migration-guide.mdx +309 -0
  4. package/constellation/index/overview.mdx +4 -0
  5. package/constellation/index/props.mdx +9 -5
  6. package/constellation/no-css-tagged-template-expression/usage.mdx +5 -2
  7. package/constellation/no-empty-styled-expression/usage.mdx +5 -2
  8. package/constellation/no-exported-css/usage.mdx +5 -2
  9. package/constellation/no-exported-keyframes/usage.mdx +5 -2
  10. package/constellation/no-invalid-css-map/usage.mdx +5 -2
  11. package/constellation/no-js-xcss/usage.mdx +3 -1
  12. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +5 -2
  13. package/constellation/no-styled-tagged-template-expression/usage.mdx +5 -2
  14. package/constellation/no-suppress-xcss/usage.mdx +6 -3
  15. package/dist/types/rules/no-unsafe-selectors/constants.d.ts +1 -4
  16. package/index.js +9 -9
  17. package/package.json +3 -3
  18. package/scripts/codegen.tsx +223 -284
  19. package/src/rules/__tests__/utils/_tester.tsx +24 -24
  20. package/src/rules/atlaskit-theme/README.md +21 -19
  21. package/src/rules/atlaskit-theme/__tests__/test.ts +53 -53
  22. package/src/rules/atlaskit-theme/index.ts +107 -115
  23. package/src/rules/convert-props-syntax/README.md +32 -22
  24. package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +46 -46
  25. package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +175 -175
  26. package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +52 -52
  27. package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +33 -33
  28. package/src/rules/convert-props-syntax/index.tsx +356 -386
  29. package/src/rules/enforce-style-prop/README.md +21 -18
  30. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +90 -96
  31. package/src/rules/enforce-style-prop/index.tsx +144 -160
  32. package/src/rules/external-rules.tsx +163 -164
  33. package/src/rules/local-cx-xcss/README.md +10 -6
  34. package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +26 -26
  35. package/src/rules/local-cx-xcss/index.tsx +46 -56
  36. package/src/rules/no-array-arguments/README.md +2 -1
  37. package/src/rules/no-array-arguments/__tests__/rule.test.tsx +37 -46
  38. package/src/rules/no-array-arguments/index.tsx +68 -69
  39. package/src/rules/no-classname-prop/README.md +7 -4
  40. package/src/rules/no-classname-prop/__tests__/rule.test.tsx +22 -22
  41. package/src/rules/no-classname-prop/index.tsx +25 -25
  42. package/src/rules/no-container-queries/README.md +11 -9
  43. package/src/rules/no-container-queries/__tests__/rule.test.tsx +47 -50
  44. package/src/rules/no-container-queries/index.tsx +75 -81
  45. package/src/rules/no-dynamic-styles/README.md +16 -19
  46. package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +58 -67
  47. package/src/rules/no-dynamic-styles/index.tsx +45 -48
  48. package/src/rules/no-exported-styles/README.md +17 -12
  49. package/src/rules/no-exported-styles/__tests__/rule.test.tsx +102 -111
  50. package/src/rules/no-exported-styles/index.tsx +36 -36
  51. package/src/rules/no-global-styles/README.md +15 -14
  52. package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +28 -28
  53. package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +37 -37
  54. package/src/rules/no-global-styles/index.tsx +59 -62
  55. package/src/rules/no-important-styles/README.md +5 -3
  56. package/src/rules/no-important-styles/__tests__/rule.test.tsx +66 -66
  57. package/src/rules/no-important-styles/index.tsx +49 -49
  58. package/src/rules/no-imported-style-values/README.md +23 -15
  59. package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +123 -123
  60. package/src/rules/no-imported-style-values/index.tsx +116 -120
  61. package/src/rules/no-nested-selectors/README.md +15 -13
  62. package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +141 -128
  63. package/src/rules/no-styled/README.md +14 -9
  64. package/src/rules/no-styled/__tests__/rule.test.tsx +31 -31
  65. package/src/rules/no-styled/index.tsx +34 -41
  66. package/src/rules/no-unsafe-selectors/README.md +103 -93
  67. package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +21 -24
  68. package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +44 -44
  69. package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +21 -21
  70. package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +57 -57
  71. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +58 -58
  72. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +85 -85
  73. package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +12 -12
  74. package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +23 -23
  75. package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +133 -114
  76. package/src/rules/no-unsafe-selectors/constants.tsx +69 -77
  77. package/src/rules/no-unsafe-selectors/source-position-utils.tsx +38 -38
  78. package/src/rules/no-unsafe-selectors/walk-css-map.tsx +178 -184
  79. package/src/rules/no-unsafe-values/README.md +34 -40
  80. package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +13 -13
  81. package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +18 -18
  82. package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +104 -104
  83. package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +128 -128
  84. package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +23 -23
  85. package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +38 -38
  86. package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +18 -18
  87. package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +18 -18
  88. package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +28 -28
  89. package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +47 -47
  90. package/src/rules/no-unsafe-values/index.tsx +76 -78
  91. package/src/rules/no-unsafe-values/messages.tsx +12 -12
  92. package/src/rules/no-unsafe-values/utils.tsx +370 -382
  93. package/src/rules/use-compiled/README.md +11 -8
  94. package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +32 -32
  95. package/src/rules/use-compiled/__tests__/css.test.tsx +53 -53
  96. package/src/rules/use-compiled/__tests__/imports.test.tsx +90 -95
  97. package/src/rules/use-compiled/__tests__/keyframes.test.tsx +47 -47
  98. package/src/rules/use-compiled/__tests__/pragma.test.tsx +64 -64
  99. package/src/rules/use-compiled/__tests__/styled.test.tsx +53 -53
  100. package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +10 -10
  101. package/src/rules/use-compiled/index.tsx +203 -226
  102. package/src/rules/use-compiled/is-safe.tsx +113 -117
  103. package/src/rules/use-compiled/utils.tsx +14 -18
  104. package/src/rules/utils/create-rule-with-typed-config.tsx +62 -63
  105. package/src/rules/utils/create-rule.tsx +3 -6
@@ -8,225 +8,219 @@ import type { Rule } from 'eslint';
8
8
  import type * as ESTree from 'eslint-codemod-utils';
9
9
 
10
10
  type CssMapVisitorArgs =
11
- | {
12
- type: 'variant' | 'declaration' | 'ruleset' | 'selectors';
13
- node: ESTree.Property;
14
- }
15
- | { type: 'grouped-at-rules'; node: ESTree.Property; atRule: string };
11
+ | {
12
+ type: 'variant' | 'declaration' | 'ruleset' | 'selectors';
13
+ node: ESTree.Property;
14
+ }
15
+ | { type: 'grouped-at-rules'; node: ESTree.Property; atRule: string };
16
16
 
17
17
  type CssMapVisitor = (args: CssMapVisitorArgs) => void;
18
18
 
19
19
  export function walkCssMap({
20
- context,
21
- importSources,
22
- visitor,
20
+ context,
21
+ importSources,
22
+ visitor,
23
23
  }: {
24
- context: Rule.RuleContext;
25
- program: ESTree.Program;
26
- importSources: string[];
27
- visitor: CssMapVisitor;
24
+ context: Rule.RuleContext;
25
+ program: ESTree.Program;
26
+ importSources: string[];
27
+ visitor: CssMapVisitor;
28
28
  }) {
29
- const program = context.getSourceCode().ast;
30
-
31
- const importDeclaration = program.body.find(
32
- (node): node is ESTree.ImportDeclaration =>
33
- node.type === 'ImportDeclaration' &&
34
- importSources.includes(node.source.value as string),
35
- );
36
-
37
- const specifier = importDeclaration?.specifiers.find(
38
- (specifier) =>
39
- specifier.type === 'ImportSpecifier' &&
40
- specifier.imported.name === 'cssMap',
41
- );
42
-
43
- if (!specifier) {
44
- return;
45
- }
46
-
47
- const [variable] = context
48
- .getSourceCode()
49
- .scopeManager.getDeclaredVariables(specifier);
50
-
51
- if (!variable) {
52
- return;
53
- }
54
-
55
- variable.references.forEach((reference) => {
56
- const identifier = reference.identifier as ESTree.Identifier &
57
- Rule.NodeParentExtension;
58
-
59
- const { parent } = identifier;
60
- if (parent.type !== 'CallExpression') {
61
- return;
62
- }
63
-
64
- const variantMap = parent.arguments[0];
65
- if (variantMap.type !== 'ObjectExpression') {
66
- return;
67
- }
68
-
69
- walkCssMapVariantMap({ variantMap, visitor });
70
- });
29
+ const program = context.getSourceCode().ast;
30
+
31
+ const importDeclaration = program.body.find(
32
+ (node): node is ESTree.ImportDeclaration =>
33
+ node.type === 'ImportDeclaration' && importSources.includes(node.source.value as string),
34
+ );
35
+
36
+ const specifier = importDeclaration?.specifiers.find(
37
+ (specifier) => specifier.type === 'ImportSpecifier' && specifier.imported.name === 'cssMap',
38
+ );
39
+
40
+ if (!specifier) {
41
+ return;
42
+ }
43
+
44
+ const [variable] = context.getSourceCode().scopeManager.getDeclaredVariables(specifier);
45
+
46
+ if (!variable) {
47
+ return;
48
+ }
49
+
50
+ variable.references.forEach((reference) => {
51
+ const identifier = reference.identifier as ESTree.Identifier & Rule.NodeParentExtension;
52
+
53
+ const { parent } = identifier;
54
+ if (parent.type !== 'CallExpression') {
55
+ return;
56
+ }
57
+
58
+ const variantMap = parent.arguments[0];
59
+ if (variantMap.type !== 'ObjectExpression') {
60
+ return;
61
+ }
62
+
63
+ walkCssMapVariantMap({ variantMap, visitor });
64
+ });
71
65
  }
72
66
 
73
67
  function walkCssMapVariantMap({
74
- variantMap,
75
- visitor,
68
+ variantMap,
69
+ visitor,
76
70
  }: {
77
- variantMap: ESTree.ObjectExpression;
78
- visitor: CssMapVisitor;
71
+ variantMap: ESTree.ObjectExpression;
72
+ visitor: CssMapVisitor;
79
73
  }) {
80
- variantMap.properties.forEach((property) => {
81
- if (property.type !== 'Property') {
82
- return;
83
- }
74
+ variantMap.properties.forEach((property) => {
75
+ if (property.type !== 'Property') {
76
+ return;
77
+ }
84
78
 
85
- walkCssMapVariant({ variant: property, visitor });
86
- });
79
+ walkCssMapVariant({ variant: property, visitor });
80
+ });
87
81
  }
88
82
 
89
83
  function walkCssMapVariant({
90
- variant,
91
- visitor,
84
+ variant,
85
+ visitor,
92
86
  }: {
93
- variant: ESTree.Property;
94
- visitor: CssMapVisitor;
87
+ variant: ESTree.Property;
88
+ visitor: CssMapVisitor;
95
89
  }) {
96
- visitor({
97
- type: 'variant',
98
- node: variant,
99
- });
100
-
101
- if (variant.value.type !== 'ObjectExpression') {
102
- return;
103
- }
104
-
105
- variant.value.properties.forEach((property) => {
106
- if (property.type !== 'Property') {
107
- return;
108
- }
109
-
110
- if (property.value.type !== 'ObjectExpression') {
111
- visitor({
112
- type: 'declaration',
113
- node: property,
114
- });
115
- return;
116
- }
117
-
118
- const keyValue = getKeyValue(property.key);
119
-
120
- if (keyValue && /^@[A-z-]+$/.test(keyValue)) {
121
- walkCssMapAtRuleGrouping({ atRuleGrouping: property, visitor });
122
- return;
123
- }
124
-
125
- if (keyValue === 'selectors') {
126
- walkCssMapSelectors({ selectors: property, visitor });
127
- }
128
-
129
- walkStyleRuleset({ ruleset: property, visitor });
130
- });
90
+ visitor({
91
+ type: 'variant',
92
+ node: variant,
93
+ });
94
+
95
+ if (variant.value.type !== 'ObjectExpression') {
96
+ return;
97
+ }
98
+
99
+ variant.value.properties.forEach((property) => {
100
+ if (property.type !== 'Property') {
101
+ return;
102
+ }
103
+
104
+ if (property.value.type !== 'ObjectExpression') {
105
+ visitor({
106
+ type: 'declaration',
107
+ node: property,
108
+ });
109
+ return;
110
+ }
111
+
112
+ const keyValue = getKeyValue(property.key);
113
+
114
+ if (keyValue && /^@[A-z-]+$/.test(keyValue)) {
115
+ walkCssMapAtRuleGrouping({ atRuleGrouping: property, visitor });
116
+ return;
117
+ }
118
+
119
+ if (keyValue === 'selectors') {
120
+ walkCssMapSelectors({ selectors: property, visitor });
121
+ }
122
+
123
+ walkStyleRuleset({ ruleset: property, visitor });
124
+ });
131
125
  }
132
126
 
133
127
  function walkCssMapAtRuleGrouping({
134
- atRuleGrouping,
135
- visitor,
128
+ atRuleGrouping,
129
+ visitor,
136
130
  }: {
137
- atRuleGrouping: ESTree.Property;
138
- visitor: CssMapVisitor;
131
+ atRuleGrouping: ESTree.Property;
132
+ visitor: CssMapVisitor;
139
133
  }) {
140
- const atRule = getKeyValue(atRuleGrouping.key);
141
- if (!atRule) {
142
- return;
143
- }
144
-
145
- visitor({
146
- type: 'grouped-at-rules',
147
- node: atRuleGrouping,
148
- atRule,
149
- });
150
-
151
- if (atRuleGrouping.value.type !== 'ObjectExpression') {
152
- return;
153
- }
154
-
155
- atRuleGrouping.value.properties.forEach((property) => {
156
- if (property.type !== 'Property') {
157
- return;
158
- }
159
-
160
- walkStyleRuleset({ ruleset: property, visitor });
161
- });
134
+ const atRule = getKeyValue(atRuleGrouping.key);
135
+ if (!atRule) {
136
+ return;
137
+ }
138
+
139
+ visitor({
140
+ type: 'grouped-at-rules',
141
+ node: atRuleGrouping,
142
+ atRule,
143
+ });
144
+
145
+ if (atRuleGrouping.value.type !== 'ObjectExpression') {
146
+ return;
147
+ }
148
+
149
+ atRuleGrouping.value.properties.forEach((property) => {
150
+ if (property.type !== 'Property') {
151
+ return;
152
+ }
153
+
154
+ walkStyleRuleset({ ruleset: property, visitor });
155
+ });
162
156
  }
163
157
 
164
158
  function walkCssMapSelectors({
165
- selectors,
166
- visitor,
159
+ selectors,
160
+ visitor,
167
161
  }: {
168
- selectors: ESTree.Property;
169
- visitor: CssMapVisitor;
162
+ selectors: ESTree.Property;
163
+ visitor: CssMapVisitor;
170
164
  }) {
171
- visitor({
172
- type: 'selectors',
173
- node: selectors,
174
- });
175
-
176
- if (selectors.value.type !== 'ObjectExpression') {
177
- return;
178
- }
179
-
180
- selectors.value.properties.forEach((property) => {
181
- if (property.type !== 'Property') {
182
- return;
183
- }
184
-
185
- walkStyleRuleset({ ruleset: property, visitor });
186
- });
165
+ visitor({
166
+ type: 'selectors',
167
+ node: selectors,
168
+ });
169
+
170
+ if (selectors.value.type !== 'ObjectExpression') {
171
+ return;
172
+ }
173
+
174
+ selectors.value.properties.forEach((property) => {
175
+ if (property.type !== 'Property') {
176
+ return;
177
+ }
178
+
179
+ walkStyleRuleset({ ruleset: property, visitor });
180
+ });
187
181
  }
188
182
 
189
183
  function walkStyleRuleset({
190
- ruleset,
191
- visitor,
184
+ ruleset,
185
+ visitor,
192
186
  }: {
193
- ruleset: ESTree.Property;
194
- visitor: CssMapVisitor;
187
+ ruleset: ESTree.Property;
188
+ visitor: CssMapVisitor;
195
189
  }) {
196
- visitor({
197
- type: 'ruleset',
198
- node: ruleset,
199
- });
200
-
201
- if (ruleset.value.type !== 'ObjectExpression') {
202
- return;
203
- }
204
-
205
- ruleset.value.properties.forEach((property) => {
206
- if (property.type !== 'Property') {
207
- return;
208
- }
209
-
210
- if (property.value.type === 'ObjectExpression') {
211
- walkStyleRuleset({ ruleset: property, visitor });
212
- return;
213
- }
214
-
215
- visitor({
216
- type: 'declaration',
217
- node: property,
218
- });
219
- });
190
+ visitor({
191
+ type: 'ruleset',
192
+ node: ruleset,
193
+ });
194
+
195
+ if (ruleset.value.type !== 'ObjectExpression') {
196
+ return;
197
+ }
198
+
199
+ ruleset.value.properties.forEach((property) => {
200
+ if (property.type !== 'Property') {
201
+ return;
202
+ }
203
+
204
+ if (property.value.type === 'ObjectExpression') {
205
+ walkStyleRuleset({ ruleset: property, visitor });
206
+ return;
207
+ }
208
+
209
+ visitor({
210
+ type: 'declaration',
211
+ node: property,
212
+ });
213
+ });
220
214
  }
221
215
 
222
216
  function getKeyValue(key: ESTree.Property['key']): string | null {
223
- if (key.type === 'Identifier') {
224
- return key.name;
225
- }
217
+ if (key.type === 'Identifier') {
218
+ return key.name;
219
+ }
226
220
 
227
- if (key.type === 'Literal') {
228
- return key.value?.toString() ?? null;
229
- }
221
+ if (key.type === 'Literal') {
222
+ return key.value?.toString() ?? null;
223
+ }
230
224
 
231
- return null;
225
+ return null;
232
226
  }
@@ -6,14 +6,14 @@ This rule prevents the usage of styles that are difficult/impossible to statical
6
6
 
7
7
  **Function calls**
8
8
 
9
- Function calls are not allowed as arguments or as values,
10
- unless they are specified in `allowedFunctionCalls` (or in the default list).
9
+ Function calls are not allowed as arguments or as values, unless they are specified in
10
+ `allowedFunctionCalls` (or in the default list).
11
11
 
12
12
  ```tsx
13
13
  import { css } from '@compiled/react';
14
14
 
15
15
  function getStyles() {
16
- return { width: 100 };
16
+ return { width: 100 };
17
17
  }
18
18
 
19
19
  const styles = css(getStyles());
@@ -23,30 +23,30 @@ const styles = css(getStyles());
23
23
  import { css } from '@compiled/react';
24
24
 
25
25
  function getWidth() {
26
- return 100;
26
+ return 100;
27
27
  }
28
28
 
29
29
  const styles = css({
30
- width: getWidth(),
30
+ width: getWidth(),
31
31
  });
32
32
  ```
33
33
 
34
34
  **Dynamic keys**
35
35
 
36
- Dynamic keys are not allowed,
37
- unless they are specified in `allowedDynamicKeys` (or in the default list).
36
+ Dynamic keys are not allowed, unless they are specified in `allowedDynamicKeys` (or in the default
37
+ list).
38
38
 
39
39
  ```tsx
40
40
  import { css } from '@compiled/react';
41
41
  import { SELECTOR } from 'my-package';
42
42
 
43
43
  const styles = css({
44
- [SELECTOR]: {
45
- color: 'red',
46
- },
47
- [`${SELECTOR} > p`]: {
48
- width: 100,
49
- },
44
+ [SELECTOR]: {
45
+ color: 'red',
46
+ },
47
+ [`${SELECTOR} > p`]: {
48
+ width: 100,
49
+ },
50
50
  });
51
51
  ```
52
52
 
@@ -62,11 +62,11 @@ import { css } from '@compiled/react';
62
62
  import { SELECTOR } from 'my-package';
63
63
 
64
64
  function myFunction() {
65
- return '5px';
65
+ return '5px';
66
66
  }
67
67
 
68
68
  const styles = css({
69
- height: myFunction,
69
+ height: myFunction,
70
70
  });
71
71
  ```
72
72
 
@@ -79,11 +79,11 @@ import { css } from '@compiled/react';
79
79
  import { token } from '@atlaskit/tokens';
80
80
 
81
81
  const colors = {
82
- text: token('color.text'),
82
+ text: token('color.text'),
83
83
  };
84
84
 
85
85
  const styles = css({
86
- color: colors.text,
86
+ color: colors.text,
87
87
  });
88
88
  ```
89
89
 
@@ -95,24 +95,23 @@ Spread elements are not allowed.
95
95
  import { css } from '@compiled/react';
96
96
 
97
97
  const buttonStyles = {
98
- color: 'blue',
98
+ color: 'blue',
99
99
  };
100
100
 
101
101
  const styles = css({
102
- ...buttonStyles,
102
+ ...buttonStyles,
103
103
  });
104
104
  ```
105
105
 
106
106
  **Array values**
107
107
 
108
- Array values are not allowed.
109
- This syntax is not supported by most styling libraries.
108
+ Array values are not allowed. This syntax is not supported by most styling libraries.
110
109
 
111
110
  ```tsx
112
111
  import { css } from '@compiled/react';
113
112
 
114
113
  const styles = css({
115
- '::before': [{ fontWeight: 'bold' }, { color: 'red' }],
114
+ '::before': [{ fontWeight: 'bold' }, { color: 'red' }],
116
115
  });
117
116
  ```
118
117
 
@@ -122,31 +121,24 @@ Things to note about the following example:
122
121
 
123
122
  - The `warningStyles` are conditionally applied using the `css` prop
124
123
  - The dynamic `width` is applied using the `style` prop
125
- - The `token()` calls are allowed because they are statically analyzable (and in the default allow-list)
124
+ - The `token()` calls are allowed because they are statically analyzable (and in the default
125
+ allow-list)
126
126
 
127
127
  ```tsx
128
128
  import { css } from '@compiled/react';
129
129
  import { token } from '@atlaskit/tokens';
130
130
 
131
131
  const baseStyles = css({
132
- height: 100,
132
+ height: 100,
133
133
  });
134
134
 
135
135
  const warningStyles = css({
136
- color: token('color.text.warning'),
137
- backgroundColor: token('color.background.warning'),
136
+ color: token('color.text.warning'),
137
+ backgroundColor: token('color.background.warning'),
138
138
  });
139
139
 
140
- const Component = ({
141
- isWarning,
142
- width,
143
- }: {
144
- isWarning: boolean;
145
- width: number;
146
- }) => {
147
- return (
148
- <div style={{ width }} css={[baseStyles, isWarning && warningStyles]} />
149
- );
140
+ const Component = ({ isWarning, width }: { isWarning: boolean; width: number }) => {
141
+ return <div style={{ width }} css={[baseStyles, isWarning && warningStyles]} />;
150
142
  };
151
143
  ```
152
144
 
@@ -156,7 +148,8 @@ const Component = ({
156
148
 
157
149
  Use this to allow specified imports as dynamic keys, in addition to the built-in allow-list.
158
150
 
159
- Each value should be a two-element array. The first item is the entrypoint, and the second item is a named export.
151
+ Each value should be a two-element array. The first item is the entrypoint, and the second item is a
152
+ named export.
160
153
 
161
154
  Default imports are not supported.
162
155
 
@@ -182,7 +175,8 @@ Default imports are not supported.
182
175
 
183
176
  Use this to allow specific functions to be called, in addition to the built-in allow-list.
184
177
 
185
- Each value should be a two-element array. The first item is the entrypoint, and the second item is a named export.
178
+ Each value should be a two-element array. The first item is the entrypoint, and the second item is a
179
+ named export.
186
180
 
187
181
  Default imports are not currently supported.
188
182
 
@@ -216,5 +210,5 @@ By default, this rule will check `css` usages from:
216
210
  - `@emotion/styled`
217
211
  - `styled-components`
218
212
 
219
- To change this list of libraries, you can define a custom set of `importSources`, which accepts an array of package names (strings).
220
- This will override the built-in allow-list.
213
+ To change this list of libraries, you can define a custom set of `importSources`, which accepts an
214
+ array of package names (strings). This will override the built-in allow-list.
@@ -2,15 +2,15 @@ import { typescriptEslintTester } from '../../__tests__/utils/_tester';
2
2
  import rule from '../index';
3
3
 
4
4
  typescriptEslintTester.run(
5
- 'no-unsafe-values',
6
- // @ts-expect-error
7
- rule,
8
- {
9
- valid: [],
10
- invalid: [
11
- {
12
- name: 'passing an array of values',
13
- code: `
5
+ 'no-unsafe-values',
6
+ // @ts-expect-error
7
+ rule,
8
+ {
9
+ valid: [],
10
+ invalid: [
11
+ {
12
+ name: 'passing an array of values',
13
+ code: `
14
14
  import { css } from '@compiled/react';
15
15
 
16
16
  const styles = css({
@@ -20,8 +20,8 @@ typescriptEslintTester.run(
20
20
  ]
21
21
  });
22
22
  `,
23
- errors: [{ messageId: 'no-array-values' }],
24
- },
25
- ],
26
- },
23
+ errors: [{ messageId: 'no-array-values' }],
24
+ },
25
+ ],
26
+ },
27
27
  );
@@ -2,15 +2,15 @@ import { typescriptEslintTester } from '../../__tests__/utils/_tester';
2
2
  import rule from '../index';
3
3
 
4
4
  typescriptEslintTester.run(
5
- 'no-unsafe-values',
6
- // @ts-expect-error
7
- rule,
8
- {
9
- valid: [],
10
- invalid: [
11
- {
12
- name: 'ternary value',
13
- code: `
5
+ 'no-unsafe-values',
6
+ // @ts-expect-error
7
+ rule,
8
+ {
9
+ valid: [],
10
+ invalid: [
11
+ {
12
+ name: 'ternary value',
13
+ code: `
14
14
  import { css } from '@compiled/react';
15
15
 
16
16
  const isVisible = false;
@@ -18,11 +18,11 @@ typescriptEslintTester.run(
18
18
  opacity: isVisible ? 1 : 0
19
19
  });
20
20
  `,
21
- errors: [{ messageId: 'no-conditional-values' }],
22
- },
23
- {
24
- name: 'boolean expression values',
25
- code: `
21
+ errors: [{ messageId: 'no-conditional-values' }],
22
+ },
23
+ {
24
+ name: 'boolean expression values',
25
+ code: `
26
26
  import { css } from '@compiled/react';
27
27
 
28
28
  const isVisible = false;
@@ -30,8 +30,8 @@ typescriptEslintTester.run(
30
30
  opacity: isVisible && 1
31
31
  });
32
32
  `,
33
- errors: [{ messageId: 'no-conditional-values' }],
34
- },
35
- ],
36
- },
33
+ errors: [{ messageId: 'no-conditional-values' }],
34
+ },
35
+ ],
36
+ },
37
37
  );