Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lucaswerkmeister opened this issue Jul 16, 2019 · 2 comments · Fixed by #2416
Closed

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

lucaswerkmeister opened this issue Jul 16, 2019 · 2 comments · Fixed by #2416
Labels
enhancement: new base rule extension New base rule extension required to handle a TS specific case good first issue Good for newcomers has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@lucaswerkmeister
Copy link
Contributor

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
@lucaswerkmeister lucaswerkmeister added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jul 16, 2019
@bradzacher bradzacher added enhancement: new base rule extension New base rule extension required to handle a TS specific case and removed triage Waiting for maintainers to take a look labels Jul 16, 2019
@bradzacher bradzacher added the good first issue Good for newcomers label Jul 27, 2019
@lolmaus

This comment has been minimized.

@bradzacher

This comment has been minimized.

@bradzacher bradzacher added the has pr there is a PR raised to close this label Aug 24, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: new base rule extension New base rule extension required to handle a TS specific case good first issue Good for newcomers has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants