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.

[arrow-parens] Add a "when-brace" option

See original GitHub issue

Our team would like to adopt the AirBnb best practice for arrow functions parens but it appears the current options of this rule doesn’t fit it. Since we want to rely on automated coding style rules only and found out it would be useful for others too, here is the PR that fulfill it.

See https://github.com/airbnb/javascript#arrows--one-arg-parens Discussion: https://github.com/SimpliField/eslint-config-simplifield/issues/14

  • The version of ESLint you are using

2.11.1 https://github.com/SimpliField/eslint-config-simplifield/blob/master/package.json#L20

  • The rule you want to change

‘arrow-parens’

  • The code you want to be flagged as incorrect
a => { a } // (1)
(a) => a // (2)
  • What happens when the rule is applied to the code without your change

with ‘as-needed’ (1) is valid

with ‘always’ (2) is valid

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
kaicataldocommented, Jul 18, 2016

I can champion this!

1reaction
kaicataldocommented, Jul 20, 2016

Thanks! Have we decided that requireForBlockBody is the config option name we want? Sounds good to me, just want to make sure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

arrow-parens - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Add formatting option to force parentheses around parameters ...
Hello, it would be nice if there were a option which forces parentheses around the parameters of an arrow function. Here's an exmaple...
Read more >
arrow-parens - Rule
Rule: arrow-parens. Requires parentheses around the parameters of arrow function definitions. Rationale. Maintains stylistic consistency with other arrow ...
Read more >
Prettier 1.9: JSX Fragments, EditorConfig and Arrow Parens
This release adds an option for arrow function parens in arguments, support for the new JSX fragment syntax ( <> ), support for ......
Read more >
Arrow Parens - Unibeautify
Require parenthesis in arrow function arguments. Configuration option for beautifiers Prettier, ESLint, TSLint and languages JSX, JavaScript, TypeScript.
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