-
-
Notifications
You must be signed in to change notification settings - Fork 713
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CodSpeed Performance ReportMerging #12085 will not alter performanceComparing Summary
Footnotes
|
camc314
reviewed
Jul 7, 2025
6f9e272 to
289d4e6
Compare
4412397 to
109ffd2
Compare
Consolidates the `valid-title` rule implementation for both Jest and Vitest into a single rule located in the jest directory. This unifies the logic and reduces code duplication while maintaining full compatibility with both testing frameworks. Changes: - Merged vitest configuration options into jest/valid-title: - Added `allowArguments` option (allows identifier arguments) - Preserved all existing jest options - Merged vitest-specific logic: - Skip `.extend()` calls (test.extend(), it.extend()) - Respect `ctx.settings().vitest.typecheck` for describe blocks - Support identifier arguments when `allowArguments` is enabled - Enhanced pattern compilation: - Handle JS regex literals (e.g., /pattern/flags) - Strip `/` prefix and suffix from patterns automatically - Backward compatible with existing pattern formats - Improved error messages: - Empty title errors now include function name - Example: `\`describe\` should not have an empty title` - Updated documentation to reference both Jest and Vitest - Merged all vitest test cases into jest test suite - Removed vitest/valid-title.rs and module registration - Updated snapshots with improved error messages All 794 tests passing. The rule now supports both frameworks from a single location while maintaining backward compatibility with existing configs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update oxlint snapshots to reflect the improved error messages from the merged valid-title rule. Empty title errors now include the function name for better clarity (e.g., `describe` should not have an empty title instead of just "Should not have an empty title"). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove the vitest_valid_title.snap file since the rule was merged into jest/valid-title. All tests now use the jest_valid_title.snap snapshot. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Restore the original "Should not have an empty title" message instead of the function-name-specific messages. This keeps the merge focused on adding vitest support without introducing unrelated changes to existing behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Revert the oxlint snapshots to match the restored original jest error
messages ("Should not have an empty title" instead of function-specific
messages).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fix clippy::uninlined_format_args warnings by using inline format arguments in the valid_title regex compilation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added no_export_in_script_setup, no_import_compiler_macros, and require_default_export to the macro invocation. These rules were declared but not registered, causing test failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Generated RuleRunner trait implementations for newly registered Vue rules using oxc_linter_codegen. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Regenerated rule_runner_impls.rs using cargo lintgen to sync with the latest main branch changes after rebasing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…erate rule runner impls After rebasing onto main, the array size needed to be updated from 34 to 35 elements to include valid-title. Also regenerated rule runner implementations which includes optimizations for node type filtering. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
109ffd2 to
30e2c16
Compare
camc314
approved these changes
Oct 23, 2025
camc314
added a commit
that referenced
this pull request
Oct 30, 2025
## [1.25.0] - 2025-10-30 ### 💥 BREAKING CHANGES - 659fd37 linter: [**BREAKING**] `tsgolint`: request fixes when necessary (#15048) (camchenry) ### 🚀 Features - ed24d60 linter: Expose tsgolint program diagnostics (#15080) (camc314) - 23660c9 linter: `tsgolint`: handle omitted fixes and suggestions (#15047) (camchenry) - f7bef73 linter/plugins: Scope manager API (#14890) (Arsh) - 3e15cdd linter/strict-boolean-expression: Add rule (#14930) (camc314) - bd74603 linter: Add support for vitest/valid-title rule (#12085) (Tyler Earls) ### 🐛 Bug Fixes - e41dee5 linter/consistent-type-definition: Skip comments when looking for token (#14909) (camc314) - 806f9ba linter: Search system PATH for tsgolint executable (#14861) (magic-akari) - ee68089 linter: Normalize JS plugin names (#15010) (Peter Wagenet) - 597340e ast-tools: Use oxfmt to format generated code (#15064) (camc314) - 5eaaa8e linter: Prevent underflow in count_comment_lines for JSX files (#15026) (ityuany) - 88577a8 import/no-namespace: Remove dot special case (#15032) (Arsh) - 55ee962 linter/vars-on-top: False positive with typescript declare block (#14952) (Hamir Mahal) - 2de9f39 linter/plugins: Fall back to package name if meta.name is missing (#14938) (Peter Wagenet) - 5ace84b linter/no-empty-object-type: Parse `"allowWithName"` as regular expressions (#14943) (Arsh) - 5a2832d editor: Stop client when delete .oxlintrc.json with `oxc.requireConfig` (#14897) (Liang Mi) - 3e29d23 linter: Use aliases when parsing cli rules (#14912) (Arsh) - b94b6aa linter/explicit-module-boundary-types: False negative with export default function (#14905) (camc314) - 7060863 linter/no-standaline-expect: False positive with expect in callback (#14902) (camc314) - dc5a71b linter/no-accumulating-spread: False positive in nested callbacks within reduce (#14898) (camc314) ### 🚜 Refactor - 8d8d508 editor: Flatten `flags` options (#15006) (Sysix) - b1e1531 language_server: Extract library interface from main.rs (#15036) (Boshen) - 5de99c2 formatter: Export unified way to get_parse_options (#15027) (leaysgur) - b55df7f language_server: Move sub option for `flags` to the root + deprecate flags (#14933) (Sysix) ### 📚 Documentation - e15c91c linter: Add configuration option docs for eslint/init-declarations rule. (#15085) (Connor Shea) - f4505bc linter: Add configuration option docs for eslint/id-length rule. (#15083) (Connor Shea) - dd4c9d2 linter: Add configuration option docs for eslint/getter-return rule. (#15081) (Connor Shea) - 008e67a linter: Add configuration option docs for jest/no-large-snapshots rule. (#15079) (Connor Shea) - 31daf79 linter: Add configuration option docs for import/no-commonjs rule. (#15077) (Connor Shea) - 9bf8ebe linter: Add configuration option docs for jsdoc/check-tag-names rule. (#15076) (Connor Shea) - 491ab5e linter: Add configuration option docs for jsdoc/no-defaults rule. (#15074) (Connor Shea) - 2602d7e linter: Add configuration option docs for jsdoc/empty-tags rule. (#15072) (Connor Shea) - c3a92e0 linter: Add configuration option docs for oxc/no-rest-spread-properties rule. (#15070) (Connor Shea) - c7c9213 linter: Add configuration option docs for oxc/no-optional-chaining rule. (#15071) (Connor Shea) - 47a616f linter: Add configuration option docs for typescript/no-empty-object-type rule. (#14968) (Connor Shea) - fcc1e25 linter: Add configuration option docs for typescript/no-explicit-any rule. (#15051) (Connor Shea) - 1b88934 linter: Add configuration option docs for eslint/no-multi-assign rule. (#15052) (Connor Shea) - 909d4b9 linter: Add configuration option docs for eslint/no-unsafe-negation rule. (#15053) (Connor Shea) - f60763b linter: Add configuration option docs for eslint/no-useless-computed-key rule. (#15054) (Connor Shea) - c8911d4 linter: Add configuration option docs for eslint/no-unneeded-ternary rule. (#15056) (Connor Shea) - 9fc6374 linter: Add configuration option docs for eslint/no-misleading-character-class rule. (#15058) (Connor Shea) - 7656e2b linter: Add configuration option docs for eslint/sort-imports rule. (#15013) (Connor Shea) - bb06039 linter: Add configuration option docs for unicorn/no-instanceof-builtins rule. (#14999) (Connor Shea) - a4af5ff linter: Add configuration option docs for unicorn/no-typeof-undefined rule. (#15001) (Connor Shea) - ac2ed39 linter: Add configuration option docs for unicorn/numeric-separators-style rule. (#15002) (Connor Shea) - 5ce3e33 linter: Add configuration option docs for unicorn/prefer-object-from-entries rule. (#15003) (Connor Shea) - 07aea72 linter: Add configuration option docs for eslint/sort-keys rule. (#15014) (Connor Shea) - 35b36e0 linter: Add configuration option docs for eslint/no-eval rule. (#15015) (Connor Shea) - d222b85 linter: Add configuration option docs for eslint/no-empty rule. (#15017) (Connor Shea) - 83bbc37 linter: Add configuration option docs for eslint/no-extend-native rule. (#15018) (Connor Shea) - aade2fe linter: Add configuration option docs for eslint/no-extra-boolean-cast rule. (#15019) (Connor Shea) - bae0c09 linter: Add configuration option docs for jsdoc/require-yields rule. (#15024) (Connor Shea) - 06c77b6 linter: Add configuration option docs for unicorn/prefer-at rule. (#15023) (Connor Shea) - 54b2cb4 linter: Add configuration option docs for eslint/max-classes-per-file rule. (#15022) (Connor Shea) - b5acda7 linter: Add configuration option docs for typescript/explicit-module-boundary-types rule. (#15021) (Connor Shea) - a0c6162 linter: Add configuration option docs for vue/max-props rule. (#14966) (Connor Shea) - 3ec59c0 linter: Add configuration option docs for no-async-endpoint-handlers rule. (#14965) (Connor Shea) - 7a275fd linter: Add configuration option docs for no-map-spread rule. (#14964) (Connor Shea) - 0002b7c linter: Add configuration option docs for no-barrel-file rule. (#14963) (Connor Shea) - fd4b7ab linter: Add configuration option docs for unicorn/consistent-function-scoping rule. (#14969) (Connor Shea) - aa339b3 linter: Add configuration option docs for eslint/no-void rule. (#14970) (Connor Shea) - af8bdae linter: Add configuration option docs for import/no-anonymous-default-export rule. (#14971) (Connor Shea) - 5a81953 linter: Add configuration option docs for jest/require-hook rule. (#14972) (Connor Shea) - 1be268d linter: Add configuration option docs for jest/require-top-level-describe rule. (#14973) (Connor Shea) - 860a58c linter: Add configuration option docs for jest/no-hooks rule. (#14974) (Connor Shea) - b69b586 linter: Add configuration option docs for jest/max-expects rule. (#14975) (Connor Shea) - 2e02fe0 linter: Add configuration option docs for jest/no-deprecated-functions rule (#14976) (Connor Shea) - cdc6c4f linter: Add configuration option docs for unicorn/no-array-sort rule. (#14977) (Connor Shea) - 40eb394 linter/no-unassigned-import-config: Add auto generated config docs (#14918) (camc314) ### ⚡ Performance - a9f68b2 linter: Move up rule retainment into initial collection to reduce allocation size (#14822) (camchenry) - b27c5b9 linter: Add codegen support for regex nodes (#14874) (camchenry) ### 🧪 Testing - bf898e5 linter: Increase stability of tsgolint test cases (#15063) (camc314) - 49da411 linter/no-standalone-expect: Fix tests (#14901) (camc314) Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-titlerule 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
VitestPluginSettingsmodule withtypecheckavailable 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
typecheckas a config setting ineslint-plugin-vitestis theexpect-expectrule, which we currently have listed in the VITEST_COMPATIBLE_JEST_RULES. It might be worth adding support fortypecheckin 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