Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

key-spacing #991

Closed
jamiewinder opened this issue Feb 22, 2016 · 7 comments
Closed

key-spacing #991

jamiewinder opened this issue Feb 22, 2016 · 7 comments
Labels
Formatting rule Relates to a rule which enforces code formatting and likely overlaps with prettier Resolution: Declined Type: Feature Request

Comments

@jamiewinder
Copy link

Unless I'm missing something, there is no way to enforce whitespace after a property key in an object literal:

    const b = {
        a : 1, // bad
        b: 2 // good
    };

I think this is covered in ESLint by key-spacing

@adidahiya
Copy link
Contributor

This would be best as an enhancement to the whitespace rule. We should probably update that rule to mirror how typedef-whitespace works since #971.

@micky2be
Copy link

Looking forward

@johnwiseheart
Copy link
Contributor

This is pretty old, and a strange feature since we already have a rule disallowing trailing whitespace. Going to close, feel free to re-open/make a new issue if you disagree.

@adanski
Copy link

adanski commented Nov 21, 2018

@johnwiseheart, how can the rule requested by @jamiewinder be enforced with currently available rules?

@xemlock
Copy link

xemlock commented Feb 16, 2019

@adanski @jamiewinder Looks like this cannot be done by the built-in rules alone. whitespace.check-type checks only for space after colon, and typedef-whitespace, although more configurable, works only for type definitions.

So I wrote whitespace-before-colon rule which complements those rules, and which checks spaces before colons in object literals and destructuring assignments.

@adidahiya adidahiya added Resolution: Declined Formatting rule Relates to a rule which enforces code formatting and likely overlaps with prettier and removed Status: Accepting PRs labels Feb 18, 2019
@NoBrainer
Copy link

This would be best as an enhancement to the whitespace rule. We should probably update that rule to mirror how typedef-whitespace works since #971.

I'd like to have this feature. @xemlock's solution was declined, but any progress on @adidahiya's proposed solution?

@adidahiya
Copy link
Contributor

@NoBrainer See #4534, at this point basically all formatting-related features/enhancements will be declined.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Formatting rule Relates to a rule which enforces code formatting and likely overlaps with prettier Resolution: Declined Type: Feature Request
Projects
None yet
Development

No branches or pull requests

7 participants