Consider setting no-nested-ternary to warn or error. ESLint docs.
Would prevent stuff like this, which I find hard to read.
const test = sub ? ( sub.length ? 'test' : 'test2' ) : 'test3';
Here's some code searches. Codesearch 1.Codesearch 2. I excluded the folders modules, resources, lib, and dist, and files containing the word ".min.js". External code is much more likely to have nested ternaries due to minification or different code standards.
Would be good to keep it out of our codebase. I had several of these in Twinkle that I rewrote.
I think that's too subjective. Some may find a single line double ternary easier to read. I don't know if we need to be opinionated about it at such a high level.
Consider setting
no-nested-ternary
to warn or error. ESLint docs.Would prevent stuff like this, which I find hard to read.
const test = sub ? ( sub.length ? 'test' : 'test2' ) : 'test3';
Here's some code searches. Codesearch 1. Codesearch 2. I excluded the folders modules, resources, lib, and dist, and files containing the word ".min.js". External code is much more likely to have nested ternaries due to minification or different code standards.
Would be good to keep it out of our codebase. I had several of these in Twinkle that I rewrote.