vitest/consistent-test-it
@vitest/eslint-plugin
Safe autofix
eslint.config.js
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/consistent-test-it": "error",
},
},
];test('using test function', () => {
// ...
})
// Invalid: the top level keyword defaults to `test`
it('using it function', () => {
// ...
})test('using test function', () => {
// ...
})
test('using only test function', () => {
// ...
})Examples from the ESLint documentation.
vitest/consistent-test-it
@vitest/eslint-plugin
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/consistent-test-it": "error",
},
},
];vitest/consistent-test-it
vitest plugin · style
{
"plugins": [
"vitest"
],
"rules": {
"vitest/consistent-test-it": "error"
}
}style/useConsistentTestIt
style · since 2.4.11
{
"linter": {
"rules": {
"style": {
"useConsistentTestIt": "error"
}
}
}
}Enforce having hooks in consistent order
Require describe block to be less than set max value or default value
Disallow duplicate hooks and teardown hooks