Skip to content
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

docs: Add RuleTester changes to migrate to v9 guide #17923

Merged
merged 2 commits into from Dec 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/src/use/migrate-to-9.0.0.md
Expand Up @@ -29,6 +29,7 @@ The lists below are ordered roughly by the number of users each change is expect
* [Function-style rules are no longer supported](#drop-function-style-rules)
* [`meta.schema` is required for rules with options](#meta-schema-required)
* [`FlatRuleTester` is now `RuleTester`](#flat-rule-tester)
* [Stricter `RuleTester` checks](#stricter-rule-tester)

### Breaking changes for integration developers

Expand Down Expand Up @@ -209,6 +210,17 @@ As announced in our [blog post](/blog/2023/10/flat-config-rollout-plans/), the t

**Related Issues(s):** [#13481](https://github.com/eslint/eslint/issues/13481)

## <a name="stricter-rule-tester"></a> Stricter `RuleTester` checks

In order to aid in the development of high-quality custom rules that are free from common bugs, ESLint v9.0.0 implements several changes to `RuleTester`:

1. **Suggestion messages must be unique.** Because suggestions are typically displayed in an editor as a dropdown list, it's important that no two suggestions have the same message. Otherwise, it's impossible to know what any given suggestion will do. This additional check runs automatically.
nzakas marked this conversation as resolved.
Show resolved Hide resolved
1. **Suggestions must generate valid syntax.** In order for rule suggestions to be helpful, they need to be valid syntax. `RuleTester` now parses the output of suggestions using the same language options as the `code` value and throws an error if parsing fails.

**To address:** Run your rule tests using `RuleTester` and fix any errors that occur. The changes you'll need to make to satisfy `RuleTester` are compatible with ESLint v8.x.

**Related Issues(s):** [#15735](https://github.com/eslint/eslint/issues/15735), [#16908](https://github.com/eslint/eslint/issues/16908)

## <a name="flat-eslint"></a> `FlatESLint` is now `ESLint`

As announced in our [blog post](/blog/2023/10/flat-config-rollout-plans/), the temporary `FlatESLint` class has been renamed to `ESLint`, while the `ESLint` class from v8.x has been renamed to `LegacyESLint`.
Expand Down