Skip to content

Commit 12dd6ce

Browse files
antoinezanardicamc314
authored andcommitted
refactor(eqeqeq): enhance documentation and improve error handling for operator checks
1 parent 140b100 commit 12dd6ce

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crates/oxc_linter/src/rules/eslint/eqeqeq.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pub struct Eqeqeq {
2727
declare_oxc_lint!(
2828
/// ### What it does
2929
///
30-
/// Requires the use of the `===` and `!==` operators.
31-
/// This rule disallows `==` and `!=`.
30+
/// Requires the use of the `===` and `!==` operators, disallowing the use of `==` and `!=`.
3231
///
3332
/// ### Why is this bad?
3433
///
@@ -138,9 +137,6 @@ declare_oxc_lint!(
138137
///
139138
/// #### `{"null": "never"}` (with `"always"` first option)
140139
///
141-
/// Note: ESLint's official accepted values are `"always"` and `"ignore"`. `"never"` is not an ESLint value;
142-
/// the examples below treat `"never"` as a custom extension to illustrate the concept of enforcing `== null` and `!= null`.
143-
///
144140
/// Examples of **incorrect** code for this rule with the `{ "null": "never" }` option:
145141
/// ```js
146142
/// /* eslint eqeqeq: ["error", "always", { "null": "never" }] */
@@ -312,7 +308,9 @@ fn to_strict_eq_operator_str(operator: BinaryOperator) -> (&'static str, &'stati
312308
match operator {
313309
BinaryOperator::Equality => ("===", " === "),
314310
BinaryOperator::Inequality => ("!==", " !== "),
315-
_ => unreachable!("Unexpected operator passed to to_strict_eq_operator_str"),
311+
_ => unreachable!(
312+
"Only Equality and Inequality operators are supported in to_strict_eq_operator_str"
313+
),
316314
}
317315
}
318316

0 commit comments

Comments
 (0)