Skip to content

Commit

Permalink
reduce nessting a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
todor-a committed May 11, 2024
1 parent 2ecd2c2 commit f799919
Showing 1 changed file with 21 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,16 @@ impl Rule for ConsistentIndexedObjectStyle {
}
}
}
}

if self.is_index_signature {
if let TSType::TSTypeReference(tref) = &return_type.type_annotation
{
if let TSTypeName::IdentifierReference(r) = &tref.type_name {
if r.name == "Record" {
ctx.diagnostic(ConsistentIndexedObjectStyleDiagnostic(
"index signature",
"record",
tref.span,
));
}
} else if let TSType::TSTypeReference(tref) =
&return_type.type_annotation
{
if let TSTypeName::IdentifierReference(r) = &tref.type_name {
if r.name == "Record" {
ctx.diagnostic(ConsistentIndexedObjectStyleDiagnostic(
"index signature",
"record",
tref.span,
));
}
}
}
Expand All @@ -307,23 +304,16 @@ impl Rule for ConsistentIndexedObjectStyle {
}
}
}
}

if self.is_index_signature {
if let TSType::TSTypeReference(tref) =
&ts_type_annotation.type_annotation
{
if let TSTypeName::IdentifierReference(r) = &tref.type_name
{
if r.name == "Record" {
ctx.diagnostic(
ConsistentIndexedObjectStyleDiagnostic(
"index signature",
"record",
tref.span,
),
);
}
} else if let TSType::TSTypeReference(tref) =
&ts_type_annotation.type_annotation
{
if let TSTypeName::IdentifierReference(r) = &tref.type_name {
if r.name == "Record" {
ctx.diagnostic(ConsistentIndexedObjectStyleDiagnostic(
"index signature",
"record",
tref.span,
));
}
}
}
Expand All @@ -332,6 +322,7 @@ impl Rule for ConsistentIndexedObjectStyle {
}
}
}

_ => {}
}
}
Expand Down

0 comments on commit f799919

Please sign in to comment.