-
-
Notifications
You must be signed in to change notification settings - Fork 621
feat(linter): add support for vitest/valid-title rule #12085
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
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Instrumentation Performance ReportMerging #12085 will not alter performanceComparing Summary
|
@@ -0,0 +1,929 @@ | |||
use std::hash::Hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, jest/vitest rules are mapped together as theyua re often so similar. Assuming there isn't a lot of extra work, could you move the test cases from this file into the jest.valid_title.rs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Would it also make sense to combine these rules into one file, merging the configurations? Or should I just move the tests?
I noticed that there's already a fully working implementation of
jest/valid-title
, and the logic is very similar. However, the vitest rule has slightly different configuration options, so it's not quite the same. I made thevitest/valid-title
rule work with their specific configuration options and unit tests.As part of this, I added support for the vitest typecheck option so that all the vitest-specific test scenarios would pass for this rule. This meant adding a
VitestPluginSettings
module withtypecheck
available as a boolean, defaulting to false.I considered trying to reuse some of the logic from the jest rule equivalent, but since there are subtle differences I didn't think the refactor was worth it on a first pass. The only tradeoff is that there's some duplicate logic between the jest / vitest rules for this.
Future consideration: The only other rule that uses
typecheck
as a config setting ineslint-plugin-vitest
is theexpect-expect
rule, which we currently have listed in the VITEST_COMPATIBLE_JEST_RULES. It might be worth adding support fortypecheck
in that rule for 100% compatibility.Reference:
Vitest Config Options from
vitest/valid_title.rs
):Jest Config Options (from
jest/valid_title.rs
):Vitest valid-title Rule Docs
Jest valid-title Rule Docs