Skip to content

Commit 0831b58

Browse files
mdjermanovicnzakas
andauthored
docs: add rule changes to v9 migration guide (#17925)
* docs: add rule changes to v9 migration guide * add related issue * Update docs/src/use/migrate-to-9.0.0.md Co-authored-by: Nicholas C. Zakas <[email protected]> * Update docs/src/use/migrate-to-9.0.0.md Co-authored-by: Nicholas C. Zakas <[email protected]> --------- Co-authored-by: Nicholas C. Zakas <[email protected]>
1 parent 946ae00 commit 0831b58

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

docs/src/use/migrate-to-9.0.0.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ The lists below are ordered roughly by the number of users each change is expect
2020
* [Removed multiple formatters](#removed-formatters)
2121
* [Removed `require-jsdoc` and `valid-jsdoc` rules](#remove-jsdoc-rules)
2222
* [`eslint:recommended` has been updated](#eslint-recommended)
23+
* [`no-constructor-return` and `no-sequences` rule schemas are stricter](#stricter-rule-schemas)
24+
* [New checks in `no-implicit-coercion` by default](#no-implicit-coercion)
25+
* [Case-sensitive flags in `no-invalid-regexp`](#no-invalid-regexp)
2326

2427
### Breaking changes for plugin developers
2528

@@ -95,6 +98,57 @@ Additionally, the following rules have been removed from `eslint:recommended`:
9598

9699
**Related issue(s):** [#15576](https://github.com/eslint/eslint/issues/15576), [#17446](https://github.com/eslint/eslint/issues/17446), [#17596](https://github.com/eslint/eslint/issues/17596)
97100

101+
## <a name="stricter-rule-schemas"></a> `no-constructor-return` and `no-sequences` rule schemas are stricter
102+
103+
In previous versions of ESLint, `no-constructor-return` and `no-sequences` rules were mistakenly accepting invalid options.
104+
105+
This has been fixed in ESLint v9.0.0:
106+
107+
* The `no-constructor-return` rule does not accept any options.
108+
* The `no-sequences` rule can take one option, an object with a property `"allowInParentheses"` (boolean).
109+
110+
```json
111+
{
112+
"rules": {
113+
"no-constructor-return": ["error"],
114+
"no-sequences": ["error", { "allowInParentheses": false }]
115+
}
116+
}
117+
```
118+
119+
**To address:** If ESLint reports invalid configuration for any of these rules, update your configuration.
120+
121+
**Related issue(s):** [#16879](https://github.com/eslint/eslint/issues/16879)
122+
123+
## <a name="no-implicit-coercion"></a> New checks in `no-implicit-coercion` by default
124+
125+
In ESLint v9.0.0, the `no-implicit-coercion` rule additionally reports the following cases by default:
126+
127+
```js
128+
-(-foo);
129+
foo - 0;
130+
```
131+
132+
**To address:** If you want to retain the previous behavior of this rule, set `"allow": ["-", "- -"]`.
133+
134+
```json
135+
{
136+
"rules": {
137+
"no-implicit-coercion": [2, { "allow": ["-", "- -"] } ],
138+
}
139+
}
140+
```
141+
142+
**Related issue(s):** [#17832](https://github.com/eslint/eslint/pull/17832)
143+
144+
## <a name="no-invalid-regexp"></a> Case-sensitive flags in `no-invalid-regexp`
145+
146+
In ESLint v9.0.0, the option `allowConstructorFlags` is now case-sensitive.
147+
148+
**To address:** Update your configuration if needed.
149+
150+
**Related issue(s):** [#16574](https://github.com/eslint/eslint/issues/16574)
151+
98152
## <a name="removed-context-methods"></a> Removed multiple `context` methods
99153

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

0 commit comments

Comments
 (0)