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

Upgrade to eslint v2 #730

Merged
merged 32 commits into from
Feb 21, 2016
Merged

Upgrade to eslint v2 #730

merged 32 commits into from
Feb 21, 2016

Conversation

hshoff
Copy link
Member

@hshoff hshoff commented Feb 12, 2016

To the future we go. Couple more steps to go before publish:

@@ -32,7 +32,7 @@ module.exports = {
// disallow else after a return in an if
'no-else-return': 2,
// disallow use of labels for anything other then loops and switches
'no-empty-label': 2,
'no-labels': [2, { 'allowLoop': true, 'allowSwitch': true }],
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should definitely set both of these to false - we don't allow GOTO in any form, including breaking to a label.

@ljharb
Copy link
Collaborator

ljharb commented Feb 13, 2016

@hshoff at the least, we should include all the new rules with all their options, but set to 0, so we don't miss them later.

@ljharb
Copy link
Collaborator

ljharb commented Feb 13, 2016

no-useless-constructor we should absolutely enable, we were going to make an internal plugin for that anyways. (also template-curly-spacing)

// good
class Rey extends Jedi {
constructor(...args) {
super(...args);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is also "bad" - a constructor that does nothing but passes the args untouched to super is also a violation of the linter rule.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

 - `id-blacklist`
 - `no-extra-label`
 - `no-implicit-globals`
 - `no-restricted-imports`
 - `no-unmodified-loop-condition`
 - `no-unused-labels`
 - `sort-imports`
 - `yield-star-spacing`
'no-empty-label': 2,
// disallow Unnecessary Labels
// http://eslint.org/docs/rules/no-extra-label
'no-extra-label': 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

since we already prevent labels in no-labels, i think this can be set to 2 without any additional justification in the guide (assuming it already says "no labels ever" somewhere)

@hshoff
Copy link
Member Author

hshoff commented Feb 20, 2016

@ljharb @lencioni @kesne ready for review

@ljharb can you handle the publishing when we're ready?

@ljharb
Copy link
Collaborator

ljharb commented Feb 20, 2016

On it - I'm doing some rebasing (also making sure both devDeps and peerDeps are updated in lockstep), I'll force push it up shortly and will publish soon after.

@ljharb ljharb force-pushed the harry-eslint-v2 branch 2 times, most recently from ee15797 to 244bb13 Compare February 20, 2016 22:14
}

return false;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

While I agree with this example, it doesn't seem to pertain to the text of the rule here.

Also, this example could be simplified to:

[1, 2, 3].filter((x) => {
  return x > 2;
});

or even:

[1, 2, 3].filter(x => x > 2);

so I'm not sure it is the best to use here.

Choose a reason for hiding this comment

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

Second one is better in my opinion

@ljharb ljharb force-pushed the harry-eslint-v2 branch 2 times, most recently from 97155ea to 0f32b96 Compare February 21, 2016 08:50
@ljharb ljharb merged commit 0f32b96 into master Feb 21, 2016
ljharb added a commit that referenced this pull request Feb 21, 2016
@ljharb ljharb deleted the harry-eslint-v2 branch February 21, 2016 08:51
@ljharb
Copy link
Collaborator

ljharb commented Feb 21, 2016

v6.0.0 published.

@mxstbr
Copy link

mxstbr commented Feb 21, 2016

👍 Awesome!

// good
class Rey extends Jedi {
constructor(...args) {
super(args);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the args object be spread into the super constructor? I.e. super(...args).

Copy link

Choose a reason for hiding this comment

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

It depends on what your parent takes :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but in this case that would make this class pretty weird. I mean it's a made up example, so it doesn't really matter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed in 8a6f009

ljharb added a commit that referenced this pull request Feb 21, 2016
gilbox pushed a commit to gilbox/javascript that referenced this pull request Mar 21, 2016
jaylaw81 pushed a commit to appirio-digital/ads-best-practices that referenced this pull request Sep 19, 2017
sensiblegame added a commit to sensiblegame/React-BNB that referenced this pull request Oct 23, 2017
passionSeven added a commit to passionSeven/javascript that referenced this pull request Jan 27, 2023
Binary-Ninja-007 added a commit to Binary-Ninja-007/JavaScript_Style_Guide that referenced this pull request Aug 13, 2023
harry908nilson pushed a commit to marcolane/Javascriipt that referenced this pull request Sep 1, 2023
talentdev219 added a commit to talentdev219/javascript that referenced this pull request Sep 17, 2023
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.