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

Rule Proposal: func-param-newline #8452

Closed
soda0289 opened this issue Apr 12, 2017 · 2 comments
Closed

Rule Proposal: func-param-newline #8452

soda0289 opened this issue Apr 12, 2017 · 2 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules

Comments

@soda0289
Copy link
Member

This rule was originally proposed by @jesstelford here: #6074 (comment) I looked through previous issues and did not see any other similar proposals.

Please describe what the rule should do:
This rule would enforce that function parameters or argument each appear on a new line, either always or when separated on multiple lines.

What category of rule is this? (place an "X" next to just one item)

[X] Enforces code style
[ ] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:
When set to always-multiline

testA('foo', {
  bar: 2,
  baz: 3
}, {error: 'Invalid'});

function testB(foo, bar
baz) { };

testC(
  'string1', 'string2',
  1, 2
);

When set to always

testA('foo', 'bar', baz);

function testB(foo, bar) {}

testC(
  'string1', 'string2',
  1, 2
);

Why should this rule be included in ESLint (instead of a plugin)?
It is very common to have to break up long function argument list on to multiple lines. Either because of max line length rules or for increased readability. This rule would enforce a consistent style in which this should be done. Code can be hard to read when function arguments are not placed on separate lines and when a function takes in multiple JSON objects it can be hard to tell them apart.

This rule would also complement the code style that our current rules already enforce. Such as object-property-newline and object-curly-newline. As well as another proposed rule function-paren-newline #8102

@soda0289 soda0289 added enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules labels Apr 12, 2017
@soda0289
Copy link
Member Author

Is this case covered by #8102?

@soda0289
Copy link
Member Author

I think is cover. I thought it only handled parenthesis but it covers everything inside of them. Sorry for the noise.

@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 enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

1 participant