Skip to content

Commit 2c86fa9

Browse files
committed
Add empty createSliceBuilder codemod
1 parent 52d1519 commit 2c86fa9

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# createSliceBuilder
2+
3+
4+
## Usage
5+
6+
```
7+
npx rtk-codemods2 createSliceBuilder path/of/files/ or/some**/*glob.js
8+
9+
# or
10+
11+
yarn global add rtk-codemods2
12+
rtk-codemods2 createSliceBuilder path/of/files/ or/some**/*glob.js
13+
```
14+
15+
## Local Usage
16+
```
17+
node ./bin/cli.js createSliceBuilder path/of/files/ or/some**/*glob.js
18+
```
19+
20+
## Input / Output
21+
22+
<!--FIXTURES_TOC_START-->
23+
<!--FIXTURES_TOC_END-->
24+
25+
<!--FIXTURES_CONTENT_START-->
26+
<!--FIXTURES_CONTENT_END-->

packages/rtk-codemods2/transforms/createSliceBuilder/__testfixtures__/basic.input.js

Whitespace-only changes.

packages/rtk-codemods2/transforms/createSliceBuilder/__testfixtures__/basic.output.js

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const { getParser } = require('codemod-cli').jscodeshift;
2+
const { getOptions } = require('codemod-cli');
3+
4+
module.exports = function transformer(file, api) {
5+
const j = getParser(api);
6+
const options = getOptions();
7+
8+
return j(file.source)
9+
.find(j.Identifier)
10+
.forEach(path => {
11+
path.node.name = path.node.name
12+
.split('')
13+
.reverse()
14+
.join('');
15+
})
16+
.toSource();
17+
};
18+
19+
module.exports.type = 'js';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
const { runTransformTest } = require('codemod-cli');
4+
5+
runTransformTest({
6+
name: 'createSliceBuilder',
7+
path: require.resolve('./index.js'),
8+
fixtureDir: `${__dirname}/__testfixtures__/`,
9+
});

0 commit comments

Comments
 (0)