Skip to content

Commit

Permalink
docs: Add exported and string config notes to migrate to v9 guide
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Dec 29, 2023
1 parent 3ae50cc commit 2906624
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions docs/src/use/migrate-to-9.0.0.md
Original file line number Diff line number Diff line change
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"` invalid in flat config](#string-config)

### Breaking changes for plugin developers

Expand Down Expand Up @@ -150,6 +152,50 @@ 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 */
```

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.

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

## <a name="string-config"></a> `"eslint:recommended"` and `"eslint:all"` invalid 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

0 comments on commit 2906624

Please sign in to comment.