Skip to content

Commit fa924ab

Browse files
authored
docs(linter): cleanup docs for multiple linter rules (oxc-project#11551)
1 parent 3952e01 commit fa924ab

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fn no_magic_number_diagnostic(span: Span, raw: &str) -> OxcDiagnostic {
2424
}
2525

2626
#[derive(Debug, Default, Clone)]
27-
2827
pub struct NoMagicNumbers(Box<NoMagicNumbersConfig>);
2928

3029
impl std::ops::Deref for NoMagicNumbers {
@@ -66,7 +65,7 @@ impl TryFrom<&serde_json::Value> for NoMagicNumbersConfig {
6665
raw.get(0).map_or_else(
6766
|| {
6867
Err(OxcDiagnostic::warn(
69-
"Expecting object for typescript/no-magic-numbers configuration",
68+
"Expecting object for eslint/no-magic-numbers configuration",
7069
))
7170
},
7271
|object| {
@@ -116,7 +115,7 @@ impl TryFrom<&serde_json::Value> for NoMagicNumbersConfig {
116115
declare_oxc_lint!(
117116
/// ### What it does
118117
///
119-
/// The no-magic-numbers rule aims to make code more readable and refactoring easier by ensuring that special numbers are declared as constants to make their meaning explicit.
118+
/// This rule aims to make code more readable and refactoring easier by ensuring that special numbers are declared as constants to make their meaning explicit.
120119
/// The current implementation does not support BigInt numbers inside array indexes.
121120
///
122121
/// ### Why is this bad?
@@ -127,7 +126,6 @@ declare_oxc_lint!(
127126
///
128127
/// Examples of **incorrect** code for this rule:
129128
/// ```javascript
130-
///
131129
/// var dutyFreePrice = 100;
132130
/// var finalPrice = dutyFreePrice + (dutyFreePrice * 0.25);
133131
/// ```

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ declare_oxc_lint!(
3131
///
3232
/// Examples of **incorrect** code for this rule:
3333
/// ```javascript
34-
///
3534
/// if (!a) {
3635
/// doSomethingC();
3736
/// } else {

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ declare_oxc_lint!(
1919
///
2020
/// ### Why is this bad?
2121
///
22+
/// Using undefined directly can lead to bugs, since it can be shadowed or overwritten in JavaScript.
23+
/// It's safer and more intentional to use null or rely on implicit undefined (e.g., missing return) to avoid accidental issues.
2224
///
23-
/// ### Example of bad code
24-
/// ```javascript
25+
/// ### Examples
2526
///
27+
/// Examples of **incorrect** code for this rule:
28+
/// ```javascript
2629
/// var foo = undefined;
2730
///
2831
/// var undefined = "foo";
@@ -38,7 +41,7 @@ declare_oxc_lint!(
3841
/// bar(undefined, "lorem");
3942
/// ```
4043
///
41-
/// ### Example of good code
44+
/// Examples of **correct** code for this rule:
4245
/// ```javascript
4346
/// var foo = void 0;
4447
///

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ declare_oxc_lint!(
5656
/// typeof bar == "undefined"
5757
/// typeof foo === baz
5858
/// typeof bar === typeof qux
59-
/// ```js
59+
/// ```
6060
///
6161
/// ### Options
6262
///

0 commit comments

Comments
 (0)