question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow JSDoc make arrow parens needed

See original GitHub issue

What 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);

Demo

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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:19 (18 by maintainers)

github_iconTop GitHub Comments

2reactions
mysticateacommented, May 15, 2020

It looks like a bug to me. Autofix should not remove comments accidentally.

1reaction
mdjermanoviccommented, May 16, 2020

Is anyone working on this? if not, I can work on this

Most likely not, feel free to work on this!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found