You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERR file.js Transformation error ({ type: FunctionDeclaration, start: 15, end: 32, loc: null, id: [object Object], generator: false, async: false, params: , body: [object Object], expression: false, defaults: , rest: null, returnType: null, typeParameters: null, predicate: null } does not match field "init": Expression | null of type VariableDeclarator)
Error: { type: FunctionDeclaration, start: 15, end: 32, loc: null, id: [object Object], generator: false, async: false, params: , body: [object Object], expression: false, defaults: , rest: null, returnType: null, typeParameters: null, predicate: null } does not match field "init": Expression | null of type VariableDeclarator
at addParam (/Users/seankelley/code/codemods/node_modules/ast-types/lib/types.js:450:27)
at /Users/seankelley/code/codemods/node_modules/ast-types/lib/types.js:473:25
at Array.forEach (<anonymous>)
at Function.variableDeclarator (/Users/seankelley/code/codemods/node_modules/ast-types/lib/types.js:471:35)
at Collection.exportDefaultAsNamed (/Users/seankelley/code/codemods/transforms/lib/helpers.js:160:73)
at NodePath.<anonymous> (/Users/seankelley/code/codemods/transforms/use-named-exports.js:26:33)
at NodePath.<anonymous> (/Users/seankelley/code/codemods/node_modules/jscodeshift/src/collections/Node.js:156:49)
at /Users/seankelley/code/codemods/node_modules/jscodeshift/src/Collection.js:75:36
at Array.forEach (<anonymous>)
at Collection.forEach (/Users/seankelley/code/codemods/node_modules/jscodeshift/src/Collection.js:74:18)
Suggested Solution
Rewrite to the following:
exportfunctionfoo(){}
or (assuming the file is called bar.js and we're doing the rename-export-after-file thing):
exportfunctionbar(){}
Help Needed
I'm not very familiar with jscodeshift so I hacked this poorly onto a fork of mine at seansfkelley@bb28f9e.
It performs the second modification above, that is, to rename the exported function after the file.
I'm filing this issue to help anyone else who might stumble upon the same error. Thank you so much for publishing this repo; you saved me a bunch of work!
The text was updated successfully, but these errors were encountered:
Description
Running
use-named-exports
on this:throws:
Suggested Solution
Rewrite to the following:
or (assuming the file is called
bar.js
and we're doing the rename-export-after-file thing):Help Needed
I'm not very familiar with jscodeshift so I hacked this poorly onto a fork of mine at seansfkelley@bb28f9e.
It performs the second modification above, that is, to rename the exported function after the file.
I'm filing this issue to help anyone else who might stumble upon the same error. Thank you so much for publishing this repo; you saved me a bunch of work!
The text was updated successfully, but these errors were encountered: