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
Incorrect indenting of ternary with multi-line function calls with offsetTernaryExpressions: true #14058
Comments
to avoid this regression in eslint 7.19.0: eslint/eslint#14058
/cc @sheerun - |
Agreed this looks like a regression. I still have the release issue open, so while this isn’t a show-stopper that absolutely requires a patch release, if there’s a fix available tomorrow, we could release it as 7.19.1. The other option is reverting the PR that caused it and re-attempting the fix in the release two weeks from now. |
I would say that this issue is more than a regression. I have now added multiple general cases to the description. I would say that reverting e1da90f (PR #13972) would lead to multiple cases of unbalanced ternary formatting: // issue #13971:
{
code: unIndent`
condition1
? condition2
? Promise.resolve(1)
: Promise.resolve(2)
: condition2
? Promise.resolve(2)
: Promise.resolve(3)
`,
options: [2, { offsetTernaryExpressions: true }]
},
// from Part 1a in the description:
{
code: unIndent`
condition1
? reduce({
first,
second,
})
: reduce({
third,
fourth,
})
`,
options: [2, { offsetTernaryExpressions: true }]
},
// from Part 2 in the description:
{
code: unIndent`
condition1
? pipe(
first,
second,
)
: pipe(
third,
fourth,
)
`,
options: [2, { offsetTernaryExpressions: true }]
}, I would personally favor taking some more time to understand what is going on and how we can resolve the root causes before simply reverting e1da90f (PR #13972). |
So... No updates? After upgrading I got 300+ errors about indent, so I downgraded after saw this issue. And seems like I still cannot upgrade if I don't want to run fixes back and forth |
Oops! It looks like we lost track of this issue. @eslint/eslint-tsc what do we want to do here? This issue will auto-close in 7 days without an update. |
This change is causing us some few failures across three external projects we test on, which we now will have to create PR:s for before rolling out the latest ESLint in StandardJS, see: standard/standard#1702 |
This is also an issue for us. |
Woo, this issue has birthday soon. With major version release inbetween, still nothing? |
This problem still exists in v8.21.0. |
Still exists in v8.28.0 |
This still is not working for me either. |
Quick summary update on this issue:
Anyone wants to submit a PR to fix this? |
Still no updates on this? Over 2 years old with solid test cases and a major version release in the meantime? I think the priority and impact are lower than they should be, this issue prevents eslint from behaving how it should according to the docs. Its broken. |
@matt-jolt if you'd like to submit a PR, please do. The team has a lot of higher priorities to deal with, and as such, issues like this tend to sit for a while. There's just not enough time to tackle every issue. |
Hi folks, I just wanted to let everyone know that the ESLint team has decided to deprecate all formatting rules, including indent, and recommend people use source code formatters like Prettier or dprint instead. As a result, we are closing all outstanding issues related to these rules. For more information, please see #17522. Thanks. |
updated:
Part 1a: Regression
Tell us about your environment
v7.19.0
v14.15.4
6.14.10
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?default
Please show your full configuration:
Here is my
.eslintrc.yml
configuration from https://github.com/brodybits/react-native-module-init, but with Prettier plugin items removed I think they are not important for this issue:Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
I am raising this with a redaction of the affected source code from https://github.com/brodybits/react-native-module-init, which is not formatted right by eslint
v7.19.0
as I said in brodybits/react-native-module-init#90 (comment).Here is the redaction of the affected source code that I have made in
await-prompt1.js
:What did you expect to happen?
Accepts the formatting as-is, like eslint
7.18.0
What actually happened? Please include the actual, raw output from ESLint.
When I try
npx eslint await-prompt1.js --fix
, it changes the code like this:Are you willing to submit a pull request to fix this bug?
Yes (best effort)
This is regression is blocking standard/standard#1624, which could have otherwise been resolved by the recent eslint
7.19.0
update.I think this regression is caused by my contribution in #13972, which I should have tested on https://github.com/brodybits/react-native-module-init before submitting it for review.
Part 1b: General case - object reducer function
I have reproduced a more general manifestation of the issue with an object reducer function in
tests/lib/rules/indent.js
:If I would revert the
lib
update in e1da90f (PR #13972), then this would be the expected indentation now unbalanced:Part 2: General case - pipe function
I have reproduced another more general manifestation with a pipe function in
tests/lib/rules/indent.js
:This seems to be inconsistent with the expected formatting documented in: https://eslint.org/docs/rules/indent#offsetternaryexpressions
If I would revert the change to
lib
in e1da90f (PR #13972), then the expected indenting is shown as follows now unbalanced:which looks similar to closed issue #13425.
The text was updated successfully, but these errors were encountered: