@atlaskit/eslint-plugin-ui-styling-standard 0.15.2 → 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.
- package/CHANGELOG.md +8 -0
- package/constellation/index/migration-guide.mdx +309 -0
- package/constellation/index/overview.mdx +4 -0
- package/constellation/index/props.mdx +9 -5
- package/dist/types/rules/no-unsafe-selectors/constants.d.ts +1 -4
- package/index.js +9 -9
- package/package.json +3 -3
- package/scripts/codegen.tsx +223 -284
- package/src/rules/__tests__/utils/_tester.tsx +24 -24
- package/src/rules/atlaskit-theme/README.md +21 -19
- package/src/rules/atlaskit-theme/__tests__/test.ts +53 -53
- package/src/rules/atlaskit-theme/index.ts +107 -115
- package/src/rules/convert-props-syntax/README.md +32 -22
- package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +46 -46
- package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +175 -175
- package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +52 -52
- package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +33 -33
- package/src/rules/convert-props-syntax/index.tsx +356 -386
- package/src/rules/enforce-style-prop/README.md +21 -18
- package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +90 -96
- package/src/rules/enforce-style-prop/index.tsx +144 -160
- package/src/rules/external-rules.tsx +163 -164
- package/src/rules/local-cx-xcss/README.md +10 -6
- package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +26 -26
- package/src/rules/local-cx-xcss/index.tsx +46 -56
- package/src/rules/no-array-arguments/README.md +2 -1
- package/src/rules/no-array-arguments/__tests__/rule.test.tsx +37 -46
- package/src/rules/no-array-arguments/index.tsx +68 -69
- package/src/rules/no-classname-prop/README.md +7 -4
- package/src/rules/no-classname-prop/__tests__/rule.test.tsx +22 -22
- package/src/rules/no-classname-prop/index.tsx +25 -25
- package/src/rules/no-container-queries/README.md +11 -9
- package/src/rules/no-container-queries/__tests__/rule.test.tsx +47 -50
- package/src/rules/no-container-queries/index.tsx +75 -81
- package/src/rules/no-dynamic-styles/README.md +16 -19
- package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +58 -67
- package/src/rules/no-dynamic-styles/index.tsx +45 -48
- package/src/rules/no-exported-styles/README.md +17 -12
- package/src/rules/no-exported-styles/__tests__/rule.test.tsx +102 -111
- package/src/rules/no-exported-styles/index.tsx +36 -36
- package/src/rules/no-global-styles/README.md +15 -14
- package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +28 -28
- package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +37 -37
- package/src/rules/no-global-styles/index.tsx +59 -62
- package/src/rules/no-important-styles/README.md +5 -3
- package/src/rules/no-important-styles/__tests__/rule.test.tsx +66 -66
- package/src/rules/no-important-styles/index.tsx +49 -49
- package/src/rules/no-imported-style-values/README.md +23 -15
- package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +123 -123
- package/src/rules/no-imported-style-values/index.tsx +116 -120
- package/src/rules/no-nested-selectors/README.md +15 -13
- package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +128 -128
- package/src/rules/no-styled/README.md +14 -9
- package/src/rules/no-styled/__tests__/rule.test.tsx +31 -31
- package/src/rules/no-styled/index.tsx +34 -41
- package/src/rules/no-unsafe-selectors/README.md +103 -93
- package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +21 -24
- package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +44 -44
- package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +21 -21
- package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +57 -57
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +58 -58
- package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +85 -85
- package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +12 -12
- package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +23 -23
- package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +114 -114
- package/src/rules/no-unsafe-selectors/constants.tsx +69 -77
- package/src/rules/no-unsafe-selectors/source-position-utils.tsx +38 -38
- package/src/rules/no-unsafe-selectors/walk-css-map.tsx +178 -184
- package/src/rules/no-unsafe-values/README.md +34 -40
- package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +13 -13
- package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +104 -104
- package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +128 -128
- package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +23 -23
- package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +38 -38
- package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +18 -18
- package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +28 -28
- package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +47 -47
- package/src/rules/no-unsafe-values/index.tsx +76 -78
- package/src/rules/no-unsafe-values/messages.tsx +12 -12
- package/src/rules/no-unsafe-values/utils.tsx +370 -382
- package/src/rules/use-compiled/README.md +11 -8
- package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +32 -32
- package/src/rules/use-compiled/__tests__/css.test.tsx +53 -53
- package/src/rules/use-compiled/__tests__/imports.test.tsx +90 -95
- package/src/rules/use-compiled/__tests__/keyframes.test.tsx +47 -47
- package/src/rules/use-compiled/__tests__/pragma.test.tsx +64 -64
- package/src/rules/use-compiled/__tests__/styled.test.tsx +53 -53
- package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +10 -10
- package/src/rules/use-compiled/index.tsx +203 -226
- package/src/rules/use-compiled/is-safe.tsx +113 -117
- package/src/rules/use-compiled/utils.tsx +14 -18
- package/src/rules/utils/create-rule-with-typed-config.tsx +62 -63
- package/src/rules/utils/create-rule.tsx +3 -6
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import {
|
|
3
|
-
identifier,
|
|
4
|
-
importDeclaration,
|
|
5
|
-
importSpecifier,
|
|
6
|
-
literal,
|
|
7
|
-
} from 'eslint-codemod-utils';
|
|
2
|
+
import { identifier, importDeclaration, importSpecifier, literal } from 'eslint-codemod-utils';
|
|
8
3
|
import type * as ESTree from 'eslint-codemod-utils';
|
|
9
4
|
import type { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
10
5
|
|
|
@@ -12,264 +7,246 @@ import { findVariable } from '@atlaskit/eslint-utils/find-variable';
|
|
|
12
7
|
|
|
13
8
|
import { createLintRule } from '../utils/create-rule';
|
|
14
9
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
getFirstImportFromSource,
|
|
11
|
+
isImportDefaultSpecifier,
|
|
12
|
+
isImportNamespaceSpecifier,
|
|
13
|
+
isImportSpecifier,
|
|
19
14
|
} from './utils';
|
|
20
15
|
import { isSafeStyled, isSafeUsage } from './is-safe';
|
|
21
16
|
|
|
22
|
-
const SUPPORTED_EMOTION_IMPORTS = new Set([
|
|
23
|
-
'css',
|
|
24
|
-
'keyframes',
|
|
25
|
-
'ClassNames',
|
|
26
|
-
'jsx',
|
|
27
|
-
]);
|
|
17
|
+
const SUPPORTED_EMOTION_IMPORTS = new Set(['css', 'keyframes', 'ClassNames', 'jsx']);
|
|
28
18
|
|
|
29
19
|
const SUPPORTED_IMPORT_MAP = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
'@emotion/core': SUPPORTED_EMOTION_IMPORTS,
|
|
21
|
+
'@emotion/react': SUPPORTED_EMOTION_IMPORTS,
|
|
22
|
+
'@emotion/styled': new Set(['default']),
|
|
23
|
+
'styled-components': new Set(['default', 'css', 'keyframes']),
|
|
34
24
|
};
|
|
35
25
|
|
|
36
26
|
type SupportedImportSource = keyof typeof SUPPORTED_IMPORT_MAP;
|
|
37
27
|
|
|
38
|
-
function isSupportedImportSource(
|
|
39
|
-
|
|
40
|
-
): importSource is SupportedImportSource {
|
|
41
|
-
return importSource in SUPPORTED_IMPORT_MAP;
|
|
28
|
+
function isSupportedImportSource(importSource: string): importSource is SupportedImportSource {
|
|
29
|
+
return importSource in SUPPORTED_IMPORT_MAP;
|
|
42
30
|
}
|
|
43
31
|
|
|
44
32
|
const schema = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
type: 'array',
|
|
34
|
+
items: [
|
|
35
|
+
{
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
canAutoFix: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
57
45
|
} as const satisfies JSONSchema;
|
|
58
46
|
|
|
59
47
|
type Config = {
|
|
60
|
-
|
|
48
|
+
canAutoFix: boolean;
|
|
61
49
|
};
|
|
62
50
|
|
|
63
51
|
const defaultConfig: Config = {
|
|
64
|
-
|
|
52
|
+
canAutoFix: false,
|
|
65
53
|
};
|
|
66
54
|
|
|
67
55
|
function readConfig(context: Rule.RuleContext): Config {
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
const [config] = context.options as FromSchema<typeof schema>;
|
|
57
|
+
return Object.assign({}, defaultConfig, config);
|
|
70
58
|
}
|
|
71
59
|
|
|
72
60
|
export const rule: Rule.RuleModule = createLintRule({
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
},
|
|
61
|
+
meta: {
|
|
62
|
+
name: 'use-compiled',
|
|
63
|
+
type: 'problem',
|
|
64
|
+
fixable: 'code',
|
|
65
|
+
docs: {
|
|
66
|
+
description: 'Ensures usage of `@compiled/react` instead of other CSS-in-JS libraries',
|
|
67
|
+
recommended: true,
|
|
68
|
+
severity: 'warn',
|
|
69
|
+
},
|
|
70
|
+
messages: {
|
|
71
|
+
'use-compiled': `Use '@compiled/react' instead of '{{importSource}}'`,
|
|
72
|
+
},
|
|
73
|
+
schema,
|
|
74
|
+
},
|
|
75
|
+
create(context) {
|
|
76
|
+
const config = readConfig(context);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
Program() {
|
|
80
|
+
const pragma = context
|
|
81
|
+
.getSourceCode()
|
|
82
|
+
.getAllComments()
|
|
83
|
+
.find((n) => n.value.includes('@jsxImportSource @emotion/react'));
|
|
84
|
+
|
|
85
|
+
if (!pragma) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
context.report({
|
|
90
|
+
messageId: 'use-compiled',
|
|
91
|
+
data: {
|
|
92
|
+
importSource: '@emotion/react',
|
|
93
|
+
},
|
|
94
|
+
loc: pragma.loc!,
|
|
95
|
+
*fix(fixer) {
|
|
96
|
+
if (!config.canAutoFix) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const importDeclarations = context
|
|
101
|
+
.getSourceCode()
|
|
102
|
+
.ast.body.filter(
|
|
103
|
+
(node): node is ESTree.ImportDeclaration => node.type === 'ImportDeclaration',
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const hasEmotionImport = importDeclarations.some((importDeclaration) => {
|
|
107
|
+
const importSource = importDeclaration.source.value as string;
|
|
108
|
+
return importSource.startsWith('@emotion/');
|
|
109
|
+
});
|
|
110
|
+
const hasCompiledImport = importDeclarations.some(
|
|
111
|
+
(importDeclaration) => importDeclaration.source.value === '@compiled/react',
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
if (hasEmotionImport || !hasCompiledImport) {
|
|
115
|
+
// Considering this unsafe to auto-fix
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
yield fixer.replaceText(
|
|
120
|
+
// @ts-expect-error - types don't accept comment nodes
|
|
121
|
+
pragma,
|
|
122
|
+
`/** @jsxImportSource @compiled/react */`,
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
ImportDeclaration(node: ESTree.ImportDeclaration) {
|
|
128
|
+
const importSource = node.source.value as string;
|
|
129
|
+
if (!isSupportedImportSource(importSource)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
context.report({
|
|
134
|
+
node: node.source,
|
|
135
|
+
messageId: 'use-compiled',
|
|
136
|
+
data: {
|
|
137
|
+
importSource,
|
|
138
|
+
},
|
|
139
|
+
*fix(fixer) {
|
|
140
|
+
if (!config.canAutoFix) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const specifiers = getSpecifiers({ context, node, importSource });
|
|
145
|
+
|
|
146
|
+
if (!specifiers) {
|
|
147
|
+
// Cannot safely auto-fix
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
yield* fixImport({
|
|
152
|
+
context,
|
|
153
|
+
fixer,
|
|
154
|
+
node,
|
|
155
|
+
specifiers,
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
},
|
|
179
162
|
});
|
|
180
163
|
|
|
181
164
|
export default rule;
|
|
182
165
|
|
|
183
166
|
function getSpecifiers({
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
167
|
+
context,
|
|
168
|
+
node,
|
|
169
|
+
importSource,
|
|
187
170
|
}: {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
171
|
+
context: Rule.RuleContext;
|
|
172
|
+
node: ESTree.ImportDeclaration;
|
|
173
|
+
importSource: SupportedImportSource;
|
|
191
174
|
}) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
175
|
+
const supportedImports = SUPPORTED_IMPORT_MAP[importSource];
|
|
176
|
+
|
|
177
|
+
// We aren't supporting namespace imports
|
|
178
|
+
if (node.specifiers.some(isImportNamespaceSpecifier)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const defaultSpecifier = node.specifiers.find(isImportDefaultSpecifier);
|
|
183
|
+
if (defaultSpecifier) {
|
|
184
|
+
if (!supportedImports.has('default')) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const styled = findVariable({
|
|
188
|
+
identifier: defaultSpecifier.local,
|
|
189
|
+
sourceCode: context.getSourceCode(),
|
|
190
|
+
});
|
|
191
|
+
if (!styled || !isSafeStyled(styled)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const namedSpecifiers = node.specifiers.filter(isImportSpecifier);
|
|
197
|
+
if (
|
|
198
|
+
!namedSpecifiers.every((specifier) =>
|
|
199
|
+
isSafeUsage({
|
|
200
|
+
context,
|
|
201
|
+
specifier,
|
|
202
|
+
supportedImports,
|
|
203
|
+
}),
|
|
204
|
+
)
|
|
205
|
+
) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (defaultSpecifier) {
|
|
210
|
+
return [
|
|
211
|
+
...namedSpecifiers,
|
|
212
|
+
// ASSUMPTION: the default import, if allowed, is for `styled`
|
|
213
|
+
importSpecifier({
|
|
214
|
+
imported: identifier('styled'),
|
|
215
|
+
local: node.specifiers[0].local,
|
|
216
|
+
}),
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return namedSpecifiers;
|
|
238
221
|
}
|
|
239
222
|
|
|
240
223
|
function* fixImport({
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
224
|
+
context,
|
|
225
|
+
fixer,
|
|
226
|
+
node,
|
|
227
|
+
specifiers,
|
|
245
228
|
}: {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
229
|
+
context: Rule.RuleContext;
|
|
230
|
+
fixer: Rule.RuleFixer;
|
|
231
|
+
node: ESTree.ImportDeclaration;
|
|
232
|
+
specifiers: ESTree.ImportSpecifier[];
|
|
250
233
|
}): Generator<Rule.Fix> {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
} else {
|
|
263
|
-
yield fixer.replaceText(
|
|
264
|
-
node,
|
|
265
|
-
buildImportDeclaration(specifiers, '@compiled/react'),
|
|
266
|
-
);
|
|
267
|
-
}
|
|
234
|
+
const compiledImport = getFirstImportFromSource(context, '@compiled/react');
|
|
235
|
+
|
|
236
|
+
if (compiledImport) {
|
|
237
|
+
yield fixer.remove(node);
|
|
238
|
+
yield fixer.replaceText(
|
|
239
|
+
compiledImport,
|
|
240
|
+
buildImportDeclaration(compiledImport.specifiers.concat(specifiers), '@compiled/react'),
|
|
241
|
+
);
|
|
242
|
+
} else {
|
|
243
|
+
yield fixer.replaceText(node, buildImportDeclaration(specifiers, '@compiled/react'));
|
|
244
|
+
}
|
|
268
245
|
}
|
|
269
246
|
|
|
270
247
|
function buildImportDeclaration(
|
|
271
|
-
|
|
272
|
-
|
|
248
|
+
specifiers: ESTree.ImportDeclaration['specifiers'],
|
|
249
|
+
source: string,
|
|
273
250
|
) {
|
|
274
|
-
|
|
251
|
+
return `${importDeclaration({ specifiers, source: literal(source) })};`;
|
|
275
252
|
}
|