From f3d76d8eb5fc77866b3289360c8d02eba684e57b Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 5 Aug 2021 13:35:05 -0700 Subject: [PATCH 01/10] Docs: Add v8.0.0 migration guide (fixes #14856) --- docs/user-guide/migrating-to-8.0.0.md | 243 ++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 docs/user-guide/migrating-to-8.0.0.md diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md new file mode 100644 index 00000000000..4cb4cd8d798 --- /dev/null +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -0,0 +1,243 @@ +# Migrating to v8.0.0 + +ESLint v8.0.0 is a major release of ESLint. We have made a few breaking changes in this release. This guide is intended to walk you through the breaking changes. + +The lists below are ordered roughly by the number of users each change is expected to affect, where the first items are expected to affect the most users. + +## Table of Content + +### Breaking changes for users + +- [Node.js 10, 13, and 15 are no longer supported](#drop-old-node) +- [Removed `codeframe` and `table` formatters](#removed-formatters) +- [`comma-dangle` rule schema is stricter](#comma-dangle) +- [Unused disable directives are now fixable](#directives) +- [`eslint:recommended` has been updated](#eslint-recommended) + +### Breaking changes for plugin developers + +- [Node.js 10, 13, and 15 are no longer supported](#drop-old-node) +- [Rules require `meta.hasSuggestions` to provide suggestions](#suggestions) +- [Rules require `meta.fixable` to provide fixes](#fixes) +- [`SourceCode#getComments()` fails in `RuleTester`](#get-comments) + +### Breaking changes for integration developers + +- [Node.js 10, 13, and 15 are no longer supported](#drop-old-node) +- [Plugin resolution has been updated](#plugin-loading-change) +- [The `CLIEngine` class has been removed](#remove-cliengine) +- [The `linter` object has been removed](#remove-linter) +- [The `/lib` entrypoint has been removed](#remove-lib) + +--- + +## Node.js 10, 13, and 15 are no longer supported + +Node.js 10, 13, 15 all reached end of life either in 2020 or early 2021. ESLint is officially dropping support for these versions of Node.js starting with ESLint v8.0.0. ESLint now supports the following versions of Node.js: + +- Node.js 12.22 and above +- Node.js 14 and above +- Node.js 16 and above + +**To address:** Make sure you upgrade to at least Node.js `12.22.0` when using ESLint v8.0.0. One important thing to double check is the Node.js version supported by your editor when using ESLint via editor integrations. If you are unable to upgrade, we recommend continuing to use ESLint 7 until you are able to upgrade Node.js. + +**Related issue(s):** [#14023](https://github.com/eslint/eslint/issues/14023) + +## Removed `codeframe` and `table` formatters + +ESLint v8.0.0 has removed the `codeframe` and `table` formatters from the core. These formatters required dependencies that weren't used anywhere else in ESLint, and removing them allows us to reduce the size of ESLint, allowing for faster installation. + +**To address:** If you are using the `codeframe` or `table` formatters, you'll need to install the standalone `eslint-formatter-codeframe` or `eslint-formatter-table` packages, respectively, to be able to use them in ESLint v8.0.0. + +**Related issue(s):** [#14277](https://github.com/eslint/eslint/issues/14277), [#14316](https://github.com/eslint/eslint/pull/14316) + + +## `comma-dangle` rule schema is stricter + +In ESLint v7.0.0, the `comma-dangle` rule could be configured like this without error: + +```json +{ + "rules": { + "comma-dangle": ["error", "never", { "arrays": "always" }] + } +} +``` + +With this configuration, the rule would ignore the third element in the array because only the second element is read. In ESLint v8.0.0, this configuration will cause ESLint to throw an error. + +**To address:** Change your rule configuration so that there are only two elements in the array, and the second element is either a string or an object, such as: + +```json +{ + "comma-dangle": ["error", "never"], + // or + "comma-dangle": ["error", { + "arrays": "never", + "objects": "never", + "imports": "never", + "exports": "never", + "functions": "never" + }] +} +``` + +**Related issue(s):** [#13739](https://github.com/eslint/eslint/issues/13739) + +## Unused disable directives are now fixable + +In ESLint v7.0.0, using both `--report-unused-disable-directives` and `--fix` on the command line would fix only rules but leave unused disable directives in place. In ESLint v8.0.0, this combination of command-line options will result in the unused disable directives being removed. + +**To address:** If you are using `--report-unused-disable-directives` and `--fix` together on the command line, and you don't want unused disable directives to be removed, add `--fix-type problem,suggestion,layout` as a command line option. + +**Related issue(s):** [#11815](https://github.com/eslint/eslint/issues/11815) + +## `eslint:recommended` has been updated + +Three new rules have been enabled in the `eslint:recommended` preset. + +- [`no-loss-of-precision`](https://eslint.org/docs/rules/no-loss-of-precision) +- [`no-nonoctal-decimal-escape`](https://eslint.org/docs/rules/no-nonoctal-decimal-escape) +- [`no-unsafe-optional-chaining`](https://eslint.org/docs/rules/no-unsafe-optional-chaining) +- [`no-useless-backreference`](https://eslint.org/docs/rules/no-useless-backreference) + +**To address:** Fix errors or disable these rules. + +**Related issue(s):** [#14673](https://github.com/eslint/eslint/issues/14673) + + +## Rules require `meta.hasSuggestions` to provide suggestions + +In ESLint v7.0.0, rules that [provided suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions) did not need to let ESLint know. In v8.0.0, rules providing suggestions need to set their `meta.hasSuggestions` to `true`. This informs ESLint that the rule intends to provide suggestions. Without this property, any attempt to provide a suggestion will result in an error. + +**To address:** If your rule provides suggestions, add `meta.hasSuggestions` to the object, such as: + +```js +module.exports = { + meta: { + hasSuggestions: true + }, + create(context) { + // your rule + } +}; +``` + +**Related issue(s):** [#14312](https://github.com/eslint/eslint/issues/14312) + +## Rules require `meta.fixable` to provide fixes + +In ESLint v7.0.0, rules that were written as a function (rather than object) were able to provide fixes. In ESLint v8.0.0, only rules written as an object are allowed to provide fixes and must have a `meta.fixable` property set to either `"code"` or `"whitespace"`. + +**To address:** If your rule makes fixes and is written as a function, such as: + +```js +module.exports = function(context) { + // your rule +}; +``` + +Then rewrite your rule in this format: + +```js +module.exports = function(context) { + meta: { + fixable: "code" // or "whitespace" + }, + create(context) { + // your rule + } +}; +``` + +See the [rule documentation](https://eslint.org/docs/developer-guide/working-with-rules) for more information on writing rules. + +**Related issue(s):** [#13349](https://github.com/eslint/eslint/issues/13349) + +## `SourceCode#getComments()` fails in `RuleTester` + +Back in ESLint v4.0.0, we deprecated `SourceCode#getComments()`, but we neglected to remove it. Rather than removing it completely in v8.0.0, we are taking the intermediate step of updating `RuleTester` to fail when `SourceCode#getComments()` is used inside of a rule. As such, all existing rules will continue to work, but when the developer runs tests for the rule there will be a failure. + +The `SourceCode#getComments()` method will be removed in v9.0.0. + +**To address:** If your rule uses `SourceCode#getComments()`, please use `SourceCode#getCommentsBefore()`, `SourceCode#getCommentsAfter()`, or ``SourceCode#getCommentsInside()`: + +**Related issue(s):** [#14744](https://github.com/eslint/eslint/issues/14744) + + + +## The `CLIEngine` class has been removed + +The `CLIEngine` class has been removed and replaced by the [`ESLint` class](https://eslint.org/docs/developer-guide/nodejs-api#eslint-class). + +**To address:** Update your code to use the new `ESLint` class if you are currently using `CLIEngine`. The following table maps the existing `CLIEngine` methods to their `ESLint` counterparts: + +| `CLIEngine` | `ESLint` | +| :------------------------------------------- | :--------------------------------- | +| `executeOnFiles(patterns)` | `lintFiles(patterns)` | +| `executeOnText(text, filePath, warnIgnored)` | `lintText(text, options)` | +| `getFormatter(name)` | `loadFormatter(name)` | +| `getConfigForFile(filePath)` | `calculateConfigForFile(filePath)` | +| `isPathIgnored(filePath)` | `isPathIgnored(filePath)` | +| `static outputFixes(results)` | `static outputFixes(results)` | +| `static getErrorResults(results)` | `static getErrorResults(results)` | +| `static getFormatter(name)` | (removed ※1) | +| `addPlugin(pluginId, definition)` | the `plugins` constructor option | +| `getRules()` | (removed ※2) | +| `resolveFileGlobPatterns()` | (removed ※3) | + +- ※1 The `engine.getFormatter()` method currently returns the object of loaded packages as-is, which made it difficult to add new features to formatters for backward compatibility reasons. The new `eslint.loadFormatter()` method returns an adapter object that wraps the object of loaded packages, to ease the process of adding new features. Additionally, the adapter object has access to the `ESLint` instance to calculate default data (using loaded plugin rules to make `rulesMeta`, for example). As a result, the `ESLint` class only implements an instance version of the `loadFormatter()` method. +- ※2 The `CLIEngine#getRules()` method had side effects and so was removed. If you were using `CLIEngine#getRules()` to retrieve meta information about rules based on linting results, use `ESLint#getRulesMetaForResults()` instead. If you were using `CLIEngine#getRules()` to retrieve all built-in rules, import `builtinRules` from `eslint/use-at-your-own-risk` for an unsupported API that allows access to internal rules. +- ※3 Since ESLint v6.0.0, ESLint uses different logic from the `resolveFileGlobPatterns()` method to iterate files, making this method obsolete. + +**Related issue(s):** [RFC80](https://github.com/eslint/rfcs/tree/main/designs/2021-package-exports), [#14716](https://github.com/eslint/eslint/pull/14716), [#13654](https://github.com/eslint/eslint/issues/13654) + +## The `linter` object has been removed + +The deprecated `linter` object has been removed from the ESLint package in v8.0.0. + +**To address:** If you are using the `linter` object, such as: + +```js +const { linter } = require("eslint"); +``` + +Change your code to this: + +```js +const { Linter } = require("eslint"); +const linter = new Linter(); +``` + +**Related issue(s):** [RFC80](https://github.com/eslint/rfcs/tree/main/designs/2021-package-exports), [#14716](https://github.com/eslint/eslint/pull/14716), [#13654](https://github.com/eslint/eslint/issues/13654) + +## The `/lib` entrypoint has been removed + +Beginning in v8.0.0, ESLint is strictly defining its public API. Previously, you could reach into individual files such as `require("eslint/lib/rules/semi")` and this is no longer allowed. There are a limited number of existing APIs that are now available through the `/use-at-your-own-risk` entrypoint for backwards compatibility, but these APIs are not formally supported and may break or disappear at any point in time. + +**To address:** If you are accessing rules directly through the `/lib` entrypoint, such as: + +```js +const rule = require("eslint/lib/rules/semi"); +``` + +Change your code to this: + +```js +const { builtinRules } = require("eslint/use-at-your-own-risk"); +const rule = builtinRules.get("semi"); +``` + +If you are accessing `FileEnumerator` directly through the `/lib` entrypoint, such as: + +```js +const { FileEnumerator } = require("eslint/lib/cli-engine/file-enumerator"); +``` + +Change your code to this: + +```js +const { FileEnumerator } = require("eslint/use-at-your-own-risk"); +``` + +**Related issue(s):** [RFC80](https://github.com/eslint/rfcs/tree/main/designs/2021-package-exports), [#14716](https://github.com/eslint/eslint/pull/14716), [#13654](https://github.com/eslint/eslint/issues/13654) From 896c45f062f3c330c46064ae68b43039b808e03d Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 5 Aug 2021 17:35:14 -0700 Subject: [PATCH 02/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Bryan Mishkin <698306+bmish@users.noreply.github.com> --- docs/user-guide/migrating-to-8.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index 4cb4cd8d798..0f7585ffb0b 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -160,7 +160,7 @@ Back in ESLint v4.0.0, we deprecated `SourceCode#getComments()`, but we neglecte The `SourceCode#getComments()` method will be removed in v9.0.0. -**To address:** If your rule uses `SourceCode#getComments()`, please use `SourceCode#getCommentsBefore()`, `SourceCode#getCommentsAfter()`, or ``SourceCode#getCommentsInside()`: +**To address:** If your rule uses `SourceCode#getComments()`, please use `SourceCode#getCommentsBefore()`, `SourceCode#getCommentsAfter()`, or `SourceCode#getCommentsInside()`: **Related issue(s):** [#14744](https://github.com/eslint/eslint/issues/14744) From 63067b51ca39c206c86c57e14593f59f90447f79 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 9 Aug 2021 10:48:59 -0700 Subject: [PATCH 03/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Kagami Sascha Rosylight --- docs/user-guide/migrating-to-8.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index 0f7585ffb0b..8efb6f876c8 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -68,7 +68,7 @@ With this configuration, the rule would ignore the third element in the array be **To address:** Change your rule configuration so that there are only two elements in the array, and the second element is either a string or an object, such as: -```json +```jsonc { "comma-dangle": ["error", "never"], // or From 345b32fe9cd05193bbc481548d97c2893244168a Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Wed, 11 Aug 2021 11:40:47 -0700 Subject: [PATCH 04/10] Add mention of Acorn AST change --- docs/user-guide/migrating-to-8.0.0.md | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index 8efb6f876c8..ebb931ff675 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -20,6 +20,7 @@ The lists below are ordered roughly by the number of users each change is expect - [Rules require `meta.hasSuggestions` to provide suggestions](#suggestions) - [Rules require `meta.fixable` to provide fixes](#fixes) - [`SourceCode#getComments()` fails in `RuleTester`](#get-comments) +- [Changes to shorthand property AST format](#ast-format) ### Breaking changes for integration developers @@ -164,6 +165,54 @@ The `SourceCode#getComments()` method will be removed in v9.0.0. **Related issue(s):** [#14744](https://github.com/eslint/eslint/issues/14744) +## Changes to shorthand property AST format + +ESLint v8.0.0 includes an upgrade to Espree v8.0.0 to support new syntax. This Espree upgrade, in turn, contains an upgrade to Acorn v8.0.0, which changed how shorthand properties were represented in the AST. Here's an example: + +```js +const version = 8; +const x = { + version +}; +``` + +This code creates a property node that looks like this: + +```json +{ + "type": "Property", + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "name": "version" + }, + "kind": "init", + "value": { + "type": "Identifier", + "name": "version" + } +} +``` + +Note that both the `key` and the `value` properties contain the same information. Prior to Acorn v8.0.0 (and therefore prior to ESLint v8.0.0), these two nodes were represented by the same object, so you could use `===` to determine if they represented the same node, such as: + +```js +// true in ESLint v7.x, false in ESLint v8.0.0 +if (propertyNode.key === propertyNode.value) { + // do something +} +``` + +In ESLint v8.0.0 (via Acorn v8.0.0), the key and value are now separate objects and therefore no longer equivalent. + +**To address:** If your rule makes a comparison between the key and value of a shorthand object literal property to determine if they are the same node, you'll need to change your code in one of two ways: + +1. Use `propertyNode.shorthand` to determine if the property is a shorthand property node. +1. Use the `range` property of each node to determine if the key and value occupy the same location. + +**Related issue(s):** [#14591](https://github.com/eslint/eslint/pull/14591#issuecomment-887733070) ## The `CLIEngine` class has been removed From 42b6d479d80bc56bc456d300b7d15757cffb1bcc Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 12 Aug 2021 13:11:22 -0700 Subject: [PATCH 05/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Bryan Mishkin <698306+bmish@users.noreply.github.com> --- docs/user-guide/migrating-to-8.0.0.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index ebb931ff675..adb64246729 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -151,6 +151,10 @@ module.exports = function(context) { }; ``` +The [eslint-plugin/require-meta-fixable](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-fixable.md) rule can automatically fix and enforce that your rules are properly specifying `meta.fixable`. + +The [eslint-plugin/prefer-object-rule](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-object-rule.md) rule can automatically fix and enforce that your rules are written with the object format instead of the deprecated function format. + See the [rule documentation](https://eslint.org/docs/developer-guide/working-with-rules) for more information on writing rules. **Related issue(s):** [#13349](https://github.com/eslint/eslint/issues/13349) From d1ca4f5ad44518861071e86506b224f7ff562080 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 12 Aug 2021 13:11:30 -0700 Subject: [PATCH 06/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Bryan Mishkin <698306+bmish@users.noreply.github.com> --- docs/user-guide/migrating-to-8.0.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index adb64246729..e7acef27b08 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -124,6 +124,8 @@ module.exports = { }; ``` +The [eslint-plugin/require-meta-has-suggestions](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-has-suggestions.md) rule can automatically fix and enforce that your rules are properly specifying `meta.hasSuggestions`. + **Related issue(s):** [#14312](https://github.com/eslint/eslint/issues/14312) ## Rules require `meta.fixable` to provide fixes From 1cfa84c32d367cea3f8a5da1760327861807432d Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 13 Aug 2021 17:29:31 -0700 Subject: [PATCH 07/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Brandon Mills --- docs/user-guide/migrating-to-8.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index e7acef27b08..47486e44582 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -4,7 +4,7 @@ ESLint v8.0.0 is a major release of ESLint. We have made a few breaking changes The lists below are ordered roughly by the number of users each change is expected to affect, where the first items are expected to affect the most users. -## Table of Content +## Table of Contents ### Breaking changes for users From e1d871948445501753d71cd70d8f1c4533c55f86 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 13 Aug 2021 17:29:40 -0700 Subject: [PATCH 08/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Brandon Mills --- docs/user-guide/migrating-to-8.0.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index 47486e44582..b1fd23da88c 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -25,7 +25,6 @@ The lists below are ordered roughly by the number of users each change is expect ### Breaking changes for integration developers - [Node.js 10, 13, and 15 are no longer supported](#drop-old-node) -- [Plugin resolution has been updated](#plugin-loading-change) - [The `CLIEngine` class has been removed](#remove-cliengine) - [The `linter` object has been removed](#remove-linter) - [The `/lib` entrypoint has been removed](#remove-lib) From 0c9564ed21b9dc57db07f953d1d41a81d578bfed Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 13 Aug 2021 17:29:54 -0700 Subject: [PATCH 09/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Brandon Mills --- docs/user-guide/migrating-to-8.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index b1fd23da88c..e020979505f 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -47,7 +47,7 @@ Node.js 10, 13, 15 all reached end of life either in 2020 or early 2021. ESLint ESLint v8.0.0 has removed the `codeframe` and `table` formatters from the core. These formatters required dependencies that weren't used anywhere else in ESLint, and removing them allows us to reduce the size of ESLint, allowing for faster installation. -**To address:** If you are using the `codeframe` or `table` formatters, you'll need to install the standalone `eslint-formatter-codeframe` or `eslint-formatter-table` packages, respectively, to be able to use them in ESLint v8.0.0. +**To address:** If you are using the `codeframe` or `table` formatters, you'll need to install the standalone [`eslint-formatter-codeframe`](https://github.com/fregante/eslint-formatter-codeframe) or [`eslint-formatter-table`](https://github.com/fregante/eslint-formatter-table) packages, respectively, to be able to use them in ESLint v8.0.0. **Related issue(s):** [#14277](https://github.com/eslint/eslint/issues/14277), [#14316](https://github.com/eslint/eslint/pull/14316) From 150d829019344b18ae4afc7a500d9e467e22dd7f Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 13 Aug 2021 17:30:05 -0700 Subject: [PATCH 10/10] Update docs/user-guide/migrating-to-8.0.0.md Co-authored-by: Brandon Mills --- docs/user-guide/migrating-to-8.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/migrating-to-8.0.0.md b/docs/user-guide/migrating-to-8.0.0.md index e020979505f..6489ce53327 100644 --- a/docs/user-guide/migrating-to-8.0.0.md +++ b/docs/user-guide/migrating-to-8.0.0.md @@ -166,7 +166,7 @@ Back in ESLint v4.0.0, we deprecated `SourceCode#getComments()`, but we neglecte The `SourceCode#getComments()` method will be removed in v9.0.0. -**To address:** If your rule uses `SourceCode#getComments()`, please use `SourceCode#getCommentsBefore()`, `SourceCode#getCommentsAfter()`, or `SourceCode#getCommentsInside()`: +**To address:** If your rule uses `SourceCode#getComments()`, please use [`SourceCode#getCommentsBefore()`, `SourceCode#getCommentsAfter()`, or `SourceCode#getCommentsInside()`](https://eslint.org/docs/developer-guide/working-with-rules#sourcecodegetcommentsbefore-sourcecodegetcommentsafter-and-sourcecodegetcommentsinside). **Related issue(s):** [#14744](https://github.com/eslint/eslint/issues/14744)