prefer-ternary: option to ignore when multiple lines
See original GitHub issueThere should be an option for the rule prefer-ternary to ignore when there are multiple lines. I just updated my config, and it reported me that this was wrong:
if (process.platform === 'win32') {
await exec(oneLine`
A long line,
which is on multiple lines
etc etc
`, { cwd: paths.project });
} else {
await exec(oneLine`
Same, but
not on windows,
etcetc
`, { cwd: paths.project });
}
I think ternary expressions are really great for short lines, like in the examples on the docs, but for long lines like this, it should be skipped.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Use coalesce expression (IDE0029 and IDE0030) - .NET
Set the value of the associated option to specify whether null-coalescing expressions or ternary operator checking is preferred. The rule ...
Read more >Grep ignore multiple lines - Stack Overflow
Is there a way with Grep to use the -v switch to ignore a line and the next number of lines ...
Read more >eslint-plugin-unicorn/readme.md - UNPKG
2. 3, <img src="https://cloud.githubusercontent.com/assets/170270/18659176/1cc373d0-7f33-11e6-890f-0ba35362ee7e.jpg" width="180" align="right">.
Read more >eslint-plugin-unicorn - npm
Name Description ✓ 🔧 💡
consistent‑destructuring Use destructured variables over properties. ✓ 🔧 💡
custom‑error‑definition Enforce correct Error subclassing. 🔧
empty‑brace‑spaces Enforce no spaces between braces....
Read more >what's the best practice for conditional rendering inside a react ...
A few options at least for conditional stuff: ... I find they're great if you format them on multiple lines with indentation: {isRendered...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it would be more consistent with built-in ESLint rules to use:
always
/only-single-line
(Like https://eslint.org/docs/rules/comma-dangle)Agreed