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

Errors when using *.js #3

Open
devcybiko opened this issue Jan 24, 2019 · 2 comments
Open

Errors when using *.js #3

devcybiko opened this issue Jan 24, 2019 · 2 comments
Assignees

Comments

@devcybiko
Copy link

Seeing this when I petty-af *.js - possibly due to node version?

core$ node --version
v10.15.0
(node:64393) UnhandledPromiseRejectionWarning: SyntaxError: 'import' and 'export' may appear only with 'sourceType: "module"' (6:0)
    at Parser.raise (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:3834:17)
    at Parser.assertModuleNodeAllowed (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7332:12)
    at Parser.parseStatementContent (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7297:16)
    at Parser.parseStatement (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7199:17)
    at Parser.parseBlockOrModuleBlockBody (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7757:25)
    at Parser.parseBlockBody (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7744:10)
    at Parser.parseTopLevel (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7164:10)
    at Parser.parse (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:8565:17)
    at Object.parse (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:10537:38)
    at pettifyFile (/usr/local/lib/node_modules/petty-af/src/index.js:39:28)
(node:64393) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 11)
(node:64393) UnhandledPromiseRejectionWarning: SyntaxError: 'import' and 'export' may appear only with 'sourceType: "module"' (7:0)
    at Parser.raise (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:3834:17)
    at Parser.assertModuleNodeAllowed (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7332:12)
    at Parser.parseStatementContent (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7297:16)
    at Parser.parseStatement (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7199:17)
    at Parser.parseBlockOrModuleBlockBody (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7757:25)
    at Parser.parseBlockBody (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7744:10)
    at Parser.parseTopLevel (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:7164:10)
    at Parser.parse (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:8565:17)
    at Object.parse (/usr/local/lib/node_modules/petty-af/node_modules/@babel/parser/lib/index.js:10537:38)
    at pettifyFile (/usr/local/lib/node_modules/petty-af/src/index.js:39:28)
(node:64393) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 12)
@hsubox76 hsubox76 self-assigned this Jan 24, 2019
@hsubox76
Copy link
Owner

Works for me in node 10.15.0 on *.js.

I think that I saw this before when there was some error in my code (or just something the parser doesn't like), the parser wasn't able to get past it and make the AST I think. Is it ok to show me the file you ran it on? If it's a lot of files could you find one that causes it? If it's too much trouble that's totally ok, this is in no way worth a lot of trouble on your part.

Obviously I should be handling the error better even if the input code is irregular in some way.

@mohsen1
Copy link

mohsen1 commented Mar 11, 2020

Any file with import or export throws.

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