Skip to content

Commit d499400

Browse files
committed
refactor(linter/jsx-handler-names): simplify option checks for inline functions and local variables (#13405)
1 parent 62da550 commit d499400

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

crates/oxc_linter/src/rules/react/jsx_handler_names.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,13 @@ impl Rule for JsxHandlerNames {
205205
event_handler_prop_prefixes = s;
206206
}
207207
}
208-
if let Some(raw) = options.get("checkInlineFunction") {
209-
if let Some(v) = raw.as_bool() {
210-
check_inline_functions = v;
211-
}
208+
if let Some(v) = options.get("checkInlineFunction").and_then(serde_json::Value::as_bool)
209+
{
210+
check_inline_functions = v;
212211
}
213-
if let Some(raw) = options.get("checkLocalVariables") {
214-
if let Some(v) = raw.as_bool() {
215-
check_local_variables = v;
216-
}
212+
if let Some(v) = options.get("checkLocalVariables").and_then(serde_json::Value::as_bool)
213+
{
214+
check_local_variables = v;
217215
}
218216
if let Some(names) = options.get("ignoreComponentNames") {
219217
if let Some(arr) = names.as_array() {

0 commit comments

Comments
 (0)