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

Merged
merged 47 commits into from
Jan 26, 2025

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 (a8acbd7) with main (77ef61a)

Summary

✅ 33 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
@taearls taearls closed this Jan 11, 2025
@taearls taearls deleted the tyler/vitest-prefer-lowercase-title branch January 11, 2025 14:29
@taearls taearls restored the tyler/vitest-prefer-lowercase-title branch January 11, 2025 14:31
@taearls taearls reopened this Jan 11, 2025
@taearls
Copy link
Contributor Author

taearls commented Jan 11, 2025

I resolved the merge conflicts, so it's ready for review again.

@taearls
Copy link
Contributor Author

taearls commented Jan 25, 2025

@Boshen when you get a chance, would you mind giving this a review? thanks!

@Boshen Boshen merged commit 3790933 into oxc-project:main Jan 26, 2025
26 checks passed
@oxc-bot oxc-bot mentioned this pull request Feb 1, 2025
Boshen added a commit that referenced this pull request Feb 1, 2025
## [0.15.9] - 2025-02-01

### Features

- 1a41181 linter: Implement `eslint/prefer-object-spread` (#8216)
(tbashiyy)
- adb8ebd linter: Implement no-useless-call rule (#8789) (keita hino)
- 3790933 linter: Add vitest/prefer-lowercase-title rule (#8152) (Tyler
Earls)
- e8e6917 linter: Unicorn/switch-cases-braces support options (#8704)
(1zumii)

### Bug Fixes

- 8ce21d1 linter: Can't disable `no-nested-ternary` rule anymore (#8600)
(dalaoshu)
- e929f26 linter: Output `LintCommandInfo` for
`CliRunResult::LintNoFilesFound` (#8714) (Sysix)
- 4f30a17 linter: Unicorn/switch-case-braces mangles code when applying
fix (#8758) (Tyler Earls)
- 9cc9d5f linter: `ignorePatterns` does not work when files are provided
as command arguments (#8590) (dalaoshu)
- 1de6f85 linter: No-lone-blocks erroring on block statements containing
comments (#8720) (Tyler Earls)
- 77ef61a linter: Fix diagnostic spans for `oxc/no-async-await` (#8721)
(camchenry)
- f15bdce linter: Catch `Promise` in `typescript/array-type` rule
(#8702) (Rintaro Itokawa)
- 5041cb3 vscode: Fix commands by reverting commit `259a47b` (#8819)
(Alexander S.)

### Performance

- d318238 linter: Remove sorting of rules in cache (#8718) (camchenry)

### Documentation

- 57b7ca8 ast: Add documentation for all remaining JS AST methods
(#8820) (Cam McHenry)

### Refactor

- c2fdfc4 linter: Correctly handle loose options for `eslint/eqeqeq`
(#8798) (dalaoshu)
- 0aeaedd linter: Support loose options for `eslint/eqeqeq` (#8790)
(dalaoshu)
- 194a5ff linter: Remove `LintResult` (#8712) (Sysix)
- 4a2f2a9 linter: Move default `all_rules` output to trait (#8710)
(Sysix)
- 741fb40 linter: Move stdout outside LintRunner (#8694) (Sysix)
- 10e5920 linter: Move finishing default diagnostic message to
`GraphicalReporter` (#8683) (Sysix)
- 9731c56 oxlint: Move output from `CliRunResult::InvalidOption` to
outside and use more Enums for different invalid options (#8778) (Sysix)
- fe45bee oxlint: Create different `CliRunResult` instead of passing
`ExitCode` to it (#8777) (Sysix)
- 2378fef oxlint: Move ConfigFileInit output outside CliRunResult, exit
code 1 when it fails (#8776) (Sysix)
- f4cecb5 oxlint: Remove unused `CliRunResult::PathNotFound` (#8775)
(Sysix)

### Testing

- ad35e82 linter: Use snapshot testing instead of LintResult (#8711)
(Sysix)
- bf895eb linter: Add diagnostic format test snapshots (#8696)
(Alexander S.)
- 34d3d72 linter: Add snapshot tester for cli (#8695) (Sysix)
- 0bf2bcf oxlint: Test two real rules with same name but from different
plugins (#8821) (dalaoshu)
- 2b83b71 oxlint: Improve disabling "no-nested-ternary" tests (#8814)
(Alexander S.)
- 45648e7 oxlint: Fix InvalidOptionTsConfig tests for windows (#8791)
(Alexander S.)
- 48bfed9 oxlint: Ignore windows path mismatch (Boshen)
- 6f4a023 oxlint: Remove "--print-config" test (#8792) (Sysix)
- 55c2025 oxlint: Add `CliRunResult` to snapshot (#8780) (Sysix)

Co-authored-by: Boshen <[email protected]>
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.

3 participants