@atlaskit/code 15.7.0 → 15.7.2
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 +14 -0
- package/dist/types/bidi-warning/ui/index.d.ts +2 -2
- package/dist/types-ts4.5/bidi-warning/ui/index.d.ts +2 -2
- package/package.json +4 -5
- package/codemods/13.0.0-remove-unnecessary-code-props.tsx +0 -84
- package/codemods/13.0.0-rename-imports.tsx +0 -248
- package/codemods/14.0.0-lite-mode.tsx +0 -14
- package/codemods/__tests__/13.0.0-remove-unnecessary-code-props.tsx +0 -201
- package/codemods/__tests__/13.0.0-rename-imports.tsx +0 -365
- package/codemods/__tests__/14.0.0-lite-mode/14.0.0-lite-mode.tsx +0 -216
- package/codemods/__tests__/14.0.0-lite-mode/remove-language.tsx +0 -131
- package/codemods/__tests__/14.0.0-lite-mode/text-to-child.tsx +0 -203
- package/codemods/migrations/14.0.0-lite-mode/remove-language.tsx +0 -13
- package/codemods/migrations/14.0.0-lite-mode/text-to-child.tsx +0 -67
- package/codemods/utils/helpers.tsx +0 -226
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
jest.autoMockOff();
|
|
2
|
-
|
|
3
|
-
import transformer from '../13.0.0-rename-imports';
|
|
4
|
-
|
|
5
|
-
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
|
-
|
|
7
|
-
describe('Rename imports', () => {
|
|
8
|
-
defineInlineTest(
|
|
9
|
-
{ default: transformer, parser: 'tsx' },
|
|
10
|
-
{},
|
|
11
|
-
`import React from 'react';`,
|
|
12
|
-
`import React from 'react';`,
|
|
13
|
-
'should not transform if imports are not present',
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
describe('#AkCode import', () => {
|
|
17
|
-
defineInlineTest(
|
|
18
|
-
{ default: transformer, parser: 'tsx' },
|
|
19
|
-
{},
|
|
20
|
-
`import { AkCode } from '@atlaskit/code';`,
|
|
21
|
-
`import { Code } from '@atlaskit/code';`,
|
|
22
|
-
`transforms import name "AkCode" to "Code"`,
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
defineInlineTest(
|
|
26
|
-
{ default: transformer, parser: 'tsx' },
|
|
27
|
-
{},
|
|
28
|
-
`import { AkCode as CodeComponent } from '@atlaskit/code';`,
|
|
29
|
-
`import { Code as CodeComponent } from '@atlaskit/code';`,
|
|
30
|
-
`transforms import name "AkCode" with some other name to "Code"`,
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
defineInlineTest(
|
|
34
|
-
{ default: transformer, parser: 'tsx' },
|
|
35
|
-
{},
|
|
36
|
-
`
|
|
37
|
-
import React from 'react';
|
|
38
|
-
import { AkCode } from '@atlaskit/code';
|
|
39
|
-
|
|
40
|
-
const Component1 = () => <AkCode prop="abc" />;
|
|
41
|
-
|
|
42
|
-
const Component2 = React.cloneElement(AkCode);
|
|
43
|
-
|
|
44
|
-
const Component3 = AkCode;
|
|
45
|
-
|
|
46
|
-
const Component4 = withHOC(AkCode, { params: 'abc' });
|
|
47
|
-
|
|
48
|
-
const Component5 = () => <><AkCode prop="abc">text</AkCode></>;
|
|
49
|
-
|
|
50
|
-
class Component6 extends React.Component { render() { return <div><AkCode prop="abc" /></div>; } }
|
|
51
|
-
|
|
52
|
-
const element = <AkCode prop="abc" />;
|
|
53
|
-
|
|
54
|
-
const foo = {
|
|
55
|
-
AkCode: () => null,
|
|
56
|
-
};
|
|
57
|
-
`,
|
|
58
|
-
`
|
|
59
|
-
import React from 'react';
|
|
60
|
-
import { Code } from '@atlaskit/code';
|
|
61
|
-
|
|
62
|
-
const Component1 = () => <Code prop="abc" />;
|
|
63
|
-
|
|
64
|
-
const Component2 = React.cloneElement(Code);
|
|
65
|
-
|
|
66
|
-
const Component3 = Code;
|
|
67
|
-
|
|
68
|
-
const Component4 = withHOC(Code, { params: 'abc' });
|
|
69
|
-
|
|
70
|
-
const Component5 = () => <><Code prop="abc">text</Code></>;
|
|
71
|
-
|
|
72
|
-
class Component6 extends React.Component { render() { return <div><Code prop="abc" /></div>; } }
|
|
73
|
-
|
|
74
|
-
const element = <Code prop="abc" />;
|
|
75
|
-
|
|
76
|
-
const foo = {
|
|
77
|
-
AkCode: () => null,
|
|
78
|
-
};
|
|
79
|
-
`,
|
|
80
|
-
`transforms import name "AkCode" to "Code" along with its usage`,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
defineInlineTest(
|
|
84
|
-
{ default: transformer, parser: 'tsx' },
|
|
85
|
-
{},
|
|
86
|
-
`
|
|
87
|
-
import { AkCode as CodeComponent } from '@atlaskit/code';
|
|
88
|
-
|
|
89
|
-
const Component = () => <CodeComponent prop="abc" />;
|
|
90
|
-
`,
|
|
91
|
-
`
|
|
92
|
-
import { Code as CodeComponent } from '@atlaskit/code';
|
|
93
|
-
|
|
94
|
-
const Component = () => <CodeComponent prop="abc" />;
|
|
95
|
-
`,
|
|
96
|
-
`transforms import name "AkCode" to "Code" with some other name along with its usage`,
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
defineInlineTest(
|
|
100
|
-
{ default: transformer, parser: 'tsx' },
|
|
101
|
-
{},
|
|
102
|
-
`
|
|
103
|
-
import { AkCode } from '@atlaskit/code';
|
|
104
|
-
|
|
105
|
-
const Code = () => <AkCode prop="abc" />;
|
|
106
|
-
`,
|
|
107
|
-
`
|
|
108
|
-
import { Code as AkCode } from '@atlaskit/code';
|
|
109
|
-
|
|
110
|
-
const Code = () => <AkCode prop="abc" />;
|
|
111
|
-
`,
|
|
112
|
-
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" variable declaration is already present`,
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
defineInlineTest(
|
|
116
|
-
{ default: transformer, parser: 'tsx' },
|
|
117
|
-
{},
|
|
118
|
-
`
|
|
119
|
-
import { AkCode } from '@atlaskit/code';
|
|
120
|
-
|
|
121
|
-
function Code () { return <AkCode prop="abc" /> };
|
|
122
|
-
`,
|
|
123
|
-
`
|
|
124
|
-
import { Code as AkCode } from '@atlaskit/code';
|
|
125
|
-
|
|
126
|
-
function Code () { return <AkCode prop="abc" /> };
|
|
127
|
-
`,
|
|
128
|
-
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" function declaration is already present`,
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
defineInlineTest(
|
|
132
|
-
{ default: transformer, parser: 'tsx' },
|
|
133
|
-
{},
|
|
134
|
-
`
|
|
135
|
-
import { AkCode } from '@atlaskit/code';
|
|
136
|
-
|
|
137
|
-
class Code { render() { return <AkCode prop="abc" /> } };
|
|
138
|
-
`,
|
|
139
|
-
`
|
|
140
|
-
import { Code as AkCode } from '@atlaskit/code';
|
|
141
|
-
|
|
142
|
-
class Code { render() { return <AkCode prop="abc" /> } };
|
|
143
|
-
`,
|
|
144
|
-
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" class declaration is already present`,
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
defineInlineTest(
|
|
148
|
-
{ default: transformer, parser: 'tsx' },
|
|
149
|
-
{},
|
|
150
|
-
`
|
|
151
|
-
import React from 'react';
|
|
152
|
-
import { AkCode } from '@atlaskit/code';
|
|
153
|
-
import Code from './component';
|
|
154
|
-
|
|
155
|
-
class Component extends React.Component { render() { return <AkCode prop="abc" /> } };
|
|
156
|
-
`,
|
|
157
|
-
`
|
|
158
|
-
import React from 'react';
|
|
159
|
-
import { Code as AkCode } from '@atlaskit/code';
|
|
160
|
-
import Code from './component';
|
|
161
|
-
|
|
162
|
-
class Component extends React.Component { render() { return <AkCode prop="abc" /> } };
|
|
163
|
-
`,
|
|
164
|
-
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" import declaration is already present`,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
defineInlineTest(
|
|
168
|
-
{ default: transformer, parser: 'tsx' },
|
|
169
|
-
{},
|
|
170
|
-
`
|
|
171
|
-
const Code = lazy(() =>
|
|
172
|
-
import('@atlaskit/code').then(module => ({
|
|
173
|
-
default: module.AkCode,
|
|
174
|
-
})),
|
|
175
|
-
);
|
|
176
|
-
`,
|
|
177
|
-
`
|
|
178
|
-
const Code = lazy(() =>
|
|
179
|
-
import('@atlaskit/code').then(module => ({
|
|
180
|
-
AkCode: module.Code,
|
|
181
|
-
AkCodeBlock: module.CodeBlock
|
|
182
|
-
})).then(module => ({
|
|
183
|
-
default: module.AkCode,
|
|
184
|
-
})),
|
|
185
|
-
);
|
|
186
|
-
`,
|
|
187
|
-
`transforms dynamic import name "AkCode" to "Code"`,
|
|
188
|
-
);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
describe('#AkCodeBlock import', () => {
|
|
192
|
-
defineInlineTest(
|
|
193
|
-
{ default: transformer, parser: 'tsx' },
|
|
194
|
-
{},
|
|
195
|
-
`import { AkCodeBlock } from '@atlaskit/code';`,
|
|
196
|
-
`import { CodeBlock } from '@atlaskit/code';`,
|
|
197
|
-
`transforms import name "AkCodeBlock" to "CodeBlock"`,
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
defineInlineTest(
|
|
201
|
-
{ default: transformer, parser: 'tsx' },
|
|
202
|
-
{},
|
|
203
|
-
`import { AkCodeBlock as CodeBlockComponent } from '@atlaskit/code';`,
|
|
204
|
-
`import { CodeBlock as CodeBlockComponent } from '@atlaskit/code';`,
|
|
205
|
-
`transforms import name "AkCodeBlock" with some other name to "CodeBlock"`,
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
defineInlineTest(
|
|
209
|
-
{ default: transformer, parser: 'tsx' },
|
|
210
|
-
{},
|
|
211
|
-
`
|
|
212
|
-
import React from 'react';
|
|
213
|
-
import { AkCodeBlock } from '@atlaskit/code';
|
|
214
|
-
|
|
215
|
-
const Component1 = () => <AkCodeBlock prop="abc" />;
|
|
216
|
-
|
|
217
|
-
const Component2 = React.cloneElement(AkCodeBlock);
|
|
218
|
-
|
|
219
|
-
const Component3 = AkCodeBlock;
|
|
220
|
-
|
|
221
|
-
const Component4 = withHOC(AkCodeBlock, { params: 'abc' });
|
|
222
|
-
|
|
223
|
-
const Component5 = () => <><AkCodeBlock prop="abc">text</AkCodeBlock></>;
|
|
224
|
-
|
|
225
|
-
class Component6 extends React.Component { render() { return <div><AkCodeBlock prop="abc" /></div>; } }
|
|
226
|
-
|
|
227
|
-
const element = <AkCodeBlock prop="abc" />;
|
|
228
|
-
|
|
229
|
-
const foo = {
|
|
230
|
-
AkCodeBlock: () => null,
|
|
231
|
-
};
|
|
232
|
-
`,
|
|
233
|
-
`
|
|
234
|
-
import React from 'react';
|
|
235
|
-
import { CodeBlock } from '@atlaskit/code';
|
|
236
|
-
|
|
237
|
-
const Component1 = () => <CodeBlock prop="abc" />;
|
|
238
|
-
|
|
239
|
-
const Component2 = React.cloneElement(CodeBlock);
|
|
240
|
-
|
|
241
|
-
const Component3 = CodeBlock;
|
|
242
|
-
|
|
243
|
-
const Component4 = withHOC(CodeBlock, { params: 'abc' });
|
|
244
|
-
|
|
245
|
-
const Component5 = () => <><CodeBlock prop="abc">text</CodeBlock></>;
|
|
246
|
-
|
|
247
|
-
class Component6 extends React.Component { render() { return <div><CodeBlock prop="abc" /></div>; } }
|
|
248
|
-
|
|
249
|
-
const element = <CodeBlock prop="abc" />;
|
|
250
|
-
|
|
251
|
-
const foo = {
|
|
252
|
-
AkCodeBlock: () => null,
|
|
253
|
-
};
|
|
254
|
-
`,
|
|
255
|
-
`transforms import name "AkCodeBlock" to "CodeBlock" along with its usage`,
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
defineInlineTest(
|
|
259
|
-
{ default: transformer, parser: 'tsx' },
|
|
260
|
-
{},
|
|
261
|
-
`
|
|
262
|
-
import { AkCodeBlock as CodeBlockComponent } from '@atlaskit/code';
|
|
263
|
-
|
|
264
|
-
const Component = () => <CodeBlockComponent prop="abc" />;
|
|
265
|
-
`,
|
|
266
|
-
`
|
|
267
|
-
import { CodeBlock as CodeBlockComponent } from '@atlaskit/code';
|
|
268
|
-
|
|
269
|
-
const Component = () => <CodeBlockComponent prop="abc" />;
|
|
270
|
-
`,
|
|
271
|
-
`transforms import name "AkCodeBlock" to "CodeBlock" with some other name along with its usage`,
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
defineInlineTest(
|
|
275
|
-
{ default: transformer, parser: 'tsx' },
|
|
276
|
-
{},
|
|
277
|
-
`
|
|
278
|
-
import { AkCodeBlock } from '@atlaskit/code';
|
|
279
|
-
|
|
280
|
-
const CodeBlock = () => <AkCodeBlock prop="abc" />;
|
|
281
|
-
`,
|
|
282
|
-
`
|
|
283
|
-
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
284
|
-
|
|
285
|
-
const CodeBlock = () => <AkCodeBlock prop="abc" />;
|
|
286
|
-
`,
|
|
287
|
-
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" variable declaration is already present`,
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
defineInlineTest(
|
|
291
|
-
{ default: transformer, parser: 'tsx' },
|
|
292
|
-
{},
|
|
293
|
-
`
|
|
294
|
-
import { AkCodeBlock } from '@atlaskit/code';
|
|
295
|
-
|
|
296
|
-
function CodeBlock () { return <AkCodeBlock prop="abc" /> };
|
|
297
|
-
`,
|
|
298
|
-
`
|
|
299
|
-
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
300
|
-
|
|
301
|
-
function CodeBlock () { return <AkCodeBlock prop="abc" /> };
|
|
302
|
-
`,
|
|
303
|
-
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" function declaration is already present`,
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
defineInlineTest(
|
|
307
|
-
{ default: transformer, parser: 'tsx' },
|
|
308
|
-
{},
|
|
309
|
-
`
|
|
310
|
-
import React from 'react';
|
|
311
|
-
import { AkCodeBlock } from '@atlaskit/code';
|
|
312
|
-
|
|
313
|
-
class CodeBlock extends React.Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
314
|
-
`,
|
|
315
|
-
`
|
|
316
|
-
import React from 'react';
|
|
317
|
-
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
318
|
-
|
|
319
|
-
class CodeBlock extends React.Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
320
|
-
`,
|
|
321
|
-
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" class declaration is already present`,
|
|
322
|
-
);
|
|
323
|
-
|
|
324
|
-
defineInlineTest(
|
|
325
|
-
{ default: transformer, parser: 'tsx' },
|
|
326
|
-
{},
|
|
327
|
-
`
|
|
328
|
-
import { AkCodeBlock } from '@atlaskit/code';
|
|
329
|
-
import CodeBlock from './component';
|
|
330
|
-
|
|
331
|
-
class Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
332
|
-
`,
|
|
333
|
-
`
|
|
334
|
-
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
335
|
-
import CodeBlock from './component';
|
|
336
|
-
|
|
337
|
-
class Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
338
|
-
`,
|
|
339
|
-
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" import declaration is already present`,
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
defineInlineTest(
|
|
343
|
-
{ default: transformer, parser: 'tsx' },
|
|
344
|
-
{},
|
|
345
|
-
`
|
|
346
|
-
const CodeBlock = lazy(() =>
|
|
347
|
-
import('@atlaskit/code').then(module => ({
|
|
348
|
-
default: module.AkCodeBlock,
|
|
349
|
-
})),
|
|
350
|
-
);
|
|
351
|
-
`,
|
|
352
|
-
`
|
|
353
|
-
const CodeBlock = lazy(() =>
|
|
354
|
-
import('@atlaskit/code').then(module => ({
|
|
355
|
-
AkCode: module.Code,
|
|
356
|
-
AkCodeBlock: module.CodeBlock
|
|
357
|
-
})).then(module => ({
|
|
358
|
-
default: module.AkCodeBlock,
|
|
359
|
-
})),
|
|
360
|
-
);
|
|
361
|
-
`,
|
|
362
|
-
`transforms dynamic import name "AkCodeBlock" to "CodeBlock"`,
|
|
363
|
-
);
|
|
364
|
-
});
|
|
365
|
-
});
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import transformer from '../../14.0.0-lite-mode';
|
|
2
|
-
|
|
3
|
-
import { comment } from './remove-language';
|
|
4
|
-
|
|
5
|
-
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
|
-
|
|
7
|
-
describe('all transforms should be applied', () => {
|
|
8
|
-
defineInlineTest(
|
|
9
|
-
{ default: transformer, parser: 'tsx' },
|
|
10
|
-
{},
|
|
11
|
-
`
|
|
12
|
-
import React from 'react';
|
|
13
|
-
|
|
14
|
-
import { Code } from '@atlaskit/code';
|
|
15
|
-
|
|
16
|
-
export default function CodeDefaultExample() {
|
|
17
|
-
const text = "yarn changeset";
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<p>
|
|
21
|
-
To start creating a changeset, run{' '}
|
|
22
|
-
<Code language="text" text="yarn changeset" />. Then you will be prompted
|
|
23
|
-
to select packages for release.
|
|
24
|
-
</p>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
`,
|
|
28
|
-
`
|
|
29
|
-
${comment}
|
|
30
|
-
import React from 'react';
|
|
31
|
-
|
|
32
|
-
import { Code } from '@atlaskit/code';
|
|
33
|
-
|
|
34
|
-
export default function CodeDefaultExample() {
|
|
35
|
-
const text = "yarn changeset";
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<p>
|
|
39
|
-
To start creating a changeset, run{' '}
|
|
40
|
-
<Code>yarn changeset</Code>. Then you will be prompted
|
|
41
|
-
to select packages for release.
|
|
42
|
-
</p>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
`,
|
|
46
|
-
'should remove language prop if it is a string and convert text to be a child if it is a variable',
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
defineInlineTest(
|
|
50
|
-
{ default: transformer, parser: 'tsx' },
|
|
51
|
-
{},
|
|
52
|
-
`
|
|
53
|
-
import React from 'react';
|
|
54
|
-
|
|
55
|
-
import { Code as AkCode } from '@atlaskit/code';
|
|
56
|
-
|
|
57
|
-
const language = "jsx";
|
|
58
|
-
|
|
59
|
-
export default function CodeDefaultExample() {
|
|
60
|
-
return (
|
|
61
|
-
<p>
|
|
62
|
-
To start creating a changeset, run{' '}
|
|
63
|
-
<AkCode language={language} text="yarn changeset" />. Then you will be prompted
|
|
64
|
-
to select packages for release.
|
|
65
|
-
</p>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
`,
|
|
69
|
-
`
|
|
70
|
-
${comment}
|
|
71
|
-
import React from 'react';
|
|
72
|
-
|
|
73
|
-
import { Code as AkCode } from '@atlaskit/code';
|
|
74
|
-
|
|
75
|
-
const language = "jsx";
|
|
76
|
-
|
|
77
|
-
export default function CodeDefaultExample() {
|
|
78
|
-
return (
|
|
79
|
-
<p>
|
|
80
|
-
To start creating a changeset, run{' '}
|
|
81
|
-
<AkCode>yarn changeset</AkCode>. Then you will be prompted
|
|
82
|
-
to select packages for release.
|
|
83
|
-
</p>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
`,
|
|
87
|
-
'should remove language prop if it is a variable and text to be a child if it is a string and code is aliased',
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
defineInlineTest(
|
|
91
|
-
{ default: transformer, parser: 'tsx' },
|
|
92
|
-
{},
|
|
93
|
-
`
|
|
94
|
-
import React from 'react';
|
|
95
|
-
|
|
96
|
-
import { Code } from '@atlaskit/code';
|
|
97
|
-
|
|
98
|
-
const language = "jsx";
|
|
99
|
-
|
|
100
|
-
export default function CodeDefaultExample() {
|
|
101
|
-
const command = "brew thefuck";
|
|
102
|
-
return (
|
|
103
|
-
<p>
|
|
104
|
-
To start creating a changeset, run{' '}
|
|
105
|
-
<Code language={jsx} text={command} testId="super-secret" />. Then you will be prompted
|
|
106
|
-
to select packages for release.
|
|
107
|
-
</p>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
`,
|
|
111
|
-
`
|
|
112
|
-
${comment}
|
|
113
|
-
import React from 'react';
|
|
114
|
-
|
|
115
|
-
import { Code } from '@atlaskit/code';
|
|
116
|
-
|
|
117
|
-
const language = "jsx";
|
|
118
|
-
|
|
119
|
-
export default function CodeDefaultExample() {
|
|
120
|
-
const command = "brew thefuck";
|
|
121
|
-
return (
|
|
122
|
-
<p>
|
|
123
|
-
To start creating a changeset, run{' '}
|
|
124
|
-
<Code testId="super-secret">{command}</Code>. Then you will be prompted
|
|
125
|
-
to select packages for release.
|
|
126
|
-
</p>
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
`,
|
|
130
|
-
'should remove language prop if it is a variable and text to be a child and not change other props',
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
defineInlineTest(
|
|
134
|
-
{ default: transformer, parser: 'tsx' },
|
|
135
|
-
{},
|
|
136
|
-
`
|
|
137
|
-
import React from 'react';
|
|
138
|
-
|
|
139
|
-
import { Code } from '@atlaskit/code';
|
|
140
|
-
|
|
141
|
-
const language = "jsx";
|
|
142
|
-
|
|
143
|
-
const unrelated = () => <Code language="jsx" text={"rm -rf"} />
|
|
144
|
-
|
|
145
|
-
export default function CodeDefaultExample() {
|
|
146
|
-
const command = "brew thefuck";
|
|
147
|
-
return (
|
|
148
|
-
<p>
|
|
149
|
-
To start creating a changeset, run{' '}
|
|
150
|
-
<Code language={jsx} text={command} testId="super-secret" />. Then you will be prompted
|
|
151
|
-
to select packages for release.
|
|
152
|
-
</p>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
`,
|
|
156
|
-
`
|
|
157
|
-
${comment}
|
|
158
|
-
import React from 'react';
|
|
159
|
-
|
|
160
|
-
import { Code } from '@atlaskit/code';
|
|
161
|
-
|
|
162
|
-
const language = "jsx";
|
|
163
|
-
|
|
164
|
-
const unrelated = () => <Code>rm -rf</Code>
|
|
165
|
-
|
|
166
|
-
export default function CodeDefaultExample() {
|
|
167
|
-
const command = "brew thefuck";
|
|
168
|
-
return (
|
|
169
|
-
<p>
|
|
170
|
-
To start creating a changeset, run{' '}
|
|
171
|
-
<Code testId="super-secret">{command}</Code>. Then you will be prompted
|
|
172
|
-
to select packages for release.
|
|
173
|
-
</p>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
`,
|
|
177
|
-
'should remove language prop if it is a variable and text to be a child if it is a variable with other props',
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
defineInlineTest(
|
|
181
|
-
{ default: transformer, parser: 'tsx' },
|
|
182
|
-
{},
|
|
183
|
-
`
|
|
184
|
-
import React from 'react';
|
|
185
|
-
|
|
186
|
-
import { Code } from '@atlaskit/code';
|
|
187
|
-
|
|
188
|
-
export default function CodeDefaultExample() {
|
|
189
|
-
const text = "yarn changeset";
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<p>
|
|
193
|
-
To start creating a changeset, run <Code language="text" text="yarn changeset" />. All g mate.
|
|
194
|
-
</p>
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
`,
|
|
198
|
-
`
|
|
199
|
-
${comment}
|
|
200
|
-
import React from 'react';
|
|
201
|
-
|
|
202
|
-
import { Code } from '@atlaskit/code';
|
|
203
|
-
|
|
204
|
-
export default function CodeDefaultExample() {
|
|
205
|
-
const text = "yarn changeset";
|
|
206
|
-
|
|
207
|
-
return (
|
|
208
|
-
<p>
|
|
209
|
-
To start creating a changeset, run <Code>yarn changeset</Code>. All g mate.
|
|
210
|
-
</p>
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
`,
|
|
214
|
-
'should remove language prop and convert to children if code is inline',
|
|
215
|
-
);
|
|
216
|
-
});
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { createTransformer } from '@atlaskit/codemod-utils';
|
|
2
|
-
|
|
3
|
-
import removeLanguageProp from '../../migrations/14.0.0-lite-mode/remove-language';
|
|
4
|
-
|
|
5
|
-
const transformer = createTransformer([removeLanguageProp]);
|
|
6
|
-
|
|
7
|
-
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
8
|
-
|
|
9
|
-
export const comment = `/* TODO: (from codemod)
|
|
10
|
-
We could not automatically convert this code to the new API.
|
|
11
|
-
|
|
12
|
-
This file uses \`Code\`’s \`language\` prop. The support for syntax highlighting has
|
|
13
|
-
been removed to make \`Code\` lighter, quicker and more composable. If you need syntax
|
|
14
|
-
highlighting it is still available in \`CodeBlock\`. */`;
|
|
15
|
-
|
|
16
|
-
// TODO come up with a comment here
|
|
17
|
-
describe('remove language prop', () => {
|
|
18
|
-
defineInlineTest(
|
|
19
|
-
{ default: transformer, parser: 'tsx' },
|
|
20
|
-
{},
|
|
21
|
-
`
|
|
22
|
-
import React from 'react';
|
|
23
|
-
|
|
24
|
-
import { Code } from '@atlaskit/code';
|
|
25
|
-
|
|
26
|
-
export default function CodeDefaultExample() {
|
|
27
|
-
return (
|
|
28
|
-
<p>
|
|
29
|
-
To start creating a changeset, run{' '}
|
|
30
|
-
<Code language="text" text="yarn changeset" />. Then you will be prompted
|
|
31
|
-
to select packages for release.
|
|
32
|
-
</p>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
`,
|
|
36
|
-
`
|
|
37
|
-
${comment}
|
|
38
|
-
import React from 'react';
|
|
39
|
-
|
|
40
|
-
import { Code } from '@atlaskit/code';
|
|
41
|
-
|
|
42
|
-
export default function CodeDefaultExample() {
|
|
43
|
-
return (
|
|
44
|
-
<p>
|
|
45
|
-
To start creating a changeset, run{' '}
|
|
46
|
-
<Code text="yarn changeset" />. Then you will be prompted
|
|
47
|
-
to select packages for release.
|
|
48
|
-
</p>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
`,
|
|
52
|
-
'should remove language prop if it is a string',
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
defineInlineTest(
|
|
56
|
-
{ default: transformer, parser: 'tsx' },
|
|
57
|
-
{},
|
|
58
|
-
`
|
|
59
|
-
import React from 'react';
|
|
60
|
-
|
|
61
|
-
import { Code } from '@atlaskit/code';
|
|
62
|
-
|
|
63
|
-
const language = "jsx";
|
|
64
|
-
|
|
65
|
-
export default function CodeDefaultExample() {
|
|
66
|
-
return (
|
|
67
|
-
<p>
|
|
68
|
-
To start creating a changeset, run{' '}
|
|
69
|
-
<Code language={language} text="yarn changeset" />. Then you will be prompted
|
|
70
|
-
to select packages for release.
|
|
71
|
-
</p>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
`,
|
|
75
|
-
`
|
|
76
|
-
${comment}
|
|
77
|
-
import React from 'react';
|
|
78
|
-
|
|
79
|
-
import { Code } from '@atlaskit/code';
|
|
80
|
-
|
|
81
|
-
const language = "jsx";
|
|
82
|
-
|
|
83
|
-
export default function CodeDefaultExample() {
|
|
84
|
-
return (
|
|
85
|
-
<p>
|
|
86
|
-
To start creating a changeset, run{' '}
|
|
87
|
-
<Code text="yarn changeset" />. Then you will be prompted
|
|
88
|
-
to select packages for release.
|
|
89
|
-
</p>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
`,
|
|
93
|
-
'should remove language prop if it is a variable',
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
defineInlineTest(
|
|
97
|
-
{ default: transformer, parser: 'tsx' },
|
|
98
|
-
{},
|
|
99
|
-
`
|
|
100
|
-
import React from 'react';
|
|
101
|
-
|
|
102
|
-
import { Code } from '@atlaskit/code';
|
|
103
|
-
|
|
104
|
-
export default function CodeDefaultExample() {
|
|
105
|
-
return (
|
|
106
|
-
<p>
|
|
107
|
-
To start creating a changeset, run{' '}
|
|
108
|
-
<Code text="yarn changeset" />. Then you will be prompted
|
|
109
|
-
to select packages for release.
|
|
110
|
-
</p>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
`,
|
|
114
|
-
`
|
|
115
|
-
import React from 'react';
|
|
116
|
-
|
|
117
|
-
import { Code } from '@atlaskit/code';
|
|
118
|
-
|
|
119
|
-
export default function CodeDefaultExample() {
|
|
120
|
-
return (
|
|
121
|
-
<p>
|
|
122
|
-
To start creating a changeset, run{' '}
|
|
123
|
-
<Code text="yarn changeset" />. Then you will be prompted
|
|
124
|
-
to select packages for release.
|
|
125
|
-
</p>
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
`,
|
|
129
|
-
'should not do anything if language prop is not defined',
|
|
130
|
-
);
|
|
131
|
-
});
|