Skip to content

function-call-argument-newline complains in some cases when it logically shouldn't. #12123

Closed
@Ferroin

Description

@Ferroin

Tell us about your environment

  • ESLint Version: 6.2.0
  • Node Version: 11.14.0
  • npm Version: 6.7.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

This config is the minimum together with the example code below to reproduce the issue.

Configuration
{
    "extends": "eslint:recommended",
    "env": {
        "browser": true
    },
    "rules": {
        "function-call-argument-newline": [
            "error",
            "consistent"
        ]
    }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

This is a minimal reproducer that I've created based on my own experimentation, not the original code that caused the issue:

document.body.addEventListener('scroll', function() {
    // do something
})

document.body.addEventListener('scroll', function() {
    // do something
}, {
    passive: true,
})

document.body.addEventListener('scroll', function() {
    // do something
}, {passive: true})
npx eslint test.js

What did you expect to happen?

In consistent mode, none of the three calls to document.body.addEventListener() above should trigger an error (the use of newlines between arguments is consistent in all three cases).

What actually happened? Please include the actual, raw output from ESLint.


/mnt/sync/eslint-test/test.js
   7:3  error  There should be no line break here  function-call-argument-newline
  13:3  error  There should be no line break here  function-call-argument-newline

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

Are you willing to submit a pull request to fix this bug?

I don't have enough background with Node.js to be comfortable submitting a PR, but I will be more than happy to help test any that does get submitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyruleRelates to ESLint's core rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions