Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

New rule: object-property-newline #524

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

New rule: object-property-newline #524

feross opened this issue May 17, 2016 · 4 comments

Comments

@feross
Copy link
Member

feross 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
Copy link
Member Author

feross commented Jul 13, 2016

This rule will be included in standard v8

@KidkArolis
Copy link

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
Copy link
Member Author

feross 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
Copy link

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
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
Archived in project
Development

No branches or pull requests

2 participants