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

Add spaces-in-square-brackets rule [$15] #2226

Closed
JedWatson opened this issue Apr 3, 2015 · 14 comments

Comments

Projects
None yet
7 participants
@JedWatson
Copy link

commented Apr 3, 2015

As discussed in #1576, replacing space-in-brackets with individual space-in-square-brackets and space-in-curly-braces rules makes sense, adds flexibility and will reduce confusion going forward.

This issue is for tracking the addition of the space-in-square-brackets rule (which may need a better name, e.g. space-in-array-notation) and discussing the options it will support (e.g. ignoring nested objects, arrays, etc) as per the original space-in-brackets rule.

@nzakas once I've got feedback and direction from you on how you'd like this done, I'm happy to work on a PR implementing it.

Did you help close this issue? Go claim the $15 bounty on Bountysource.

@lo1tuma

This comment has been minimized.

Copy link
Member

commented Apr 3, 2015

Do we also want to distinguish between spaces in array literals and spaces in bracket notation (e.g. a[0])?

@nzakas

This comment has been minimized.

Copy link
Member

commented Apr 3, 2015

That's a good point. Maybe we should further split this out into space-in-array and space-in-computed-property?

@nzakas

This comment has been minimized.

Copy link
Member

commented Apr 3, 2015

Better: array-literal-spacing and computed-property-spacing?

@btmills

This comment has been minimized.

Copy link
Member

commented Apr 3, 2015

👍 to *-spacing names; that pattern is more consistent with other rules (e.g. comma-spacing, key-spacing, and others).

Would computed-property-spacing apply to a[b] as well as ({ [a]: b }), or are computed property keys a third case?

Since this only entails adding new rules, I don't think it's breaking. The breaking change would be removing the deprecated rule these replace as part of #1898, wouldn't it?

@nzakas

This comment has been minimized.

Copy link
Member

commented Apr 3, 2015

Yes, I'd say the computed-property-spacing should apply in both cases.

The breaking part is that this rule replaces an existing one.

@ilyavolodin ilyavolodin changed the title Add spaces-in-square-brackets rule Add spaces-in-square-brackets rule [$15] Apr 22, 2015

@ilyavolodin ilyavolodin added the bounty label Apr 22, 2015

@nzakas nzakas added this to the v1.0.0 milestone May 1, 2015

@xjamundx

This comment has been minimized.

Copy link
Contributor

commented Jun 1, 2015

I'll take this on sometime this week.

@nzakas

This comment has been minimized.

Copy link
Member

commented Jun 2, 2015

Thanks! Just to be clear: there are two rules to close this issue.

@nzakas

This comment has been minimized.

Copy link
Member

commented Jun 5, 2015

Rule names should be array-bracket-spacing and computed-property-spacing

@RReverser

This comment has been minimized.

Copy link

commented Jun 11, 2015

I'm having currently conflicts between space-in-brackets: [2, "never"] and object-curly-spacing: [2, "always"] rules. Is it part of this issue and thus will be auto-fixed (i.e. space-in-brackets will be deprecated in favor of separate rules or smth.) or should I submit another one?

@xjamundx

This comment has been minimized.

Copy link
Contributor

commented Jun 11, 2015

Yes space-in-brackets will be deprecated. I'm starting working on array-bracket-spacing today!

xjamundx pushed a commit to xjamundx/eslint that referenced this issue Jun 11, 2015

@xjamundx

This comment has been minimized.

Copy link
Contributor

commented Jun 11, 2015

Similarly to curly-braces-spacing do we automatically apply the whitespace rules for array-bracket-spacing to destructuring syntax such as var [a,b] = x

xjamundx pushed a commit to xjamundx/eslint that referenced this issue Jun 11, 2015

@RReverser

This comment has been minimized.

Copy link

commented Jun 11, 2015

Thanks!

Similarly to curly-braces-spacing do we automatically apply the whitespace rules for array-bracket-spacing to destructuring syntax such as var [a,b] = x

Yes, it would feel pretty logical.

xjamundx pushed a commit to xjamundx/eslint that referenced this issue Jun 11, 2015

@nzakas

This comment has been minimized.

Copy link
Member

commented Jun 11, 2015

Yes, definitely apply to array destructuring

ilyavolodin added a commit that referenced this issue Jun 11, 2015

Merge pull request #2727 from xjamundx/computed-prop-spacing
New: computed-property-spacing (part of #2226)

ilyavolodin added a commit that referenced this issue Jun 17, 2015

Merge pull request #2753 from xjamundx/array-brack
New: array-bracket-spacing (fixes #2226)
@nzakas

This comment has been minimized.

Copy link
Member

commented Sep 26, 2015

@xjamundx there was a bounty on this issue that you can claim

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.