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

multiline-ternary "never" allows multiline ternaries #13368

Closed
mdjermanovic opened this issue May 28, 2020 · 2 comments · Fixed by #13452
Closed

multiline-ternary "never" allows multiline ternaries #13368

mdjermanovic opened this issue May 28, 2020 · 2 comments · Fixed by #13452
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules

Comments

@mdjermanovic
Copy link
Member

Tell us about your environment

  • ESLint Version: v7.1.0
  • Node Version: v12.14.0
  • npm Version: v6.13.4

What parser (default, Babel-ESLint, etc.) are you using?

Please show your full configuration:

Configuration
module.exports = {
  parserOptions: {
      ecmaVersion: 2015
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Online Demo

/* eslint multiline-ternary: ["error", "never"] */

a +
    b ? c +
       d : e +
           f;  
eslint index.js

What did you expect to happen?

Given the documentation:

"never" disallows newlines between the operands of a ternary expression (enforcing that the entire ternary expression is on one line).

This should be an error because the entire ternary expression is not on one line?

What actually happened? Please include the actual, raw output from ESLint.

No errors.

Are you willing to submit a pull request to fix this bug?

By #6751 it looks like this option should really enforce that the entire ternary expression is on one line, but it doesn't work like that from the start, so maybe we should just update the docs to reflect the actual behavior?

@mdjermanovic mdjermanovic added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels May 28, 2020
@kaicataldo
Copy link
Member

@mdjermanovic Do you still think this is a bug? Or do you believe it falls under our new policy of not making changes to style rules?

@mdjermanovic
Copy link
Member Author

I'm not sure, but anyway it would be a big change in the behavior of this rule.

I think we should just change the docs to match the actual behavior,

This should be removed:

(enforcing that the entire ternary expression is on one line)

and some correct multiline examples should be added to clarify "never".

@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation and removed bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jun 12, 2020
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 31, 2020
@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 Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants