Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upDisallow parens around single-line JSX expressions #778
Comments
feross
added
the
enhancement
label
Feb 8, 2017
feross
modified the milestones:
standard v9,
standard v10
Feb 8, 2017
feross
changed the title
Make no-extra-parens rule stricter
Disallow parens around single-line JSX expressions
Mar 1, 2017
This comment has been minimized.
This comment has been minimized.
|
I attempted to set this rule to: "no-extra-parens": ["error", "all", {
"conditionalAssign": false,
"returnAssign": false,
"nestedBinaryExpressions": false,
"ignoreJSX": "multi-line"
}],but I ran into some issues. We really just want to add the JSX enforcement and no other new restrictions. Unfortunately, to get the JSX enforcement, we need to change the first parameter from obj.set(x, y, (z ? 25 : undefined))And this is just too restrictive, IMO. I'll open an issue on ESLint about adding additional options so we can just enforce no extra parens around functions and single-line JSX statements. |
This comment has been minimized.
This comment has been minimized.
|
ESLint issue: eslint/eslint#8174 |
feross
modified the milestones:
standard v11,
standard v10
Mar 2, 2017
feross
added
the
blocked
label
Mar 2, 2017
feross
modified the milestones:
standard v12,
standard v13
Aug 28, 2018
feross
modified the milestones:
standard v13,
standard v14
Jul 5, 2019
This comment has been minimized.
This comment has been minimized.
|
The issue didn't reach consensus with the ESLint team (back in Jan 2018) so we can't fix this. If someone feels strongly about this, I'd love it if you could please open a new issue with the ESLint team and reference the original one I opened (eslint/eslint#8174). It is possible that the new attempt will reach consensus with the team. If you open a new issue, lmk and I will re-open this issue. |
feross commentedFeb 8, 2017
This rule restricts the use of parentheses to only where they are necessary.
Currently, this rule is set to:
I would like to investigate enabling a few more of the restrictions. Specifically, requiring the following seems desirable:
http://eslint.org/docs/rules/no-extra-parens