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

(question) eslint rule / plugin for guideline 7.15 #1731

Open
shelbyspeegle opened this issue Feb 13, 2018 · 6 comments
Open

(question) eslint rule / plugin for guideline 7.15 #1731

shelbyspeegle opened this issue Feb 13, 2018 · 6 comments

Comments

@shelbyspeegle
Copy link

@shelbyspeegle shelbyspeegle commented Feb 13, 2018

is there an eslint rule or plugin that enforces 7.15?

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Feb 18, 2018

Indeed! comma-dangle handles the trailing comma, and function-paren-newline, i believe, handles the rest.

comma-dangle should be linked here already; however, I'm still not 100% sure about function-paren-newline :-)

@shelbyspeegle
Copy link
Author

@shelbyspeegle shelbyspeegle commented Feb 22, 2018

awesome! thanks @ljharb.

i can't seem to find the right options for function-paren-newline that adheres to the airbnb eslint guideline 7.15.

in particular, i can't get eslint to bug me about the 'bad' example below.

// bad
console.log(foo,
  bar,
  baz);

// good
console.log(
  foo,
  bar,
  baz,
);
@ljharb
Copy link
Collaborator

@ljharb ljharb commented Feb 22, 2018

Maybe we need to file something upstream on eslint about it?

@raunofreiberg
Copy link
Contributor

@raunofreiberg raunofreiberg commented Mar 5, 2018

@shelbyspeegle I tried both rules out and I'm getting both errors, the bad example included.

"comma-dangle": "error",
"function-paren-newline": "error"

What have you tried so far?

@shelbyspeegle
Copy link
Author

@shelbyspeegle shelbyspeegle commented Mar 6, 2018

thanks @raunofreiberg, that gets me close, unfortunately it allows these scenarios:

// bad?
console.log(
  foo,
  bar, baz,
  yo,
);

// bad?
console.log(
  foo, bar, baz,
  yo,
);

i assumed that this should produce an eslint error, but an example isnt provided for this type of case.

i did see this in the guide language that could suggest that this should error.

with each item on a line by itself

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Mar 7, 2018

Yes, that should be an error. Either the entire invocation fits on one line, or each argument is on a line by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.