Currently, we have the concept of "Vitest compatible" where the Jest rules act as if they were also Vitest rules. This does save on the amount of code that needs to be written, but it is confusing. It makes the linter more complex, because it adds a lot of special casing to the tooling.
As a result, we have a number of bugs related to these "Vitest compatible" rules:
I propose that we:
- Move each Vitest compatible Jest rule in
VITEST_COMPATIBLE_JEST_RULES to an additional new Vitest rule
- Once all rules are migrated, remove the
VITEST_COMPATIBLE_JEST_RULES array
In addition, we will also want to do as part of this:
- Update documentation for the new Vitest rules to be Vitest-specific, start removing references to Jest.
- Allow configuration to be automatically generated (using
JsonSchema)
Rules to convert:
Currently, we have the concept of "Vitest compatible" where the Jest rules act as if they were also Vitest rules. This does save on the amount of code that needs to be written, but it is confusing. It makes the linter more complex, because it adds a lot of special casing to the tooling.
As a result, we have a number of bugs related to these "Vitest compatible" rules:
valid_describe_callbackshould not execute in Vitest #9060I propose that we:
VITEST_COMPATIBLE_JEST_RULESto an additional new Vitest ruleVITEST_COMPATIBLE_JEST_RULESarrayIn addition, we will also want to do as part of this:
JsonSchema)Rules to convert:
consistent-test-itexpect-expectmax-expectsmax-nested-describeno-alias-methodsno-commented-out-testsno-conditional-expectno-conditional-in-testno-disabled-testsno-duplicate-hooksno-focused-testsno-hooksno-identical-titleno-interpolation-in-snapshotsno-large-snapshotsno-mocks-importno-restricted-jest-methods(note that this one will require cleaning upcrates/oxc_linter/src/disable_directives.rsandcrates/oxc_linter/src/config/rules.rsto remove special-casing due to this rule having a different name in vitest vs jest. And make sure the vitest rule name isno-restricted-vi-methods)no-restricted-matchersno-standalone-expectno-test-prefixesno-test-return-statementno-unneeded-async-expect-functionprefer-called-withprefer-comparison-matcherprefer-eachprefer-equality-matcherprefer-expect-resolvesprefer-hooks-in-orderprefer-hooks-on-topprefer-lowercase-titleprefer-mock-promise-shorthandprefer-mock-return-shorthandprefer-snapshot-hintprefer-spy-onprefer-strict-equalprefer-to-beprefer-to-containprefer-to-have-been-called-timesprefer-to-have-lengthprefer-todorequire-hookrequire-to-throw-messagerequire-top-level-describevalid-describe-callbackvalid-expectvalid-expect-in-promisevalid-title