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

Chore: enable object-curly-newline & object-property-newline.(fixes #9042) #9068

Merged
merged 2 commits into from Aug 5, 2017

Conversation

aladdin-add
Copy link
Member

@aladdin-add aladdin-add commented Aug 4, 2017

What is the purpose of this pull request? (put an "X" next to item)

[x] Other, please explain:

What changes did you make? (Give an overview)
enalbe object-curly-newline.(fixes #9042)

Is there anything you'd like reviewers to focus on?

Personally I see the fixed code looks a little strange:

context.report({
  node, message, data: {
    name: node.name
  }
});

any thoughts?

@eslintbot
Copy link

LGTM

@not-an-aardvark
Copy link
Member

Personally I see the fixed code looks a little strange:

context.report({
 node, message, data: {
   name: node.name
 }
});

any thoughts?

Personally, I prefer putting everything on a new line in that case:

context.report({
  node,
  message,
  data: { name: node.name }
});

@aladdin-add
Copy link
Member Author

agree. is there a rule or option to enforce this? I thought consistent: true would fix it to something like you mentioned. @not-an-aardvark

@not-an-aardvark
Copy link
Member

I think object-property-newline enforces that.

@aladdin-add
Copy link
Member Author

aladdin-add commented Aug 4, 2017

what if I want to allow (all in one line):

var foo = { key1: 1, key2: 2, key3: 3 };

and per property per line:

var foo = {
  key1: 1,
  key2: 2,
  key3: 3,
};

just report inconsistent properties like this:

var foo = {
  key1: 1, key2: 2,
  key3: 3
};

this is exactly we are using.

@eslintbot
Copy link

LGTM

2 similar comments
@eslintbot
Copy link

LGTM

@eslintbot
Copy link

LGTM

@not-an-aardvark not-an-aardvark changed the title Chore: enalbe object-curly-newline.(fixes #9042) Chore: enable object-curly-newline.(fixes #9042) Aug 4, 2017
@not-an-aardvark
Copy link
Member

Does the allowMultiplePropertiesPerLine option solve that?

@aladdin-add
Copy link
Member Author

aladdin-add commented Aug 4, 2017

no, it only allow multi-properties per line. and will not report error when being inconsistent. I think this can be an useful enhancement for many users.

oh, sorry, it does. I just missed something.

updated the commits. also enable object-property-newline. and it looks better.

@not-an-aardvark ,thanks for your patience! ❤️

@eslintbot
Copy link

Thanks for the pull request, @aladdin-add! I took a look to make sure it's ready for merging and found some changes are needed:

  • The commit summary must be 72 characters or shorter. Please check out our guide for how to properly format your commit summary and update it on this pull request.

Can you please update the pull request to address these?

(More information can be found in our pull request guide.)

@eslintbot
Copy link

LGTM

@aladdin-add aladdin-add changed the title Chore: enable object-curly-newline.(fixes #9042) Chore: enable object-curly-newline & object-property-newline.(fixes #9042) Aug 4, 2017
@eslintbot
Copy link

LGTM

@not-an-aardvark
Copy link
Member

oh, sorry, it does. I just missed something.

Yeah, the option name is a bit misleading :P

Copy link
Member

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@gyandeeps gyandeeps merged commit de75f9b into eslint:master Aug 5, 2017
@aladdin-add aladdin-add deleted the issue9042 branch August 5, 2017 16:38
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discussion: enable object-curly-newline on eslint codebase.
4 participants