mirror of
https://github.com/danbulant/oxc
synced 2026-05-22 05:38:54 +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,
|
call_expr: &'a CallExpression,
|
||||||
position: usize,
|
position: usize,
|
||||||
) -> Option<&'a str> {
|
) -> Option<&'a str> {
|
||||||
match &call_expr.arguments[0] {
|
call_expr.arguments.first().and_then(|argument| match argument {
|
||||||
Argument::ArrowFunctionExpression(arrow_fn_expr) => {
|
Argument::ArrowFunctionExpression(arrow_fn_expr) => {
|
||||||
return Some(
|
Some(arrow_fn_expr.params.items.get(position)?.pattern.get_identifier()?.as_str())
|
||||||
arrow_fn_expr.params.items.get(position)?.pattern.get_identifier()?.as_str(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Argument::FunctionExpression(regular_fn_expr) => {
|
Argument::FunctionExpression(regular_fn_expr) => {
|
||||||
return Some(
|
Some(regular_fn_expr.params.items.get(position)?.pattern.get_identifier()?.as_str())
|
||||||
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! {
|
const SECOND_INDEX_METHODS: phf::Set<&'static str> = phf::phf_set! {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue