Allow JSDoc make arrow parens needed
See original GitHub issueWhat rule do you want to change?
arrow-parens: "as-needed"
Does this change cause the rule to produce more or fewer warnings?
Fewer
How will the change be implemented? (New option, new default behavior, etc.)?
Prefer new option, make default should be fine too.
Please provide some example code that this change will affect:
/*eslint arrow-parens: ["error", "as-needed"]*/
const f = (/** @type {number} */a) => a + a;
f(42);
What does the rule currently do for this code?
3:33 - Unexpected parentheses around single function argument.
What will the rule do after it’s changed?
No error.
Are you willing to submit a pull request to implement this change?
Not.
My IDE seems do not know type of variable a
in (/** @type {number} */a) => a
if the braces are omitted. I want to make JSDoc a exception of validating arrow-parens: "as-needed"
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:19 (18 by maintainers)
Top Results From Across the Web
arrow-parens - ESLint - Pluggable JavaScript Linter
Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must be wrapped in parentheses.
Read more >"no definition found" for arrow-function parameters using ...
VS Code seems to ignore JSDoc parameter type definitions for ES6 arrow functions: /** @param {MyClass} myParam */ // VS Code ignores this??...
Read more >Use JSDoc: @param
If a parameter is destructured without an explicit name, you can give the object an appropriate one and document its properties.
Read more >JSDoc inline types: Problem with ES 2015 arrow functions ...
JSDoc inline types: Problem with ES 2015 arrow functions with one parameter and no parenthesis syntax. Relates to 1. Relates to 1 issue...
Read more >TSLint core rules - Palantir Open Source
no-var-requires - Disallows the use of require statements except in import statements. only-arrow-functions - Disallows traditional (non-arrow) function ...
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 Free
Top 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
It looks like a bug to me. Autofix should not remove comments accidentally.
Most likely not, feel free to work on this!