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

🐛 useLiteralKeys breaks object key #191

Closed
1 task done
seriousme opened this issue Sep 8, 2023 · 3 comments · Fixed by #203
Closed
1 task done

🐛 useLiteralKeys breaks object key #191

seriousme opened this issue Sep 8, 2023 · 3 comments · Fixed by #203
Assignees
Labels
A-Linter Area: linter good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@seriousme
Copy link

Environment information

CLI:
  Version:                      1.1.2
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.17.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

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

What happened?

const obj = { "": "blah"}

results in:
The computed expression can be simplified without the use of a string literal.

Apply fixes results in:

const obj = {  : "blah"}

Which is invalid code.

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

Expected result

The rule should not trigger on object keys.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico added A-Linter Area: linter S-Bug-confirmed Status: report has been confirmed as a valid bug labels Sep 8, 2023
@Conaclos Conaclos added S-Help-wanted Status: you're familiar with the code base and want to help the project good first issue Good for newcomers labels Sep 8, 2023
@ssssota
Copy link
Contributor

ssssota commented Sep 8, 2023

Can I try this issue?

@Conaclos
Copy link
Member

Conaclos commented Sep 8, 2023

@ssssota You are welcome! Assigned :)

@seriousme
Copy link
Author

Thx !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants