Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
thepassle committed Jul 17, 2024
1 parent 1f2b54d commit 01d4f40
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion codemods/is-array-buffer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function (options) {
const root = j(file.source);
let dirtyFlag = false;

removeImport('is-array-buffer', root, j);
removeImport('is-array-buffer', root, j);

// Replace isArrayBuffer calls with (foo instanceof ArrayBuffer)
root
Expand Down
4 changes: 2 additions & 2 deletions codemods/is-boolean-object/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default function (options) {
const j = jscodeshift;
const root = j(file.source);

removeImport('is-boolean-object', root, j);
removeImport('is-boolean-object', root, j);

// Replace all calls to isBoolean with Object.prototype.toString.call
root
.find(j.CallExpression, {
Expand Down
3 changes: 1 addition & 2 deletions codemods/is-whitespace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export default function (options) {
const j = jscodeshift;
const root = j(file.source);

removeImport('is-whitespace', root, j);

removeImport('is-whitespace', root, j);

// Find the 'isWhitespace' function calls
root
Expand Down
40 changes: 20 additions & 20 deletions codemods/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
* @param {any} j - jscodeshift instance
*/
export function removeImport(name, root, j) {
// Find the import or require statement for 'is-boolean-object'
const importDeclaration = root.find(j.ImportDeclaration, {
source: {
value: name,
},
});
// Find the import or require statement for 'is-boolean-object'
const importDeclaration = root.find(j.ImportDeclaration, {
source: {
value: name,
},
});

const requireDeclaration = root.find(j.VariableDeclarator, {
init: {
callee: {
name: "require",
},
arguments: [
{
value: name,
},
],
},
});
const requireDeclaration = root.find(j.VariableDeclarator, {
init: {
callee: {
name: 'require',
},
arguments: [
{
value: name,
},
],
},
});

importDeclaration.remove();
requireDeclaration.remove();
importDeclaration.remove();
requireDeclaration.remove();
}

0 comments on commit 01d4f40

Please sign in to comment.