Skip to content
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

Open
wanghaisheng opened this issue May 23, 2023 · 9 comments
Open

missing semicolon how to fix this #559

wanghaisheng opened this issue May 23, 2023 · 9 comments

Comments

@wanghaisheng
Copy link

wanghaisheng commented May 23, 2023

source code is here
https://github.com/fawazahmed0/youtube-uploader/blob/main/src/upload.ts

jscodeshift --run-in-band "upload.ts"

@ElonVolo

> jscodeshift --run-in-band "upload.ts"

Processing 1 files... 
 ERR upload.ts Transformation error (Missing semicolon. (19:11))
SyntaxError: Missing semicolon. (19:11)
    at Object._raise (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\error.js:147:45)
    at Object.raiseWithData (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\error.js:142:17)
    at Object.raise (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\error.js:91:17)
    at Object.semicolon (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\util.js:127:10)
    at Object.parseVarStatement (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\statement.js:808:10)
    at Object.parseStatementContent (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\statement.js:307:21)
    at Object.parseStatement (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\statement.js:247:17)
    at Object.parseBlockOrModuleBlockBody (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\statement.js:983:25)   
    at Object.parseBlockBody (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\parser\statement.js:959:10)
    at Object.parseBlockBody (D:\Download\audio-visual\saas\tiktoka\youtube-uploader-ts\puppeteer-to-playwright\node_modules\@babel\parser\src\plugins\estree.js:137:13)
@wanghaisheng
Copy link
Author

wanghaisheng commented May 23, 2023

https://babeljs.io/docs/babel-plugin-transform-typescript
try to use this ,convert source code to this one

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
npm run convert

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
@ElonVolo

@ElonVolo
Copy link
Collaborator

ElonVolo commented May 23, 2023 via email

@wanghaisheng
Copy link
Author

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 (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parse-error/credentials.ts:62:21)
    at toParseError (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parse-error.ts:60:12)
    at JSXParserMixin.raise (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/tokenizer/index.ts:1490:19)
    at JSXParserMixin.semicolon (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/util.ts:138:10)
    at JSXParserMixin.parseVarStatement (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:1167:10)
    at JSXParserMixin.parseStatementContent (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:537:21)
    at JSXParserMixin.parseStatementLike (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:417:17)
    at JSXParserMixin.parseModuleItem (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:354:17)
    at JSXParserMixin.parseBlockOrModuleBlockBody (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:1359:16)
    at JSXParserMixin.parseBlockBody (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:1333:10)
    at JSXParserMixin.parseBlockBody (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/plugins/estree.ts:158:13)
    at JSXParserMixin.parseProgram (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:226:10)
    at JSXParserMixin.parseTopLevel (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/statement.ts:208:25)
    at JSXParserMixin.parse (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/parser/index.ts:45:10)
    at JSXParserMixin.parse (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/parser/src/plugins/estree.ts:25:43)
    at Object.parse (/Users/wenke/.nvm/versions/node/v18.2.0/lib/node_modules/jscodeshift/node_modules/@babel/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 

@ElonVolo
Copy link
Collaborator

ElonVolo commented May 23, 2023 via email

@Daniel15
Copy link
Member

Try adding --parser=ts to your jscodeshift command.

Did you try adding a semicolon where it says the semicolon is missing?

@ElonVolo
Copy link
Collaborator

ElonVolo commented May 23, 2023 via email

@wanghaisheng
Copy link
Author

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

@wanghaisheng
Copy link
Author

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 tried on my windows and mac computer. version info I will update later

@ElonVolo
Copy link
Collaborator

ElonVolo commented May 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants