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

Top level ungrouped rules in.jsbeautifyrc are ignored #434

Closed
ryanpcmcquen opened this issue Jul 17, 2017 · 13 comments
Closed

Top level ungrouped rules in.jsbeautifyrc are ignored #434

ryanpcmcquen opened this issue Jul 17, 2017 · 13 comments

Comments

@ryanpcmcquen
Copy link

I have one setup for the package (~/Library/Application Support/Sublime Text 3/Packages/User/.jsbeautifyrc), one in my home directory ~/.jsbeautifyrc, and one in the top level project folder as well. Yet despite all that, the jslint_happy setting is being ignored and function() is not being converted to function ().

Mac OS 10.12.x & Sublime Text 3 build 3126.

@victorporof
Copy link
Owner

Can you post your configs? I'll take a look.

@ryanpcmcquen
Copy link
Author

Certainly!

The one in my home folder and the top level project directory is:

{
    "indent_size": 4,
    "indent_with_tabs": false,
    "jslint_happy": true,
    "wrap_line_length": 0
}

The one in ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/.jsbeautifyrc is:

{
    "jslint_happy": true
}

@victorporof
Copy link
Owner

victorporof commented Jul 21, 2017

This seems like a jsbeautify issue, please file this bug at https://github.com/beautify-web/js-beautify/issues

I can confirm that in this plugin, jsbeautifyrc files are properly extended, however jslint_happy seems to be ignored by the underlying prettifier lib.

@ryanpcmcquen
Copy link
Author

Sorry, but it isn't. I can run the same code through the beautifier here:

http://jsbeautifier.org/

And function() becomes function ().

Same goes for the atom-beautify plugin which uses js-beautify.

https://atom.io/packages/atom-beautify

@victorporof
Copy link
Owner

Why would some rules get extended and some not?

@victorporof
Copy link
Owner

victorporof commented Jul 21, 2017

Oh, I see what's happening. You need to put your rules inside a "js" or "all" key in a jsbeautifyrc, for example:

"js": {
  "jslint_happy": true
}

@victorporof
Copy link
Owner

I'm reopening this with a different title

@victorporof victorporof reopened this Jul 21, 2017
@victorporof victorporof changed the title .jsbeautifyrc not being read. Top level ungrouped rules in.jsbeautifyrc are ignored Jul 21, 2017
@ryanpcmcquen
Copy link
Author

@victorporof I like the new name. So that would look like this?

{
    "js":
    {
        "jslint_happy": true
    }
}

Correct?

@victorporof
Copy link
Owner

@ryanpcmcquen yes!

@ryanpcmcquen
Copy link
Author

Hmmm ... that still isn't working. Same issue.

@victorporof
Copy link
Owner

victorporof commented Jul 22, 2017

Can you please post all of your (updated) jsbeautifyrc configs and the output in sublime’s console?

@ryanpcmcquen
Copy link
Author

I have only updated the Prettify Preferences - User as shown above, but here is the console output:

https://gist.github.com/ryanpcmcquen/e81baac4a07b4e1b8363273cc0416fa2

As you can see, jslint_happy comes out as false in the computed options.

@victorporof
Copy link
Owner

I cannot reproduce this. I've tried doing what you suggested: creating a .jsbeautifyrc config file in the home folder, with the following contents:

{
    "js":
    {
        "jslint_happy": true
    }
}

The sublime console's output properly shows jslint_happy as being true.

I'm not entirely sure what's going on. Can you please simply post the .jsbeautifyrc files under Attempting to parse file in the above gist?

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

2 participants