Skip to content

[array-bracket-newline] doesn't handle inline comments properly #12416

@fabiospampinato

Description

@fabiospampinato

Tell us about your environment

  • ESLint Version: 6.5.1
  • Node Version: 10.15.0
  • npm Version: 6.4.1

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

@typescript-eslint/parser

Please show your full configuration:

Here it is, just uncomment the "array-bracket-newline" rule.

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

const asd = [ // comment
  123,
  123
];
npx eslint src --ext '.ts, .tsx'

What did you expect to happen?

No error detected.

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

Adding an inline comment like that trips this rule, the array is actually consistently written as far as I'm concerned but the rule is kind of considering the inline comment as an item of the array.

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

I'm not too familiar with the AST, but with some pointers perhaps I can help.

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