Closed andrewdeandrade closed 9 years ago
// `response` is a response object that we get from server
// This should be allowed since it shows the developer's intention clearly
var numPage = (response && response.page) || 1;
// Just by a quick glance, the example below is definitely more "confusing" than the one above
var numPage = response && response.page || 1;
:+1: for "functions" only.
I agree, I think redundant parens can be useful for readability such as @ardok's example.
Feel free to submit a PR to restrict no-extra-parens to functions only in es6 mode.
Why only ES6 and not standard mode also?
lets do it in standard mode too.
When this rule was originally proposed, @raynos suggested that it might lead to reduced readability, but lets give it a shot. It appears that @ardok might have a reasonable example of code that should be allowed so maybe this rule should be relaxed to only applying to functions,
e.g. [2, "functions"]
in the rc file.https://github.com/eslint/eslint/blob/master/docs/rules/no-extra-parens.md