Skip to content

Commit b5957ac

Browse files
committed
chore(ui-codemods): add codemod to remove CodeEditor form the ui package
INSTUI-4635
1 parent 4e9f486 commit b5957ac

File tree

11 files changed

+202
-1
lines changed

11 files changed

+202
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @ts-nocheck
2+
import { CodeEditor } from '@instructure/ui'
3+
4+
function test() {
5+
CodeEditor()
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @ts-nocheck
2+
import { CodeEditor } from '@instructure/ui-code-editor'
3+
4+
function test() {
5+
CodeEditor()
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @ts-nocheck
2+
import { CodeEditor as Editor } from '@instructure/ui'
3+
4+
function test() {
5+
Editor()
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @ts-nocheck
2+
import { CodeEditor as Editor } from '@instructure/ui-code-editor'
3+
4+
function test() {
5+
Editor()
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// commment
2+
3+
// @ts-nocheck
4+
import { CodeEditor, Button } from '@instructure/ui'
5+
import { test } from '@test/other-import'
6+
7+
function test() {
8+
//comment
9+
CodeEditor()
10+
Button()
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// commment
2+
3+
// @ts-nocheck
4+
import { Button } from '@instructure/ui'
5+
import { CodeEditor } from '@instructure/ui-code-editor'
6+
import { test } from '@test/other-import'
7+
8+
function test() {
9+
//comment
10+
CodeEditor()
11+
Button()
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @ts-nocheck
2+
import { CodeEditor as Editor, Button } from '@instructure/ui'
3+
4+
//test
5+
function test() {
6+
Editor()
7+
Button()
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-nocheck
2+
import { Button } from '@instructure/ui'
3+
4+
import { CodeEditor as Editor } from '@instructure/ui-code-editor'
5+
6+
//test
7+
function test() {
8+
Editor()
9+
Button()
10+
}

packages/ui-codemods/lib/__node_tests__/codemods.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import { runTest } from './runTest'
2626
import updateV10Breaking from '../updateV10Breaking'
2727
import removeAsFromInstUISettingsProvider from '../removeAsFromInstUISettingsProvider'
28+
import updateCodeEditorImport from '../updateCodeEditorImport'
2829

2930
describe('test codemods', () => {
3031
it('test InstUI v10 color codemods', () => {
@@ -34,4 +35,8 @@ describe('test codemods', () => {
3435
it('test removing "as" prop from InstUISettingsProvider', () => {
3536
runTest(removeAsFromInstUISettingsProvider)
3637
})
38+
39+
it('test removing CodeEditor', () => {
40+
runTest(updateCodeEditorImport)
41+
})
3742
})

packages/ui-codemods/lib/instUIv11Codemods.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import { Transform } from 'jscodeshift'
2626
import instUICodemodExecutor from './utils/instUICodemodExecutor'
2727
import { removeAsProp } from './removeAsFromInstUISettingsProvider'
28+
import { updateCodeEditor } from './updateCodeEditorImport'
2829

2930
/**
3031
* Runs all InstUI v10 -> v11 upgrade codemods
@@ -35,7 +36,12 @@ const InstUIv11Codemods: Transform = (
3536
options?: { fileName?: string; usePrettier?: boolean }
3637
) => {
3738
// TODO add other v11 codemods to this array
38-
return instUICodemodExecutor([removeAsProp], file, api, options)
39+
return instUICodemodExecutor(
40+
[removeAsProp, updateCodeEditor],
41+
file,
42+
api,
43+
options
44+
)
3945
}
4046

4147
export default InstUIv11Codemods

0 commit comments

Comments
 (0)