vitest-dev / vitest-dev/vitest
Allow to opt-out from arguments destructuring in fixtures API
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Clear and concise description of the problem
When a fixture does not use any other fixtures, it violates no-empty-pattern rule
export const test = baseTest.extend({
// this triggers a eslint error: no-empty-pattern
todos: async ({}, use) => {
await use([]);
}
})
Because this rule is a part of the recommended rules preset, it is enabled by default on many projects
This requires a manual opt out of the rule as shown in many examples
- Code examples in Vitest bug reports: https://github.com/search?q=repo%3Avitest-dev%2Fvitest+%22no-empty-pattern%22&type=issues
- Code examples in Github search: https://github.com/search?q=test.extend+no-empty-pattern&type=code
Suggested solution
Allow to opt out from destructuring arguments in this code:
export const test = baseTest.extend({
todos: async (_, use) => {
await use([]);
}
})
_ variable placeholder is a common convention to skip unused arguments, which can be useful here as well
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the fixtures API entry point and reproduce the example with a fixture callback that destructures an empty object. Check the existing fixture tests, then verify that callbacks can use _ without triggering the no-empty-pattern issue while the current {} form remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100