indent: bug in flatTernaryExpressions: true
See original GitHub issueTell us about your environment Linux Mint 18.3
- ESLint Version: 5.13.0
- Node Version: 8.11.2
- npm Version: 5.6.0
What parser (default, Babel-ESLint, etc.) are you using? Espree
Please show your full configuration:
Configuration
module.exports = {
root: true,
rules: {
'no-undef': 0,
'no-unused-vars': 0,
'operator-linebreak': 0,
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
// test1.js
/* eslint "indent": ["error", 2, {flatTernaryExpressions:true}] */
var a = foo
? bar : baz
? qux : boop
eslint ./test1.js
What did you expect to happen?
no errors.
Note the option flatTernaryExpressions:true
in the config comment.
For this test, I made a simple eslintrc without rules, plugins, etc., but the same thing happens with the typedscript parser and the VS Code ESLint extension.
What actually happened? Please include the actual, raw output from ESLint.
/home/xxxxxx/npm/eslint-config-standardize/test1.js 6:1 error Expected indentation of 4 spaces but found 2 indent
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the --fix
option.
Are you willing to submit a pull request to fix this bug? no.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Thank you for this issue.
Looks like the intentional behavior.
By design,
flatTernaryExpressions:true
option affects only when a condition and that result are on the same line. I.e.The option is to support the style like Conditional Types.
It looks like the conversation is stalled here. As this is a question rather than an action item, I’m closing the issue. If you still need help, please send a message to our mailing list or chatroom. Thanks! [//]: # (auto-close)