-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codemods): Use .cjs extension for CommonJS files (#7333)
* bug(codemods): rename CommonJS files to .cjs Rename CommonJS files in codemods to distinguish them from ES module files otherwise used in this project. Resolve an issue occuring since package.json in codemods is removed when publishing causing module type data to be lost. Fix issue #7154 * Fix knip errors * Add file extension to tests * Update migration doc --------- Co-authored-by: Lachlan Collins <[email protected]>
- Loading branch information
1 parent
2ffd9fb
commit 2aca521
Showing
28 changed files
with
90 additions
and
78 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
packages/query-codemods/src/v4/__tests__/key-transformation.test.cjs
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,38 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const defineTest = require('jscodeshift/dist/testUtils').defineTest | ||
|
||
defineTest(__dirname, 'key-transformation.cjs', null, 'default-import', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest(__dirname, 'key-transformation.cjs', null, 'named-import', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest(__dirname, 'key-transformation.cjs', null, 'namespaced-import', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest( | ||
__dirname, | ||
'key-transformation.cjs', | ||
null, | ||
'parameter-is-identifier', | ||
{ | ||
parser: 'tsx', | ||
}, | ||
) | ||
|
||
defineTest( | ||
__dirname, | ||
'key-transformation.cjs', | ||
null, | ||
'parameter-is-object-expression', | ||
{ | ||
parser: 'tsx', | ||
}, | ||
) | ||
|
||
defineTest(__dirname, 'key-transformation.cjs', null, 'type-arguments', { | ||
parser: 'tsx', | ||
}) |
32 changes: 0 additions & 32 deletions
32
packages/query-codemods/src/v4/__tests__/key-transformation.test.js
This file was deleted.
Oops, something went wrong.
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: 5 additions & 5 deletions
10
...ery-codemods/src/v4/key-transformation.js → ...ry-codemods/src/v4/key-transformation.cjs
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
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...-hydrate/__tests__/rename-hydrate.test.js → .../is-loading/__tests__/is-loading.test.cjs
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const defineTest = require('jscodeshift/dist/testUtils').defineTest | ||
|
||
defineTest(__dirname, 'rename-hydrate', null, 'default-import', { | ||
defineTest(__dirname, 'is-loading.cjs', null, 'default-import', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest(__dirname, 'rename-hydrate', null, 'named-import', { | ||
defineTest(__dirname, 'is-loading.cjs', null, 'named-import', { | ||
parser: 'tsx', | ||
}) |
6 changes: 3 additions & 3 deletions
6
...-codemods/src/v5/is-loading/is-loading.js → ...codemods/src/v5/is-loading/is-loading.cjs
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
4 changes: 2 additions & 2 deletions
4
...data/__tests__/keep-previous-data.test.js → ...ata/__tests__/keep-previous-data.test.cjs
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const defineTest = require('jscodeshift/dist/testUtils').defineTest | ||
|
||
defineTest(__dirname, 'keep-previous-data', null, 'default', { | ||
defineTest(__dirname, 'keep-previous-data.cjs', null, 'default', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest(__dirname, 'keep-previous-data', null, 'named', { | ||
defineTest(__dirname, 'keep-previous-data.cjs', null, 'named', { | ||
parser: 'tsx', | ||
}) |
8 changes: 4 additions & 4 deletions
8
.../keep-previous-data/keep-previous-data.js → ...keep-previous-data/keep-previous-data.cjs
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...5/is-loading/__tests__/is-loading.test.js → ...loads/__tests__/remove-overloads.test.cjs
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const defineTest = require('jscodeshift/dist/testUtils').defineTest | ||
|
||
defineTest(__dirname, 'is-loading', null, 'default-import', { | ||
defineTest(__dirname, 'remove-overloads.cjs', null, 'default-import', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest(__dirname, 'is-loading', null, 'named-import', { | ||
defineTest(__dirname, 'remove-overloads.cjs', null, 'bug-reports', { | ||
parser: 'tsx', | ||
}) |
6 changes: 3 additions & 3 deletions
6
...c/v5/remove-overloads/remove-overloads.js → .../v5/remove-overloads/remove-overloads.cjs
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: 5 additions & 5 deletions
10
...formers/filter-aware-usage-transformer.js → ...ormers/filter-aware-usage-transformer.cjs
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
6 changes: 3 additions & 3 deletions
6
...rmers/query-fn-aware-usage-transformer.js → ...mers/query-fn-aware-usage-transformer.cjs
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
2 changes: 1 addition & 1 deletion
2
...ds/src/v5/remove-overloads/utils/index.js → ...s/src/v5/remove-overloads/utils/index.cjs
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...rloads/__tests__/remove-overloads.test.js → ...hydrate/__tests__/rename-hydrate.test.cjs
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const defineTest = require('jscodeshift/dist/testUtils').defineTest | ||
|
||
defineTest(__dirname, 'remove-overloads', null, 'default-import', { | ||
defineTest(__dirname, 'rename-hydrate.cjs', null, 'default-import', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest(__dirname, 'remove-overloads', null, 'bug-reports', { | ||
defineTest(__dirname, 'rename-hydrate.cjs', null, 'named-import', { | ||
parser: 'tsx', | ||
}) |
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
packages/query-codemods/src/v5/rename-properties/__tests__/rename-properties.test.cjs
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,16 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const defineTest = require('jscodeshift/dist/testUtils').defineTest | ||
|
||
defineTest(__dirname, 'rename-properties.cjs', null, 'rename-cache-time', { | ||
parser: 'tsx', | ||
}) | ||
|
||
defineTest( | ||
__dirname, | ||
'rename-properties.cjs', | ||
null, | ||
'rename-use-error-boundary', | ||
{ | ||
parser: 'tsx', | ||
}, | ||
) |
10 changes: 0 additions & 10 deletions
10
packages/query-codemods/src/v5/rename-properties/__tests__/rename-properties.test.js
This file was deleted.
Oops, something went wrong.
File renamed without changes.