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
CamelCase option to allow snake_case in object literals #1919
Comments
I'm not sure if ignoring all properties is what you want. For instance you'd also end up ignoring: var person = {
say_name: function(){}
}; This is clearly a case where you would want to flag |
True, but if it's just as likely that someone might use a function to fetch data to submit to an external service that used snake_case properties in their configuration object. var person = fetchPerson({
first_name: function(user) {
return user.firstName;
}); Sure that's a contrived example, but it's not difficult to imagine some logic in there. (though, gah.) Anyway, thanks for considering this. |
Hmmm... Maybe we just need a new option |
This would be great addition to this rule and allow me to get rid of a ton of disable comments |
👍 I also would like that flag. Florent |
Update: rule camelcase to allow snake_case in object literals. (fixes #1919)
Was the nonmethods property dropped ? |
@nzakas any updates on this? I have the code below yet I'm still getting an error.
I'm using @sindresorhus's xo linter.
|
@nzakas any reason a commit was merged but without the "nonmethods" option? |
Is the nonmethods property going to be included? Just has this issue in our code and this property setting would solve this issue. |
There are situations where third-party code or services are configured by calling a function with an object literal. Those objects are flagged the camelCase rule:
JSCS dealt with this by adding an
ignoreProperties
option to their CamelCase rule. I like enforcing names and would rather not disable the CamelCase rule to use code that I don't control without errors.This was touched on in #656, #672, #674 and #1550, but object literals are still being flagged.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: