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

object-curly-spacing #21

Closed
wants to merge 1 commit into from
Closed

Conversation

eddiemoore
Copy link

Require a space at the start and end of objects.
Valid:

var obj = {};
var obj = { 'foo': 'bar' };
var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
var obj = {
  'foo': 'bar'
};
var { x } = y;
import { foo } from 'bar';

Invalid

var obj = {'foo': 'bar'};
var obj = {'foo': 'bar' };
var obj = { baz: {'foo': 'qux'}, bar};
var obj = {baz: { 'foo': 'qux' }, bar};
var obj = {'foo': 'bar'
};
var obj = {
  'foo':'bar'};
var {x} = y;
import {foo } from 'bar';

Require a space at the start and end of objects.
Valid:
```js
var obj = {};
var obj = { 'foo': 'bar' };
var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
var obj = {
  'foo': 'bar'
};
var { x } = y;
import { foo } from 'bar';
```

Invalid
```js
var obj = {'foo': 'bar'};
var obj = {'foo': 'bar' };
var obj = { baz: {'foo': 'qux'}, bar};
var obj = {baz: { 'foo': 'qux' }, bar};
var obj = {'foo': 'bar'
};
var obj = {
  'foo':'bar'};
var {x} = y;
import {foo } from 'bar';
```
@julien-f
Copy link

What about arrays?
Shouldn't it have the same behavior?

@julien-f
Copy link

And this is a major change, standard would be bumped to v6.

@dcousens
Copy link
Member

AFAIK this is already meant to be enforced, if this isn't the case, it's a bug IIRC.

@dcousens dcousens added the bug label Jan 22, 2016
@dcousens
Copy link
Member

Reference standard/standard#182, this is out lined as what we expected.

@feross looks good to me? Merge?

@eddiemoore
Copy link
Author

I know there is the even spacing rule at the moment, however it can mean that you aren't consistent across all objects in all files.

var x = { y: 42 }
var z = {p: 24}

This for example, would be valid at the moment. I just feel that it should be consistent spacing across everything.

@dcousens dcousens removed the bug label Jan 22, 2016
@dcousens
Copy link
Member

Ah, that is the key point of difference.

@feross
Copy link
Member

feross commented Feb 5, 2016

Yeah, this is a big breaking change. We investigated how easy it would be to make things consistent across a single file, but it wasn't easy.

In the future, I'm hoping we can just pick var x = { y: 42 } as the correct style, but we need to think about the implications of breakage.

@feross feross closed this Feb 5, 2016
@dcousens
Copy link
Member

dcousens commented Feb 5, 2016

@feross where were those stats again?
Any chance we can see where they sit now for a rule change such as this?

@feross
Copy link
Member

feross commented Feb 5, 2016

I ran it a while ago. I can re-run, but I know it's going to be too high (double digit percentages) to get into standard v6. I think we should punt until v7, or this release is going to get too huge.

@mightyiam
Copy link
Member

Continue conversation @ Object curlies: File/project–wide or standard?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants