mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 20:28:58 +00:00
fix(linter): fix panic in react/no-array-index-key (#7395)
This commit is contained in:
parent
c34d649176
commit
e91c2878d8
1 changed files with 5 additions and 13 deletions
|
|
@ -144,23 +144,15 @@ fn find_index_param_name_by_position<'a>(
|
|||
call_expr: &'a CallExpression,
|
||||
position: usize,
|
||||
) -> Option<&'a str> {
|
||||
match &call_expr.arguments[0] {
|
||||
call_expr.arguments.first().and_then(|argument| match argument {
|
||||
Argument::ArrowFunctionExpression(arrow_fn_expr) => {
|
||||
return Some(
|
||||
arrow_fn_expr.params.items.get(position)?.pattern.get_identifier()?.as_str(),
|
||||
);
|
||||
Some(arrow_fn_expr.params.items.get(position)?.pattern.get_identifier()?.as_str())
|
||||
}
|
||||
|
||||
Argument::FunctionExpression(regular_fn_expr) => {
|
||||
return Some(
|
||||
regular_fn_expr.params.items.get(position)?.pattern.get_identifier()?.as_str(),
|
||||
);
|
||||
Some(regular_fn_expr.params.items.get(position)?.pattern.get_identifier()?.as_str())
|
||||
}
|
||||
|
||||
_ => (),
|
||||
}
|
||||
|
||||
None
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
const SECOND_INDEX_METHODS: phf::Set<&'static str> = phf::phf_set! {
|
||||
|
|
|
|||
Loading…
Reference in a new issue