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(linter): add vitest/prefer-lowercase-title rule #8152

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

taearls
Copy link
Contributor

@taearls taearls commented Dec 27, 2024

This pull request implements the vitest/prefer-lowercase-title rule.

Since there was an existing jest rule with this title, I followed the existing pattern in no-unused-vars to group the jest and vitest rules together in a shared module. I used the existing jest/prefer-lowercase-title documentation as a base and modified it where it seemed appropriate. I added a jest and vitest snapshot suffix for each respective test suite.

One item I wasn't 100% about is adding bench to the jest test names. Without this change, the vitest test suite fails because of this check which validates that we're only parsing valid jest functions from a detected jest file. The unit tests that are sourced from the vitest plugin are all read by the linting host as jest-like files, so adding bench as a "valid" jest method allows us to lint a unit test using this keyword. This seemed to me like the least invasive solution to accommodate the new rule without breaking any existing code, but I'm certainly open to alternatives.

Copy link

graphite-app bot commented Dec 27, 2024

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-linter Area - Linter C-enhancement Category - New feature or request labels Dec 27, 2024
Copy link

codspeed-hq bot commented Dec 27, 2024

CodSpeed Performance Report

Merging #8152 will not alter performance

Comparing taearls:tyler/vitest-prefer-lowercase-title (16216ed) with main (d8d2ec6)

Summary

✅ 29 untouched benchmarks

@taearls
Copy link
Contributor Author

taearls commented Dec 28, 2024

I noticed the VITEST_COMPATIBLE_JEST_RULES set and added prefer-lowercase-title there. this also updated my snapshot test for the vitest unit tests with the correct plugin name.

Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

Thanks!

@camc314 camc314 requested a review from Boshen December 28, 2024 17:31
@taearls taearls changed the title feat(linter): add vitest/prefer-lowercase-title feat(linter): add vitest/prefer-lowercase-title rule Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants