Skip to content

Commit

Permalink
change: [unified-signatures] check every b.params[i]
Browse files Browse the repository at this point in the history
  • Loading branch information
u-abyss committed Apr 22, 2023
1 parent 0e31dbe commit 47286f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 1 addition & 3 deletions packages/eslint-plugin/src/rules/unified-signatures.ts
Expand Up @@ -213,11 +213,9 @@ export default util.createRule<Options, MessageIds>({
b.typeParameters !== undefined ? b.typeParameters.params : undefined;

if (ignoreDifferentlyNamedParameters) {
if (b.params.length === 0) {
return false;
}
for (let i = 0; i < a.params.length; i += 1) {
if (
b.params[i] &&
a.params[i].type === b.params[i].type &&
getStaticParameterName(a.params[i]) !==
getStaticParameterName(b.params[i])
Expand Down
7 changes: 7 additions & 0 deletions packages/eslint-plugin/tests/rules/unified-signatures.test.ts
Expand Up @@ -184,6 +184,13 @@ function f(): string;
},
{
code: `
function f(v: boolean, u: boolean): number;
function f(v: boolean): string;
`,
options: [{ ignoreDifferentlyNamedParameters: true }],
},
{
code: `
function f(v: number, u?: string): void {}
function f(v: number): void;
function f(): string;
Expand Down

0 comments on commit 47286f7

Please sign in to comment.