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 exported and string config notes to migrate to v9 guide #17926

Merged
merged 4 commits into from
Dec 29, 2023
Merged
Changes from all commits
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
54 changes: 54 additions & 0 deletions docs/src/use/migrate-to-9.0.0.md
Expand Up @@ -23,6 +23,8 @@ The lists below are ordered roughly by the number of users each change is expect
* [`no-constructor-return` and `no-sequences` rule schemas are stricter](#stricter-rule-schemas)
* [New checks in `no-implicit-coercion` by default](#no-implicit-coercion)
* [Case-sensitive flags in `no-invalid-regexp`](#no-invalid-regexp)
* [Stricter `/* exported */` parsing](#exported-parsing)
* [`"eslint:recommended"` and `"eslint:all"` strings no longer accepted in flat config](#string-config)

### Breaking changes for plugin developers

Expand Down Expand Up @@ -150,6 +152,58 @@ In ESLint v9.0.0, the option `allowConstructorFlags` is now case-sensitive.

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

## <a name="exported-parsing"></a> Stricter `/* exported */` parsing

Prior to ESLint v9.0.0, the `/* exported */` directive incorrectly allowed the following syntax:

```js
/* exported foo: true, bar: false */

// and

/* exported foo bar */
```

The `true` and `false` in this example had no effect on ESLint's behavior, and in fact, was a parsing bug.

In ESLint v9.0.0, any `/* exported */` variables followed by a colon and value will be ignored as invalid.

**To address:** Update any `/* exported */` directives to eliminate the colons and subsequent values, and ensure there are commas between variable names such as:

```js
/* exported foo, bar */
```

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

## <a name="string-config"></a> `"eslint:recommended"` and `"eslint:all"` no longer accepted in flat config

In ESLint v8.x, `eslint.config.js` could refer to `"eslint:recommended"` and `"eslint:all"` configurations by inserting a string into the config array, as in this example:

```js
// eslint.config.js
export default [
"eslint:recommended",
"eslint:all"
];
```

In ESLint v9.0.0, this format is no longer supported and will result in an error.

**To address:** Use the `@eslint/js` package instead:

```js
// eslint.config.js
import js from "@eslint/js";

export default [
js.configs.recommended,
js.configs.all
];
```

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

## <a name="removed-context-methods"></a> Removed multiple `context` methods

ESLint v9.0.0 removes multiple deprecated methods from the `context` object and moves them onto the `SourceCode` object:
Expand Down