-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing semicolon how to fix this #559
Comments
https://babeljs.io/docs/babel-plugin-transform-typescript in the source code, he use puppeteer and I want to use playwright, so I came to this lib based on jscodeshift. https://github.com/checkly/puppeteer-to-playwright when I run it tell me source file is missing semicolon, then I want to pretty the source file ,so go to the ts transform plugin and after pretty code ,it still no luck |
I’m trying to understand the issue you’re having.One immediate thing I’m seeing is that (I believe) is that you’re not passing the path of a transformation file to jscodeshift.To run the codemod you have to use the command like this:jscodeshift -t my_transform_file.js file_to_transform.jsSent from my iPhoneOn May 23, 2023, at 04:30, HeisenBerg? ***@***.***> wrote:
https://babeljs.io/docs/babel-plugin-transform-typescript
try to use this ,convert source code to this one
*edited: removed long code snippet*
|
just as you suggest, tried this one
|
What platform are you using (mac, linux, windows)? What version node?Sent from my iPhoneOn May 23, 2023, at 11:26, HeisenBerg? ***@***.***> wrote:
just as you suggest, tried this one
transform.js is here https://github.com/checkly/puppeteer-to-playwright/blob/main/transform.js
jscodeshift -t transform.js upload.ts
Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
ERR upload.ts Transformation error (Missing semicolon. (19:11))
SyntaxError: Missing semicolon. (19:11)
at instantiate ***@***.***/parser/src/parse-error/credentials.ts:62:21)
at toParseError ***@***.***/parser/src/parse-error.ts:60:12)
at JSXParserMixin.raise ***@***.***/parser/src/tokenizer/index.ts:1490:19)
at JSXParserMixin.semicolon ***@***.***/parser/src/parser/util.ts:138:10)
at JSXParserMixin.parseVarStatement ***@***.***/parser/src/parser/statement.ts:1167:10)
at JSXParserMixin.parseStatementContent ***@***.***/parser/src/parser/statement.ts:537:21)
at JSXParserMixin.parseStatementLike ***@***.***/parser/src/parser/statement.ts:417:17)
at JSXParserMixin.parseModuleItem ***@***.***/parser/src/parser/statement.ts:354:17)
at JSXParserMixin.parseBlockOrModuleBlockBody ***@***.***/parser/src/parser/statement.ts:1359:16)
at JSXParserMixin.parseBlockBody ***@***.***/parser/src/parser/statement.ts:1333:10)
at JSXParserMixin.parseBlockBody ***@***.***/parser/src/plugins/estree.ts:158:13)
at JSXParserMixin.parseProgram ***@***.***/parser/src/parser/statement.ts:226:10)
at JSXParserMixin.parseTopLevel ***@***.***/parser/src/parser/statement.ts:208:25)
at JSXParserMixin.parse ***@***.***/parser/src/parser/index.ts:45:10)
at JSXParserMixin.parse ***@***.***/parser/src/plugins/estree.ts:25:43)
at Object.parse ***@***.***/parser/src/index.ts:67:38)
at Object.parse (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/parser/babel5Compat.js:47:22)
at Object.parse (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/recast/lib/parser.js:23:30)
at fromSource (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/src/core.js:82:25)
at core (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/src/core.js:44:5)
at j (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/src/core.js:142:12)
at _default (/Users/wenke/github/puppeteer-to-playwright-main/transform.js:3:15)
All done.
Results:
1 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 1.276seconds
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Try adding Did you try adding a semicolon where it says the semicolon is missing? |
You are having this problem with the semicolon because the author of puppeteer-to-playwright isn’t specifying that the Typescript parser is to be used. It looks like they only ever wrote that transform to transform a Javascript file.They’d need to add a —parser=ts argument to their jscodeshift command to avoid getting that error.Sent from my iPhoneOn May 23, 2023, at 12:56, Elon Volow ***@***.***> wrote:What platform are you using (mac, linux, windows)? What version node?Sent from my iPhoneOn May 23, 2023, at 11:26, HeisenBerg? ***@***.***> wrote:
just as you suggest, tried this one
transform.js is here https://github.com/checkly/puppeteer-to-playwright/blob/main/transform.js
jscodeshift -t transform.js upload.ts
Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
ERR upload.ts Transformation error (Missing semicolon. (19:11))
SyntaxError: Missing semicolon. (19:11)
at instantiate ***@***.***/parser/src/parse-error/credentials.ts:62:21)
at toParseError ***@***.***/parser/src/parse-error.ts:60:12)
at JSXParserMixin.raise ***@***.***/parser/src/tokenizer/index.ts:1490:19)
at JSXParserMixin.semicolon ***@***.***/parser/src/parser/util.ts:138:10)
at JSXParserMixin.parseVarStatement ***@***.***/parser/src/parser/statement.ts:1167:10)
at JSXParserMixin.parseStatementContent ***@***.***/parser/src/parser/statement.ts:537:21)
at JSXParserMixin.parseStatementLike ***@***.***/parser/src/parser/statement.ts:417:17)
at JSXParserMixin.parseModuleItem ***@***.***/parser/src/parser/statement.ts:354:17)
at JSXParserMixin.parseBlockOrModuleBlockBody ***@***.***/parser/src/parser/statement.ts:1359:16)
at JSXParserMixin.parseBlockBody ***@***.***/parser/src/parser/statement.ts:1333:10)
at JSXParserMixin.parseBlockBody ***@***.***/parser/src/plugins/estree.ts:158:13)
at JSXParserMixin.parseProgram ***@***.***/parser/src/parser/statement.ts:226:10)
at JSXParserMixin.parseTopLevel ***@***.***/parser/src/parser/statement.ts:208:25)
at JSXParserMixin.parse ***@***.***/parser/src/parser/index.ts:45:10)
at JSXParserMixin.parse ***@***.***/parser/src/plugins/estree.ts:25:43)
at Object.parse ***@***.***/parser/src/index.ts:67:38)
at Object.parse (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/parser/babel5Compat.js:47:22)
at Object.parse (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/recast/lib/parser.js:23:30)
at fromSource (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/src/core.js:82:25)
at core (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/src/core.js:44:5)
at j (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/src/core.js:142:12)
at _default (/Users/wenke/github/puppeteer-to-playwright-main/transform.js:3:15)
All done.
Results:
1 errors
0 unmodified
0 skipped
0 ok
Time elapsed: 1.276seconds
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I have no clue where the semicolon missing , try using pretty extension on vscode to auto insert semicolon and also failed. |
I have tried on my windows and mac computer. version info I will update later |
Here is the problem:The migration script isn’t written for typescript, so it’s seeing a typescript type annotation on line 19 and freaking out. The migration package needs to be ported to Typescript by the package author.Sent from my iPhoneOn May 23, 2023, at 21:00, HeisenBerg? ***@***.***> wrote:
Try adding --parser=ts to your jscodeshift command.
Did you try adding a semicolon where it says the semicolon is missing?
I have no clue where the semicolon missing , try using pretty extension on vscode to auto insert semicolon and also failed.
I will try your advice
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
source code is here
https://github.com/fawazahmed0/youtube-uploader/blob/main/src/upload.ts
jscodeshift --run-in-band "upload.ts"
@ElonVolo
The text was updated successfully, but these errors were encountered: