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

How do I disable function() to function () fix #97

Closed
lfender6445 opened this issue May 2, 2014 · 8 comments
Closed

How do I disable function() to function () fix #97

lfender6445 opened this issue May 2, 2014 · 8 comments

Comments

@lfender6445
Copy link

I love this tool but cant seem to find the JSHint declaration for this -

I'd rather function someFunction() not be changed to function someFunction ()

Thanks

@goatslacker
Copy link
Member

that shouldn't be happening. can you add a failing test case?

@jish
Copy link

jish commented Oct 1, 2014

$ cat foo.js
var Animal = function(name) {
  this.name = name;
}
$
$ fixmyjs foo.js
✓ foo.js done.
$
$ cat foo.js
var Animal = function (name) {
  this.name = name;
};$

@goatslacker
Copy link
Member

That's expected behavior. According to Crockford's original whitespace rules (which JSHINT inherited from) he mentions that there should be a space after function so this tool follows that advice.

function name() should never be changed to function name () but name = function () is valid.

@lfender6445
Copy link
Author

So there is no way to disable?

@goatslacker
Copy link
Member

Change your jshint settings to white: false I believe. From what I know white is an unloved feature, jshint is meant to find bugs not complain about styling so this tool is more about fixing bugs rather than beautifying your JS.

I hope to split the two someday, right now, no there is no way to disable certain parts of the style guide -- it's an all or nothing affair :(

Send a pull request if you have any ideas though.

@ariutta
Copy link

ariutta commented Oct 5, 2014

Is the problem that escodegen adds the spaces? How about using esformatter?

@syrnick
Copy link

syrnick commented Nov 20, 2014

+1 to the issue. I'd love to turn it off.

@goatslacker
Copy link
Member

#110 should solve this issue.

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

5 participants