Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Update eslint-config-airbnb-base to version 12.0.0 🚀 #997

Merged
merged 10 commits into from
Sep 6, 2017

Conversation

greenkeeper[bot]
Copy link
Contributor

@greenkeeper greenkeeper bot commented Sep 2, 2017

Version 12.0.0 of eslint-config-airbnb-base just got published.

Dependency eslint-config-airbnb-base
Current Version 11.3.2
Type devDependency

The version 12.0.0 is not covered by your current version range.

Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.

I recommend you look into these changes and try to get onto the latest version of eslint-config-airbnb-base.
Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.


Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

greenkeeper bot and others added 2 commits September 4, 2017 13:47
Also fixes a minor 🐛 in `helpers.js` where the given message wasn't
being used properly.
@Arcanemagus Arcanemagus force-pushed the greenkeeper/eslint-config-airbnb-base-12.0.0 branch from acfc65d to 8618651 Compare September 4, 2017 21:28
Update ESLint to a minimum of v4.6.0 to satisfy the `peerDependencies`
of `eslint-config-airbnb-base`.
@@ -63,9 +64,10 @@ export async function sendJob(worker, config) {
export function showError(givenMessage, givenDetail = null) {
let detail
let message
if (message instanceof Error) {
Copy link
Member

Choose a reason for hiding this comment

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

Note that this was actually a 🐛, it was only checking the newly declared message, not the one passed in.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch

In fixing the earlier bug, a new one had been introduced where it was
attempting to access a `msg` property of the `givenMessage`, which
doesn't exist.
Copy link
Member

@IanVS IanVS left a comment

Choose a reason for hiding this comment

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

I have some concerns about some of these changes, but I won't block a merge over any of it.

src/helpers.js Outdated
detail = message.stack
message = message.message
if (givenMessage instanceof Error) {
({ stack: detail, message } = givenMessage)
Copy link
Member

Choose a reason for hiding this comment

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

Since this syntax is uncommon, it might be worthwhile adding a comment explaining what it's doing and maybe even linking to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assignment_without_declaration.

Copy link
Member

Choose a reason for hiding this comment

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

I'd say the syntax is uncommon only because a lot of people don't know about it, I'll certainly be using it in a lot more places as the only reason I haven't been doing things like that is I didn't know the syntax.

So the question is: Comment it when the end result is obvious, or just start using it everywhere so people see it?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not so sure the end result is exactly obvious, and destructuring can be confusing if you're not used to it, with this form even more so. Up to you though, I don't care very much.

@@ -63,9 +64,10 @@ export async function sendJob(worker, config) {
export function showError(givenMessage, givenDetail = null) {
let detail
let message
if (message instanceof Error) {
Copy link
Member

Choose a reason for hiding this comment

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

Good catch

@@ -61,9 +61,10 @@ describe('Worker Helpers', () => {
})

describe('getESLintInstance && getESLintFromDirectory', () => {
const pathPart = Path.join('testing', 'eslint', 'node_modules')
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to break out a separate variable for this? It adds some indirection and complexity, and I'm not sure I see the benefit.

Copy link
Member

Choose a reason for hiding this comment

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

The lines below where this chunk is used were over the 100 char limit otherwise, and the previous method of breaking it into multiple lines doesn't fit the current style guide. I'm open to alternatives though!

src/worker.js Outdated
response = fixJob({ cliEngineOptions, contents, eslint, filePath })
response = fixJob({
cliEngineOptions, contents, eslint, filePath
})
Copy link
Member

Choose a reason for hiding this comment

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

This (and others like it) is a fairly annoying change, since it breaks a single, understandable line into three lines. What linting rule is requiring it? Do you like having object literals always broken apart like this?

Copy link
Member

@Arcanemagus Arcanemagus Sep 6, 2017

Choose a reason for hiding this comment

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

It's being controlled by object-curly-newline, and I'm not sure I like it.

The current configuration of this rule can be found here. The critical part looking to be the minProperties: 4 bit, which we are just hitting on almost every case.

Should we override that rule here? Setting that to 5 allows almost all of the current object literals to remain as they are.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think I'd be tempted to set it to 5, or just turn minProperties off and only set "consistent": true. I'm not really sure I see the benefit of setting a minProperties at all.

To be clear, I'm proposing:

    'object-curly-newline': ['error', {
      ObjectExpression: { consistent: true },
      ObjectPattern: { consistent: true }
    }],

What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Tried it out, I think I like that, our 4 level uses aren't that bad, and just setting that to 5 allows it to still catch bigger ones.

@Arcanemagus
Copy link
Member

@IanVS did a review of the current ESLint config and changed some things.

@Arcanemagus Arcanemagus changed the title Update eslint-config-airbnb-base to the latest version 🚀 Update eslint-config-airbnb-base to version 12.0.0 🚀 Sep 6, 2017
@IanVS
Copy link
Member

IanVS commented Sep 6, 2017

LGTM

@Arcanemagus Arcanemagus merged commit c49397c into master Sep 6, 2017
@greenkeeper greenkeeper bot deleted the greenkeeper/eslint-config-airbnb-base-12.0.0 branch September 6, 2017 17:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants