Skip to content

[comma-dangle] does not check enum declarations #710

@lucaswerkmeister

Description

@lucaswerkmeister

Repro

{
  "rules": {
    "comma-dangle": ["error", "always-multiline"]
  }
}
enum MyEnum {
    MY_VALUE,
    MY_OTHER_VALUE
}

Expected Result

Some kind of error on line three of the test file, since there is no trailing comma after the final enum member.

Actual Result

No error is reported.

Additional Info

Ideally, this would happen with no extra config, where typescript-eslint would somehow “plug into” eslint’s comma-dangle rule. That said, its current implementation doesn’t look like it invites this; for example, it immediately throws away option members other than arrays/objects/imports/exports/functions, so it’s not clear how typescript-eslint could have separate options for enums here. A separate, TypeScript-specific rule seems more likely (I’m not sure if there are any other syntax constructs besides enums that support dangling commas). In that case, of course, the separate rule would need to be mentioned in the repro to make it work – but I couldn’t find any existing rule that would provide this.

Versions

package version
@typescript-eslint/eslint-plugin 1.12.0
@typescript-eslint/parser 1.12.0
TypeScript 3.5.3
ESLint 6.0.1
node 12.6.0
npm 6.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: new base rule extensionNew base rule extension required to handle a TS specific casegood first issueGood for newcomershas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy