-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
What rule do you want to change?
func-style
What change do you want to make?
Generate fewer warnings
How do you think the change should be implemented?
A new default behavior
Example code
/* eslint func-style: "error" */
// func-style report: Expected a function expression.
function noOverloads() {}
// No func-style report
function hasOverloads(value: string): string
function hasOverloads(value: number): number
function hasOverloads(value: unknown) {
return value;
}
What does the rule currently do for this code?
Expected a function expression. 9:1 - 11:2
What will the rule do after it's changed?
Not report on the function declaration.
Participation
- I am willing to submit a pull request to implement this change.
Additional comments
Quoting #19719 (comment):
I would take JoshuaKGoldberg's suggestion a step further and always allow overloaded function declarations. Don’t even add the option to report it. Otherwise it’s simply a TypeScript error.
function hasOverloads(value: string): string function hasOverloads(value: number): number var hasOverloads = function(value: unknown) { return value; }If there’s user demand, there could be a rule to disallow TypeScript function overloads. But IMO that feels out of scope for
func-style
.
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Type
Projects
Status
Complete