Skip to content

Conversation

@paescuj
Copy link
Contributor

@paescuj paescuj commented Oct 14, 2025

According to https://typescript-eslint.io/developers/custom-rules/#handling-rule-options we should "use the second parameter of the create function, not context.options" to retrieve the (default) options.

In this PR, all rules that previously relied on context.options have been updated accordingly.

It fixes #783. I guess considering it a "fix" is appropriate here since it would now work as outlined in the documentation.
For the other rules there are no logical changes. Please let me know if you prefer to have those changes in separate PRs.

Advantage: consistency and expected behavior for future adjustments to default options
Minor disadvantage: currently, we have to use the non-null assertion operator for default values as the types in ESLintUtils.RuleCreator doesn't seem to account for them

Copy link
Member

@veritem veritem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you so much for the great work!

@veritem veritem merged commit 9648b95 into vitest-dev:main Oct 14, 2025
4 checks passed
@paescuj paescuj deleted the fix/default-options branch October 14, 2025 16:29
@paescuj
Copy link
Contributor Author

paescuj commented Oct 14, 2025

thank you so much for the great work!

happy to and thank you 🫵🏼 for maintaining this extremely useful eslint plugin! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-focused-tests doesn't automatically remove .only with --fix as said by the documentation

2 participants