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

feat(biome_js_analyze): implement useConsistentObjectDefinition rule #5042

Merged
merged 12 commits into from
Feb 25, 2025

Conversation

dy0gu
Copy link
Contributor

@dy0gu dy0gu commented Feb 6, 2025

Summary

Related: #4816

This PR adds a rule inspired by object-shorthand from eslint. It is not a complete port.

I would also like to add a code action in the future, shouldn't be too hard. I may open a new PR for that but at the moment it would be too time consuming to look into.

Test Plan

Snapshot tests for both the options supported by the rule can be found in crates\biome_js_analyze\tests\specs\nursery\useConsistentObjectLiterals.

@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Diagnostic Area: diagnostocis labels Feb 6, 2025
Copy link

codspeed-hq bot commented Feb 6, 2025

CodSpeed Performance Report

Merging #5042 will not alter performance

Comparing dy0gu:use-consistent-object-literals (65ee913) with main (7e938f3)

Summary

✅ 97 untouched benchmarks

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the code looks good, I left some suggestion. I think we settled on a different name

@dy0gu dy0gu changed the title feat(biome_js_analyze): implement useConsistentObjectLiterals feat(biome_js_analyze): implement useConsistentObjectDefinition Feb 7, 2025
@dy0gu dy0gu changed the title feat(biome_js_analyze): implement useConsistentObjectDefinition feat(biome_js_analyze): implement useConsistentObjectDefinition rule Feb 7, 2025
@dy0gu dy0gu requested a review from ematipico February 11, 2025 09:28
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions and considerations:

  • The rule doesn't have any severity, is it intended? FYI rules without severity will have a Information severity
  • There many cases that aren't covered by the tests. Do you intend to implement them later or now in this PR?

@ematipico ematipico deleted the branch biomejs:main February 12, 2025 11:41
@ematipico ematipico closed this Feb 12, 2025
@ematipico ematipico reopened this Feb 12, 2025
@ematipico ematipico changed the base branch from next to main February 12, 2025 11:48
@dy0gu dy0gu requested a review from ematipico February 15, 2025 22:23
Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all comments were addressed here, right?

@ematipico
Copy link
Member

ematipico commented Feb 25, 2025

I will merge the PR after I fix the conflicts and rework the changeset. As it is now, it's poor because it doesn't say anything to our users.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, @dy0gu, for your contribution. I hope you had fun :)

@ematipico ematipico merged commit d640aaf into biomejs:main Feb 25, 2025
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants