Skip to content

multiline-ternary doesn't check parentheses #13195

@mdjermanovic

Description

@mdjermanovic

Tell us about your environment

  • ESLint Version: v7.0.0-alpha.3
  • 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", "always"] */

(a
) ? b
  : c;
eslint index.js

What did you expect to happen?

It might be expected that parentheses should be treated as a part of the node, so in this case the rule should report that there's a missing newline between test and consequent.

Some rules work that way (e.g., array-element-newline), some don't (function-call-argument-newline), so I'm not sure if this is a bug.

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?

yes

The example was with "always", but the same issue exists with "always-multiline" and "never".

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyruleRelates to ESLint's core rules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions