Skip to content

Conversation

@amsardesai
Copy link
Contributor

This helps make sure variable names are longer than 1 character.

Single letter variable names are almost guaranteed to be completely non descriptive, this makes sure our variable names are longer than that.

Documentation on the id-length rule: http://eslint.org/docs/rules/id-length.html

@justjake
Copy link
Collaborator

please add the id-length documentation URL to your PR as a comment, following the style of the rest of the eslintrc.

@amsardesai
Copy link
Contributor Author

Done!

justjake added a commit that referenced this pull request Sep 16, 2015
Added id-length rule to eslintrc
@justjake justjake merged commit 392a08a into airbnb:master Sep 16, 2015
@amsardesai amsardesai deleted the add-id-length branch September 16, 2015 22:26
@toxicFork
Copy link

@amsardesai What variable do you recommend using for "for loops"?

@amsardesai
Copy link
Contributor Author

@toxicFork I generally try to avoid using for loops if I could use map, forEach, or filter instead. If I have to use for loops, I think just calling the variable name index seems like the best way to do it.

for (var index = 0; index < someLength; index++) {
    ...
}

What do you think?

@macebedo
Copy link

For the "for loop"... I've always use "ctr". These loops involves counter. ctr for short. Simple enough for me.

@gausie
Copy link

gausie commented Oct 13, 2015

What are people's opinions on adding an exception for _, typically used by lodash and underscore?

@tomek-he-him
Copy link

@justjake @hshoff @gausie, I also got bitten by it. There are other valid uses:

@toxicFork
Copy link

Also anything to do with geometry and math, e.g. THREE.Vector3.{x, y, z} and many others. It will remain disabled in all my configs.

@tomek-he-him
Copy link

@toxicFork Yeah, true.

Generally I’m no fan of one-letter variables – but how else can you name x?

@justjake
Copy link
Collaborator

Turns out no one likes this rule. Will turn it back off eventually

@tomek-he-him
Copy link

👍 👍

@gausie
Copy link

gausie commented Oct 22, 2015

Thanks!

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

Successfully merging this pull request may close these issues.

6 participants