mihai-vlc / sublime-jsfmt

jsfmt plugin for Sublime Text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

esformatter-jsx-ignore

dvdplm opened this issue · comments

commented

Is this plugin currently working with ST3?

This fails on the "<":

function js() {
    console.log("HELLO");
  something = React.render(
    <GizmoContainer meta={meta}/>, containerNode
    );
}

My config:

{
    "alert-errors": true,
    "autoformat": true,
    "extensions":
    [
        "js",
        "jsx",
        "sublime-settings"
    ],
    "ignore-selection": false,
    "node-path": "node",
    "options":
    {
        "indent":
        {
            "value": "  "
        },
        "plugins":
        [
            "esformatter-jsx-ignore",
            "esformatter-quotes",
            "esformatter-semicolons",
            "esformatter-braces",
            "esformatter-dot-notation"
        ],
        "preset": "jquery"
    },
    "options-JSON":
    {
        "plugins":
        [
            "esformatter-quotes"
        ],
        "quotes":
        {
            "type": "double"
        }
    }
}

I ran npm install esformatter-jsx-ignore --save-dev. I restarted ST. Is there anything else I need to do to make the plugin kick in?
/cc @royriojas

Probably not. I remember I had troubles using it because sublime-jsfmt seemed to be browserified already so require calls for plugins will fail.

You might want to use the esformatter from the command line

http://stackoverflow.com/a/28627288/538752

You can put this in your package.json

  "scripts": {
    // if you pass -c you can point to your own configuration and load the plugins you want to add
    "beautify": "esbeautifier -c ./esformatter.json index.js 'src/**/*.js' 'lib/**/*.js' 'bin/**/*.js' 'specs/**/*.js'",
    "beautify-check": "esbeautifier -k index.js 'src/**/*.js' 'lib/**/*.js' 'bin/**/*.js' 'specs/**/*.js'"
  }

I guess esformatter also supports passing globs, so you might want to give that a try too.

Regards

I have managed to run this setup successfully.
In what folder did you run npm install esformatter-jsx-ignore ? It should be in the folder where jsfmt is installed.
Other than that make sure that the correct settings are applied and you don't have any .jsfmtrc file in your project because it takes precedence to the settings you set in sublime.

Please post an update here if you manage to run it successfully so I can close the issue.

commented

Will do.

On Wed, May 27, 2015 at 8:42 PM, Mihai Ionut Vilcu <notifications@github.com

wrote:

Please post an update here if you manage to run it successfully so I can
close the issue.


Reply to this email directly or view it on GitHub
#26 (comment)
.

I had a similar issue, and just tested it, I use esformatter-jsx instead of esformatter-jsx-ignore and this is the error I just received

The formatting failed please check the console for more details.
Error: Line 106: Unexpected token <

I installed esformatter-jsx in the place where I installed jsfmt, in my case this is the location

~/Library/Application Support/Sublime Text 3/Packages/jsfmt

Am I missing something? I don't have a local .jsfmtrc so I don't exactly know what could be going wrong, since you say it has worked for you, can you post your user settings for that?

Thanks in advance

commented

In what folder did you run npm install esformatter-jsx-ignore ? It should be in the folder where jsfmt is installed.

I installed it here: ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/jsfmt

I do not have any .jsfmtrc files at all yet and I'm fairly confident the settings "took": jsfmt works fine on normal non-jsx javascript files.

I get the same error message as @royriojas.

I wonder if we're talking about the same jsfmt folder. Just noticed that there's also this guy: ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/jsfmt/node_modules/jsfmt/, i.e. the "jsfmt-the-npm-package"?

I have tried on both, same error.

Roy Ronald Riojas Montenegro

On Wed, May 27, 2015 at 1:15 PM, David notifications@github.com wrote:

In what folder did you run npm install esformatter-jsx-ignore ? It should
be in the folder where jsfmt is installed.

I installed it here: ~/Library/Application\ Support/Sublime\ Text
3/Packages/jsfmt

I do not have any .jsfmtrc files at all yet and I'm fairly confident the
settings "took": jsfmt works fine on normal non-jsx javascript files.

I get the same error message as @royriojas https://github.com/royriojas.

I wonder if we're talking about the same jsfmt folder. Just noticed that
there's also this guy: ~/Library/Application\ Support/Sublime\ Text
3/Packages/jsfmt/node_modules/jsfmt/, i.e. the "jsfmt-the-npm-package"?


Reply to this email directly or view it on GitHub
#26 (comment)
.

Found the issue.

go inside PATH_TO_PACKAGES/jsfmt/node_modules/jsfmt/

do npm i --save esformatter@latest

and them it should work.

the version installed has a bug that tries to use the plugins before they are register

I see, yes I had the updated version on my PC.
I will update all the plugins and push them later today.
I delayed the update because of a bug I found there a few weeks ago.

A new release was published 1.0.7 .
Please test and let me know if it works once it gets updated on the package control

commented

Works great here, thank you so much for your help! :)

Awesome, I will close this issue.