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

indent - option to ignore ternary expressions #8725

Closed
mjomble opened this issue Jun 13, 2017 · 4 comments
Closed

indent - option to ignore ternary expressions #8725

mjomble opened this issue Jun 13, 2017 · 4 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

@mjomble
Copy link
Contributor

mjomble commented Jun 13, 2017

The indent rule supports ignoring many expression types using an off option, such as MemberExpression, FunctionDeclaration, CallExpression, etc.

It would be helpful if it could be similarly configured to ignore ternary expressions.
For example, I prefer a style for multi-line ternaries that is currently considered invalid by the indent rule:

const value = (
  condition ?
  valueIfTrue :
  valueIfFalse
)

I tried the flatTernaryExpressions setting, but the indentation was still reported as incorrect.

Speaking of which, the flatTernaryExpressions setting seems quite out of place compared to the format of the other settings. Perhaps it could be replaced with one named ConditionalExpression (to match the name of the AST node) with options off, flat, etc?

Info on my environment:

  • ESLint Version: 4.0.0
  • Node Version: 6.9.1
  • npm Version: yarn 0.24.6
  • Parser: babel-eslint
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 13, 2017
@Pyrolistical
Copy link

Is this a dupe of #8712 ?

@not-an-aardvark
Copy link
Member

Is this a dupe of #8712 ?

Not quite. However, I think it will be redundant after #8594 is implemented.

@not-an-aardvark not-an-aardvark 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 and removed triage An ESLint team member will look at this issue soon labels Jun 14, 2017
@mjomble
Copy link
Contributor Author

mjomble commented Jun 14, 2017

It does look like #8594 would take care of it. Shall I close this issue?

@not-an-aardvark
Copy link
Member

Yes, I think I'll close it, since it would be better if we didn't add redundant options.

@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

4 participants