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

💅 Enum Initializer putting initialization inside inline comment #1640

Closed
1 task done
Reed-Anderson opened this issue Jan 22, 2024 · 2 comments
Closed
1 task done
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@Reed-Anderson
Copy link

Reed-Anderson commented Jan 22, 2024

Environment information

CLI:
  Version:                      1.5.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v20.9.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.1.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

Rule name

lint/style/useEnumInitializers

Playground link

https://biomejs.dev/playground/?code=ZQBuAHUAbQAgAFMAZQB2AGUAcgBpAHQAeQAgAHsACgAgACAAIAAgAEkAbgBmAG8AIAA9ACAAMQAsACAALwAvACAATgBvAHQAIABhACAAcAByAG8AYgBsAGUAbQAsACAAcwBvAG0AZQB0AGkAbQBlAHMAIABhACAAbQBpAHMAdABhAGsAZQAKACAAIAAgACAAQQBkAHYAaQBzAG8AcgB5ACwAIAAvAC8AIABOAG8AdAAgAGEAIABwAHIAbwBiAGwAZQBtACwAIABvAGYAdABlAG4AIABhACAAbQBpAHMAdABhAGsAZQAKACAAIAAgACAAQwBhAHUAdABpAG8AbgAsACAALwAvACAATQBpAG4AbwByACAAZQByAHIAbwByACwAIABuAG8AbgAtAHAAcgBlAHYAZQBuAHQAaQBuAGcACgAgACAAIAAgAFcAYQByAG4AaQBuAGcALAAgAC8ALwAgAFMAZQByAGkAbwB1AHMAIABlAHIAcgBvAHIALAAgAHAAcgBlAHYAZQBuAHQAcwAgAHAAcgBvAGQAdQBjAHQAaQBvAG4ACgAgACAAIAAgAEUAcgByAG8AcgAgAC8ALwAgAEMAcgBpAHQAaQBjAGEAbAAgAGUAcgByAG8AcgAsACAAcAByAGUAdgBlAG4AdABzACAAZABlAHYAIABhAG4AZAAgAHAAcgBvAGQAdQBjAHQAaQBvAG4ACgB9AA%3D%3D

Expected result

enum Severity {
	Info = 1, // Not a problem, sometimes a mistake
	Advisory = 2, // Not a problem, often a mistake
	Caution = 3, // Minor error, non-preventing
	Warning = 4, // Serious error, prevents production
	Error = 5 // Critical error, prevents dev and production
}

Actual Result

enum Severity {
	Info = 1, // Not a problem, sometimes a mistake
	Advisory = 2, // Not a problem, often a mistake
	Caution = 3, // Minor error, non-preventing
	Warning = 4, // Serious error, prevents production
	Error // Critical error, prevents dev and production = 5
}

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos Conaclos added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Jan 22, 2024
@kalleep
Copy link
Contributor

kalleep commented Jan 23, 2024

Seems like this only happens when the last element is missing a comma. I can look into this one :)

@kalleep
Copy link
Contributor

kalleep commented Jan 25, 2024

Forgot to link to the issue in the pr but this one can be closed because #1650 was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

4 participants