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

Added max-len rule #510

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Added max-len rule #510

wants to merge 3 commits into from

Conversation

screendriver
Copy link

Closes #509

@justjake
Copy link
Collaborator

I think according to https://github.com/airbnb/javascript#6.2 our max-length is 100 characters, not 80 characters. Please make the length explicit. I thought that this number was already well-declared and obvious in our styleguide, but I think I was thinking of our Ruby styleguide (length guidance here: https://github.com/airbnb/ruby#line-length).

Sorry to change direction so fast; I think we should wait for more discussion on the topic before merging this.

@screendriver
Copy link
Author

Ok. I am fine with 100 characters as well. Should I modify this pull request or should we wait for others to discuss this whole thing?


```javascript
// bad
var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I don't see a rule in the styleguide about it, in our examples we generally don't quote object keys when they're not invalid identifiers. Can you unquote all of these object keys?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should submit a PR adding this rule :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. And yes: if so then there should be a rule for that 😜

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justjake
Copy link
Collaborator

Go ahead and make it explicitly 100 chars in your markdown update and in the eslintrc. We'll let the PR sit here for a day or two after that and then I'll merge after consensus/people forget

@screendriver
Copy link
Author

Done 😎


```javascript
// bad
var foo = { bar: "This is a bar.", baz: { "qux": "This is a qux" }, difficult: "to read" };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"qux" is unnecessarily quoted

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line should be obviously too long, as it is it's 96 characters, make it like 120+ chars

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I am sorry. This happens when you are in hurry 😕. I will fix that

@screendriver
Copy link
Author

Should I take the description really in the whitespace section? I think it has nothing to do with whitespaces.

@@ -83,6 +83,7 @@ module.exports = {
}],
'eqeqeq': 2, // http://eslint.org/docs/rules/eqeqeq
'guard-for-in': 2, // http://eslint.org/docs/rules/guard-for-in
'max-len': [2, 100, 4] // http://eslint.org/docs/rules/max-len
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma missing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, max-len is already specified in legacy.js

@brianpeiris
Copy link

+1 I would like to see this merged.

@justjake
Copy link
Collaborator

justjake commented Nov 5, 2015

oops

@ljharb
Copy link
Collaborator

ljharb commented Apr 3, 2016

@screendriver if you'd like to rebase this on top of master, we can now add and renumber sections without breaking existing links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No max-len ESLint rule?
7 participants