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.

Rule to enforce airbnb dangling parameter/argument style

See original GitHub issue

Please describe what the rule should do: Enforce dangling argument and parameter style in functions

What category of rule is this?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

    // bad
    function foo(bar,
                 baz,
                 quux) {
      // body
    }

    // good
    function foo(
      bar,
      baz,
      quux,
    ) {
      // body
    }

    // bad
    console.log(foo,
      bar,
      baz);

    // good
    console.log(
      foo,
      bar,
      baz,
    );

Why should this rule be included in ESLint (instead of a plugin)? It’s a pretty simple style and doesn’t address a specific / esoteric part of JS

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ljharbcommented, Nov 2, 2016

What I mean with “fit on one line” is, simply, is on one line. line length is handled by max-len, and a separate rule or option(s) could handle pushing single-line over multi-line - i just want to enforce that if it’s single-line, it looks one way, and if it’s not single-line, it looks another.

1reaction
graingertcommented, Nov 2, 2016

It would also be great if we could enforce

function foo(bar, baz) { ... }

over

function foo(
  bar,
  baz,
) { ... }

when there’s enough space on the line

Note: covered in https://github.com/eslint/eslint/issues/7526

Read more comments on GitHub >

github_iconTop Results From Across the Web

Airbnb JavaScript Style Guide()
Reassigning parameters can lead to unexpected behavior, especially when accessing the arguments object. It can also cause optimization issues, especially in V8.
Read more >
Why you should enforce Dangling Commas for Multiline ...
Enforce it with Linting​​ Personally, I prefer ESLint for JavaScript. Fortunately ESLint has the comma-dangle rule which allows you to enforce dangling commas ......
Read more >
What rules do the community tend to override? #1089 - GitHub
I'm opening this issue specifically to gather a list of the rules that those in the community feel are controversial or problematic, ...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
Disallow duplicate arguments in `function` definitions. Categories: ✓ Extends ... Enforce consistent brace style for all control statements. Categories:.
Read more >
Using a Code Style Guide to Enforce Team Best Practices
I'd already been using the Airbnb eslint rule-set, so I read Airbnb's style guide and found it to be an excellent jump-off point....
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