Skip to content

Commit aa3fb2b

Browse files
authored
fix!: tighten func-names schema (#20119)
* fix: tighten `func-names` schema * update migration guide
1 parent cb51ec2 commit aa3fb2b

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The lists below are ordered roughly by the number of users each change is expect
2121
- [`eslint:recommended` has been updated](#eslint-recommended)
2222
- [Jiti < v2.2.0 are no longer supported](#drop-old-jiti)
2323
- [`eslint-env` comments are reported as errors](#eslint-env-comments)
24+
- [`func-names` schema is stricter](#func-names)
2425

2526
### Breaking changes for plugin developers
2627

@@ -129,3 +130,21 @@ error: /* eslint-env */ comments are no longer supported at file.js:1:1:
129130
**To address:** Remove any `eslint-env` comments from your code. If you are still using the old configuration system and need help migrating, check the [migration guide](./configure/migration-guide#eslint-env-configuration-comments).
130131

131132
**Related issue(s):** [#13481](https://github.com/eslint/eslint/issues/13481)
133+
134+
## <a name="func-names"></a> `func-names` schema is stricter
135+
136+
In ESLint v10, the [`func-names`](../rules/func-names) rule schema now disallows extra items in the options array. Previously, configurations that included additional array elements beyond the allowed options were accepted but ignored. Such configurations are now considered invalid.
137+
138+
For example, this configuration is now invalid due to the extra element `"foo"`:
139+
140+
```js
141+
/*eslint func-names: ["error", "always", { "generators": "never" }, "foo"]*/
142+
```
143+
144+
**To address:**
145+
146+
- Remove any extra array elements from your `func-names` configuration so that it contains only:
147+
- a base string option: `"always" | "as-needed" | "never"`, and
148+
- optionally, an object option: `{ "generators": "always" | "as-needed" | "never" }`.
149+
150+
**Related issue(s):** [#20134](https://github.com/eslint/eslint/issues/20134)

lib/rules/func-names.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports = {
4343
enum: ["always", "as-needed", "never"],
4444
},
4545
},
46+
type: "array",
4647
items: [
4748
{
4849
$ref: "#/definitions/value",
@@ -57,6 +58,7 @@ module.exports = {
5758
additionalProperties: false,
5859
},
5960
],
61+
additionalItems: false,
6062
},
6163

6264
messages: {

0 commit comments

Comments
 (0)