deno_lint icon indicating copy to clipboard operation
deno_lint copied to clipboard

accept `underscore` in enum declaration

Open cvng opened this issue 3 years ago • 1 comments

Lint Name

camelcase

Code Snippet

enum MyEnum {
  Idenfitier1,
  Idenfitier_2,
}

Expected Result

No warning

Actual Result

Identifier 'Identifier_2' is not in camel case.

Additional Info

Capture d’écran 2021-06-14 à 17 22 11

(those are generated from a graphql schema)

Version

deno 1.11.0 (release, x86_64-apple-darwin) v8 9.1.269.35 typescript 4.3.2

cvng avatar Jun 14 '21 13:06 cvng

Currently, camelcase rule allows PascalCase or CAPITAL_SNAKE_CASE in enum variants, so Identifier_2 in your example should be Identifier2 or IDENTIFIER_2. Is it impossible to change your GraphQL schema to follow this naming convention for some reason? If it's possible, please consider changing the schema. Otherwise, we have to discuss whether we should allow PascalCase to include underscores. (Personally I'm in favor of it though) Or, of course, it is reasonable to suppress the linter by adding // deno-lint-ignore directive in your situations. In general, linting on auto-generated code is a bit meaningless.

magurotuna avatar Jun 16 '21 13:06 magurotuna

@magurotuna made a relevant point.

@cvng do you agree? Can we close this issue?

Conaclos avatar Sep 21 '22 15:09 Conaclos

@magurotuna made a relevant point.

@cvng do you agree? Can we close this issue?

Sure, this is no longer an issue for us, thanks for asking

cvng avatar Sep 21 '22 15:09 cvng