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

New rule: object-property-newline #524

Closed
feross opened this Issue May 17, 2016 · 4 comments

Comments

2 participants
@feross
Copy link
Member

commented May 17, 2016

Enforce placing object properties on separate lines.

eslint rule: https://github.com/eslint/eslint/blob/master/docs/rules/object-property-newline.md

    "object-property-newline": [2, { "allowMultiplePropertiesPerLine": true }]

OK:

var obj = { foo: 'foo', bar: 'bar', baz: 'baz' }

var obj2 = {
    foo: 'foo', bar: 'bar', baz: 'baz'
}

Not OK:

var obj = { foo: 'foo',
  bar: 'bar', baz: 'baz'
}

var obj = {
  foo: 'foo', bar: 'bar',
  baz: 'baz'
}

Ecosystem breakage:

# tests 427
# pass  419
# fail  8
@feross

This comment has been minimized.

Copy link
Member Author

commented Jul 13, 2016

This rule will be included in standard v8

@KidkArolis

This comment has been minimized.

Copy link

commented Sep 3, 2016

Hm, this means I can no longer use a "dsl" like this :(

module.exports = [
  { name: 'application', path: '/', component: Application, abstract: true, children: [
    { name: 'home', path: '', component: Home },
    { name: 'messages', async: Messages },
    { name: 'status', path: ':user/status/:id' },
    { name: 'profile', path: ':user', component: Profile, abstract: true, children: [
      { name: 'profile.index', path: '', component: ProfileIndex },
      { name: 'profile.lists' },
      { name: 'profile.edit' }
    ]}
  ]}
]
@feross

This comment has been minimized.

Copy link
Member Author

commented Sep 10, 2016

@KidkArolis Sorry this makes life a bit more difficult for you. You can selectively disable this rule in files where you're defining DSLs by adding a comment to the top of the file:

/* eslint-disable object-property-newline */
@KidkArolis

This comment has been minimized.

Copy link

commented Sep 10, 2016

Yeah, no worries, <3 standard, found a couple workarounds.
On Sat, 10 Sep 2016 at 20:44, Feross Aboukhadijeh notifications@github.com
wrote:

@KidkArolis https://github.com/KidkArolis Sorry this makes life a bit
more difficult for you. You can selectively disable this rule in files
where you're defining DSLs by adding a comment to the top of the file:

/* eslint-disable object-property-newline */


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#524 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATzWG5AAh_zSqv7hbvhjpa008wT0utEks5qowiYgaJpZM4If1Y0
.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 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.