@@ -11,14 +11,7 @@ export default function transformer(
1111) {
1212 const source = j ( file . source ) ;
1313
14- /**
15- * Early exit condition
16- * -----
17- * It is often good practice to exit early and return the original source file
18- * if it does not contain code relevant to the codemod.
19- * See this page for more information:
20- * https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/your-first-codemod#output
21- */
14+ // Exit early if file is not importing memoize-one
2215 if ( ! hasImportDeclaration ( j , source , 'memoize-one' ) ) {
2316 return file . source ;
2417 }
@@ -40,6 +33,9 @@ export default function transformer(
4033 if ( second == null ) {
4134 return ;
4235 }
36+ // We are going to wrap the existing customEqualityFn in our new one
37+ // 4.0.0 EqualityFn → (a, b) => boolean [called for each argument]
38+ // 5.0.0 EqualityFn → ([newArgs], [lastArgs]) => boolean [called once with all arguments]
4339 if (
4440 second . type === 'FunctionExpression' ||
4541 second . type === 'ArrowFunctionExpression' ||
@@ -95,22 +91,5 @@ export default function transformer(
9591 }
9692 } ) ;
9793
98- /**
99- * Codemod logic goes here 👇
100- * -----
101- * This is where the core logic for your codemod will go,
102- * consider grouping specific actions into 'motions' and running them in sequence
103- *
104- * See this page for more information:
105- * https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/authoring#motions
106- */
107- // source.findVariableDeclarators('foo').renameTo('bar');
108-
109- /**
110- * Return your modified AST here 👇
111- * -----
112- * This is where your modified AST will be transformed back into a string
113- * and written back to the file.
114- */
11594 return source . toSource ( options . printOptions ) ;
11695}
0 commit comments