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

Export statements break jsfmt #187

Open
vedraan opened this issue May 20, 2016 · 2 comments
Open

Export statements break jsfmt #187

vedraan opened this issue May 20, 2016 · 2 comments

Comments

@vedraan
Copy link

vedraan commented May 20, 2016

Almost all types of export statements break jsfmt.

I don't think the issue is with esformatter as it works as expected from CLI. I tried sublime-esformatter also based on esformatter and it formats as expected.

Example (fails both in Sublime and using jsfmt from terminal):

export const foo = Math.sqrt(2);

generates this error in console on save:

JSFMT ==>
Error: /Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/jsfmt.js:31
        throw err;
        ^

TypeError: Cannot read property 'indexOf' of undefined
    at exports._transformNode (/Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter-var-each/lib/esformatter-var-each.js:200:63)
    at Array.forEach (native)
    at Object.moonwalk (/Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter-var-each/node_modules/rocambole/rocambole.js:414:11)
    at Object.exports.transform (/Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter-var-each/lib/esformatter-var-each.js:311:13)
    at /Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter/lib/plugins.js:83:26
    at Array.forEach (native)
    at Object.exec (/Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter/lib/plugins.js:81:12)
    at Object.transform (/Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter/node_modules/mout/function/partial.js:15:22)
    at transform (/Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter/lib/transform.js:52:11)
    at doFormat (/Users/vedran/Library/Application Support/Sublime Text 3/Packages/jsfmt/node_modules/jsfmt/node_modules/esformatter/lib/format.js:130:3)

Most of the other export statements also break jsfmt, though this one works OK:

export class someClass {}
@pindamonhangaba
Copy link

Same here.

@bauersimon
Copy link

Another example: export const someObject = {};. Very frustrating... jsfmt 0.5.3.

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