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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Other Style Guides
1. [Accessors](#accessors)
1. [Events](#events)
1. [jQuery](#jquery)
1. [Line length](#line-length)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of adding new section, perhaps you can add your new rule to the Whitespace section

Copy link
Author

Choose a reason for hiding this comment

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

Hmm do you think that this should really be in the Whitespace section?

1. [ECMAScript 5 Compatibility](#ecmascript-5-compatibility)
1. [ECMAScript 6 Styles](#ecmascript-6-styles)
1. [Testing](#testing)
Expand Down Expand Up @@ -1986,16 +1987,35 @@ Other Style Guides

**[⬆ back to top](#table-of-contents)**

## Line length

- [26.1](#26.1) <a name='26.1'></a> Avoid very long lines of code longer than 100 characters.

> Why? This ensures readability and maintainability.

```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

Copy link
Collaborator

Choose a reason for hiding this comment

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

re ordering these is :( because it will break existing links into the styleguide

Copy link
Author

Choose a reason for hiding this comment

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

Hmm so the solution is? Append the new entry to the bottom of the document?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are existing links into the styleguide using numbered sections instead of named ones?

That seems like something we should fix regardless.

Copy link
Contributor

Choose a reason for hiding this comment

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

I support this idea. We already have named links for ES6 styles.

Copy link
Member

Choose a reason for hiding this comment

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

Named sections++

from the C++ Core Guidelines:

A rule reference number - e.g., C.7 (the 7th rule related to classes). Since the major sections are not inherently ordered, we use a letter as the first part of a rule reference "number". We leave gaps in the numbering to minimize "disruption" when we add or remove rules.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll add named sections to my doc generator in #480


// good
var foo = {
bar: "This is a bar.",
baz: {
qux: "This is a qux"
},
difficult: "to read"
};
```

## ECMAScript 5 Compatibility

- [26.1](#26.1) <a name='26.1'></a> Refer to [Kangax](https://twitter.com/kangax/)'s ES5 [compatibility table](http://kangax.github.com/es5-compat-table/).
- [27.1](#27.1) <a name='26.1'></a> Refer to [Kangax](https://twitter.com/kangax/)'s ES5 [compatibility table](http://kangax.github.com/es5-compat-table/).

**[⬆ back to top](#table-of-contents)**

## ECMAScript 6 Styles

- [27.1](#27.1) <a name='27.1'></a> This is a collection of links to the various es6 features.
- [28.1](#28.1) <a name='27.1'></a> This is a collection of links to the various es6 features.

1. [Arrow Functions](#arrow-functions)
1. [Classes](#constructors)
Expand All @@ -2015,7 +2035,7 @@ Other Style Guides

## Testing

- [28.1](#28.1) <a name='28.1'></a> **Yup.**
- [29.1](#29.1) <a name='28.1'></a> **Yup.**

```javascript
function() {
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-airbnb/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

'no-caller': 2, // http://eslint.org/docs/rules/no-caller
'no-else-return': 2, // http://eslint.org/docs/rules/no-else-return
'no-eq-null': 2, // http://eslint.org/docs/rules/no-eq-null
Expand Down