-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: Add new codemods * chore: update comment modal-card
- @vkontakte/vkui-floating-ui@0.2.4
- @vkontakte/vkui-floating-ui@0.2.3
- @vkontakte/vkui-floating-ui@0.2.2
- @vkontakte/vkui-floating-ui@0.2.1
- @vkontakte/vkui-floating-ui@0.2.0
- @vkontakte/vkui-floating-ui@0.1.5
- @vkontakte/vkui-floating-ui@0.1.4
- @vkontakte/vkui-floating-ui@0.1.3
- @vkontakte/vkui-codemods@1.0.0
- @vkontakte/vkui-codemods@1.0.0-beta.1
- @vkontakte/vkui-codemods@1.0.0-beta.0
- @vkontakte/vkui-codemods@0.0.7
- @vkontakte/vkui-codemods@0.0.7-alpha.0
- @vkontakte/vkui-codemods@0.0.6
- @vkontakte/vkui-codemods@0.0.5
- @vkontakte/vkui-codemods@0.0.4
- v7.1.3
- v7.1.2
- v7.1.2-alpha.1
- v7.1.2-alpha.0
- v7.1.1
- v7.1.0
- v7.0.1
- v7.0.0
- v7.0.0-dev-efd91c.4
- v7.0.0-dev-efd91c.3
- v7.0.0-dev-efd91c.2
- v7.0.0-dev-efd91c.1
- v7.0.0-dev-efd91c.0
- v7.0.0-dev-d4929f.1
- v7.0.0-dev-d4929f.0
- v7.0.0-beta.2
- v7.0.0-beta.1
- v7.0.0-beta.0
- v6.7.4
- v6.7.3
- v6.7.2
- v6.7.1
- v6.7.0
- v6.6.0
- v6.5.4
- v6.5.3
- v6.5.2
- v6.5.1
- v6.5.0
- v6.4.1
- v6.4.0
- v6.3.1
- v6.3.0
- v6.2.2
- v6.2.1
- v6.2.1-f.7285.1
- v6.2.0
- v6.1.2
- v6.1.1
- v6.1.0
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.1-beta.0
- v6.0.0
- v6.0.0-beta.3
- v6.0.0-beta.2
- untagged-eef56a26a2cbd2e0f8c6
- untagged-38d8848a77655e6bea16
1 parent
4a35b1a
commit c091801
Showing
10 changed files
with
166 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/codemods/src/transforms/__testfixtures__/form-layout/basic.input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { FormLayout } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<FormLayout /> | ||
</React.Fragment> | ||
); | ||
}; |
14 changes: 14 additions & 0 deletions
14
packages/codemods/src/transforms/__tests__/__snapshots__/form-layout.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`form-layout transforms correctly 1`] = ` | ||
"import { FormLayout } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<FormLayout /> | ||
</React.Fragment> | ||
); | ||
};" | ||
`; |
14 changes: 14 additions & 0 deletions
14
packages/codemods/src/transforms/__tests__/__snapshots__/rich-tooltip.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`rich-tooltip transforms correctly 1`] = ` | ||
"import { RichTooltip } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<RichTooltip /> | ||
</React.Fragment> | ||
); | ||
};" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
jest.autoMockOff(); | ||
|
||
import { defineSnapshotTestFromFixture } from '../../testHelpers/testHelper'; | ||
|
||
const name = 'form-layout'; | ||
const fixtures = ['basic'] as const; | ||
|
||
describe(name, () => { | ||
fixtures.forEach((test) => | ||
defineSnapshotTestFromFixture(__dirname, name, global.TRANSFORM_OPTIONS, `${name}/${test}`), | ||
); | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/codemods/src/transforms/__tests__/rich-tooltip.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
jest.autoMockOff(); | ||
|
||
import { defineSnapshotTestFromFixture } from '../../testHelpers/testHelper'; | ||
|
||
const name = 'rich-tooltip'; | ||
const fixtures = ['basic'] as const; | ||
|
||
describe(name, () => { | ||
fixtures.forEach((test) => | ||
defineSnapshotTestFromFixture(__dirname, name, global.TRANSFORM_OPTIONS, `${name}/${test}`), | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import chalk from 'chalk'; | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo } from '../codemod-helpers'; | ||
import { report } from '../report'; | ||
import { JSCodeShiftOptions } from '../types'; | ||
|
||
export const parser = 'tsx'; | ||
|
||
export default function transformer(file: FileInfo, api: API, options: JSCodeShiftOptions) { | ||
const { alias } = options; | ||
const j = api.jscodeshift; | ||
const source = j(file.source); | ||
const { localName } = getImportInfo(j, file, 'FormLayout', alias); | ||
|
||
const components = source | ||
.find(j.JSXOpeningElement) | ||
.filter( | ||
(path) => path.value.name.type === 'JSXIdentifier' && path.value.name.name === localName, | ||
); | ||
|
||
if (components.size() > 0) { | ||
report( | ||
api, | ||
`: ${chalk.white.bgBlue('FormLayout')} component does not exist anymore. Use native form.`, | ||
); | ||
} | ||
|
||
return source.toSource(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import chalk from 'chalk'; | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo } from '../codemod-helpers'; | ||
import { report } from '../report'; | ||
import { JSCodeShiftOptions } from '../types'; | ||
|
||
export const parser = 'tsx'; | ||
|
||
export default function transformer(file: FileInfo, api: API, options: JSCodeShiftOptions) { | ||
const { alias } = options; | ||
const j = api.jscodeshift; | ||
const source = j(file.source); | ||
const { localName } = getImportInfo(j, file, 'PopoutWrapper', alias); | ||
|
||
const components = source | ||
.find(j.JSXOpeningElement) | ||
.filter( | ||
(path) => path.value.name.type === 'JSXIdentifier' && path.value.name.name === localName, | ||
); | ||
|
||
if (components.size() > 0) { | ||
report( | ||
api, | ||
`: When using ${chalk.white.bgBlue( | ||
'PopoutWrapper', | ||
)} you might need to apply useScrollLock() hook manually.`, | ||
); | ||
} | ||
|
||
return source.toSource(); | ||
} |