diff --git a/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap b/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap index 5963b6778b51d..2e0cc9779b9e4 100644 --- a/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_--ignore-path fixtures__linter__.customignore --no-ignore fixtures__linter__nan.js@oxlint.snap @@ -13,12 +13,12 @@ working directory: `---- help: Consider using this expression or removing it - ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html\eslint(use-isnan)]8;;\: Requires calls to isNaN() when checking for NaN + ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html\eslint(use-isnan)]8;;\: Requires calls to `isNaN()` when checking for NaN ,-[fixtures/linter/nan.js:1:8] 1 | 123 == NaN; : ^^^ `---- - help: Use the isNaN function to compare with NaN. + help: Use the `isNaN` function to compare with NaN. Found 2 warnings and 0 errors. Finished in ms on 1 file with 89 rules using 1 threads. diff --git a/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap index a62371fe919d5..70f43ccde0e36 100644 --- a/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__linter@oxlint.snap @@ -28,12 +28,12 @@ working directory: `---- help: Consider using this expression or removing it - ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html\eslint(use-isnan)]8;;\: Requires calls to isNaN() when checking for NaN + ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html\eslint(use-isnan)]8;;\: Requires calls to `isNaN()` when checking for NaN ,-[fixtures/linter/nan.js:1:8] 1 | 123 == NaN; : ^^^ `---- - help: Use the isNaN function to compare with NaN. + help: Use the `isNaN` function to compare with NaN. Found 4 warnings and 0 errors. Finished in ms on 3 files with 89 rules using 1 threads. diff --git a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap index 2b039c9853c93..33b39d57d01a1 100644 --- a/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap +++ b/apps/oxlint/src/snapshots/_fixtures__linter__debugger.js fixtures__linter__nan.js@oxlint.snap @@ -20,12 +20,12 @@ working directory: `---- help: Consider using this expression or removing it - ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html\eslint(use-isnan)]8;;\: Requires calls to isNaN() when checking for NaN + ! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html\eslint(use-isnan)]8;;\: Requires calls to `isNaN()` when checking for NaN ,-[fixtures/linter/nan.js:1:8] 1 | 123 == NaN; : ^^^ `---- - help: Use the isNaN function to compare with NaN. + help: Use the `isNaN` function to compare with NaN. Found 3 warnings and 0 errors. Finished in ms on 2 files with 89 rules using 1 threads. diff --git a/crates/oxc_linter/src/rules/eslint/no_self_compare.rs b/crates/oxc_linter/src/rules/eslint/no_self_compare.rs index 539f9e3c510ca..8ce7e937d435b 100644 --- a/crates/oxc_linter/src/rules/eslint/no_self_compare.rs +++ b/crates/oxc_linter/src/rules/eslint/no_self_compare.rs @@ -7,7 +7,7 @@ use crate::{AstNode, context::LintContext, rule::Rule}; fn no_self_compare_diagnostic(left_span: Span, right_span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Both sides of this comparison are exactly the same") - .with_help("If you are testing for NaN, you can use Number.isNaN function.") + .with_help("If you are testing for NaN, you can use the `Number.isNaN()` function.") .with_labels([left_span, right_span]) } diff --git a/crates/oxc_linter/src/rules/eslint/no_shadow_restricted_names.rs b/crates/oxc_linter/src/rules/eslint/no_shadow_restricted_names.rs index 77da65a1a7329..0327a730525ee 100644 --- a/crates/oxc_linter/src/rules/eslint/no_shadow_restricted_names.rs +++ b/crates/oxc_linter/src/rules/eslint/no_shadow_restricted_names.rs @@ -9,7 +9,7 @@ use serde_json::Value; const PRE_DEFINE_VAR: [&str; 5] = ["Infinity", "NaN", "arguments", "eval", "undefined"]; fn no_shadow_restricted_names_diagnostic(shadowed_name: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Shadowing of global properties such as 'undefined' is not allowed.") + OxcDiagnostic::warn("Shadowing of global properties such as `undefined` is not allowed.") .with_help(format!("Rename '{shadowed_name}' to avoid shadowing the global property.")) .with_label(span) } diff --git a/crates/oxc_linter/src/rules/eslint/no_this_before_super.rs b/crates/oxc_linter/src/rules/eslint/no_this_before_super.rs index d15be2d8be3a4..527c06bb65a4f 100644 --- a/crates/oxc_linter/src/rules/eslint/no_this_before_super.rs +++ b/crates/oxc_linter/src/rules/eslint/no_this_before_super.rs @@ -15,8 +15,8 @@ use rustc_hash::{FxHashMap, FxHashSet}; use crate::{AstNode, context::LintContext, rule::Rule}; fn no_this_before_super_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Expected to always call super() before this/super property access.") - .with_help("Call super() before this/super property access.") + OxcDiagnostic::warn("Expected to always call `super()` before `this`/`super` property access.") + .with_help("Call `super()` before `this`/`super` property access.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/eslint/no_unsafe_finally.rs b/crates/oxc_linter/src/rules/eslint/no_unsafe_finally.rs index 9e0d0ef1c3475..297a8081bf15d 100644 --- a/crates/oxc_linter/src/rules/eslint/no_unsafe_finally.rs +++ b/crates/oxc_linter/src/rules/eslint/no_unsafe_finally.rs @@ -9,8 +9,10 @@ use oxc_span::{GetSpan, Span}; use crate::{AstNode, context::LintContext, rule::Rule}; fn no_unsafe_finally_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Unsafe finally block") - .with_help("Control flow inside try or catch blocks will be overwritten by this statement") + OxcDiagnostic::warn("Unsafe `finally` block.") + .with_help( + "Control flow inside `try` or `catch` blocks will be overwritten by this statement.", + ) .with_label(span) } @@ -20,7 +22,7 @@ pub struct NoUnsafeFinally; declare_oxc_lint!( /// ### What it does /// - /// Disallow control flow statements in finally blocks + /// Disallow control flow statements in `finally` blocks. /// /// ### Why is this bad? /// diff --git a/crates/oxc_linter/src/rules/eslint/use_isnan.rs b/crates/oxc_linter/src/rules/eslint/use_isnan.rs index a10c13916ad8b..f740f70634689 100644 --- a/crates/oxc_linter/src/rules/eslint/use_isnan.rs +++ b/crates/oxc_linter/src/rules/eslint/use_isnan.rs @@ -11,27 +11,27 @@ use schemars::JsonSchema; use crate::{AstNode, context::LintContext, rule::Rule}; fn comparison_with_na_n(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to isNaN() when checking for NaN") - .with_help("Use the isNaN function to compare with NaN.") + OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN") + .with_help("Use the `isNaN` function to compare with NaN.") .with_label(span) } fn switch_na_n(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to isNaN() when checking for NaN") + OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN.") .with_help( - "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch.", + "`switch(NaN)` can never match a case clause. Use `Number.isNaN` instead of the switch.", ) .with_label(span) } fn case_na_n(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to isNaN() when checking for NaN") - .with_help("'case NaN' can never match. Use Number.isNaN before the switch.") + OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN") + .with_help("`case NaN` can never match. Use `Number.isNaN` before the switch.") .with_label(span) } fn index_of_na_n(method_name: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Requires calls to isNaN() when checking for NaN") + OxcDiagnostic::warn("Requires calls to `isNaN()` when checking for NaN") .with_help(format!("Array prototype method '{method_name}' cannot find NaN.")) .with_label(span) } diff --git a/crates/oxc_linter/src/rules/import/default.rs b/crates/oxc_linter/src/rules/import/default.rs index 08a830fcdc445..dee87a4a52f25 100644 --- a/crates/oxc_linter/src/rules/import/default.rs +++ b/crates/oxc_linter/src/rules/import/default.rs @@ -6,7 +6,7 @@ use crate::{context::LintContext, module_record::ImportImportName, rule::Rule}; fn default_diagnostic(imported_name: &str, span: Span) -> OxcDiagnostic { OxcDiagnostic::warn(format!("No default export found in imported module {imported_name:?}")) - .with_help(format!("does {imported_name:?} have the default export?")) + .with_help(format!("Does {imported_name:?} have the default export?")) .with_label(span) } diff --git a/crates/oxc_linter/src/rules/import/named.rs b/crates/oxc_linter/src/rules/import/named.rs index 0fa35ac4e5ec5..e3d1f1f2505cb 100644 --- a/crates/oxc_linter/src/rules/import/named.rs +++ b/crates/oxc_linter/src/rules/import/named.rs @@ -10,7 +10,7 @@ use crate::{ fn named_diagnostic(imported_name: &str, module_name: &str, span: Span) -> OxcDiagnostic { OxcDiagnostic::warn(format!("named import {imported_name:?} not found")) - .with_help(format!("does {module_name:?} have the export {imported_name:?}?")) + .with_help(format!("Does {module_name:?} have the export {imported_name:?}?")) .with_label(span) } diff --git a/crates/oxc_linter/src/rules/import/no_empty_named_blocks.rs b/crates/oxc_linter/src/rules/import/no_empty_named_blocks.rs index 19b02ed8e588c..4c873b2ac4f12 100644 --- a/crates/oxc_linter/src/rules/import/no_empty_named_blocks.rs +++ b/crates/oxc_linter/src/rules/import/no_empty_named_blocks.rs @@ -6,7 +6,7 @@ use oxc_span::Span; use crate::{AstNode, context::LintContext, rule::Rule}; fn no_empty_named_blocks_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Unexpected empty named import block.").with_label(span) + OxcDiagnostic::warn("Unexpected empty named `import` block.").with_label(span) } #[derive(Debug, Default, Clone)] diff --git a/crates/oxc_linter/src/rules/import/no_self_import.rs b/crates/oxc_linter/src/rules/import/no_self_import.rs index 2cfd164f21e02..006cea81d8d08 100644 --- a/crates/oxc_linter/src/rules/import/no_self_import.rs +++ b/crates/oxc_linter/src/rules/import/no_self_import.rs @@ -5,7 +5,7 @@ use oxc_span::Span; use crate::{context::LintContext, rule::Rule}; fn no_self_import_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("module importing itself is not allowed").with_label(span) + OxcDiagnostic::warn("A module importing itself is not allowed").with_label(span) } #[derive(Debug, Default, Clone)] diff --git a/crates/oxc_linter/src/rules/jsdoc/check_access.rs b/crates/oxc_linter/src/rules/jsdoc/check_access.rs index ba24611c27c05..a8874eae0d5bb 100644 --- a/crates/oxc_linter/src/rules/jsdoc/check_access.rs +++ b/crates/oxc_linter/src/rules/jsdoc/check_access.rs @@ -13,7 +13,7 @@ fn invalid_access_level(span: Span) -> OxcDiagnostic { fn redundant_access_tags(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn( - "Mixing of @access with @public, @private, @protected, or @package on the same doc block.", + "Mixing of `@access` with `@public`, `@private`, `@protected`, or `@package` on the same doc block.", ) .with_help("There should be only one instance of access tag in a JSDoc comment.") .with_label(span) diff --git a/crates/oxc_linter/src/rules/jsdoc/check_property_names.rs b/crates/oxc_linter/src/rules/jsdoc/check_property_names.rs index 801813c48ca0f..93db2c1ae2145 100644 --- a/crates/oxc_linter/src/rules/jsdoc/check_property_names.rs +++ b/crates/oxc_linter/src/rules/jsdoc/check_property_names.rs @@ -10,8 +10,8 @@ use crate::{ }; fn no_root(span: Span, x1: &str) -> OxcDiagnostic { - OxcDiagnostic::warn("No root defined for @property path.") - .with_help(format!("@property path declaration `{x1}` appears before any real property.")) + OxcDiagnostic::warn("No root defined for `@property` path.") + .with_help(format!("`@property` path declaration `{x1}` appears before any real property.")) .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsdoc/require_property_description.rs b/crates/oxc_linter/src/rules/jsdoc/require_property_description.rs index b32bd0c6f23f6..b42ce00241bc0 100644 --- a/crates/oxc_linter/src/rules/jsdoc/require_property_description.rs +++ b/crates/oxc_linter/src/rules/jsdoc/require_property_description.rs @@ -9,8 +9,8 @@ use crate::{ }; fn require_property_description_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Missing description in @property tag.") - .with_help("Add a description to this @property tag.") + OxcDiagnostic::warn("Missing description in `@property` tag.") + .with_help("Add a description to this `@property` tag.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsdoc/require_property_name.rs b/crates/oxc_linter/src/rules/jsdoc/require_property_name.rs index 5de27619e6fe9..d329aa2528e0e 100644 --- a/crates/oxc_linter/src/rules/jsdoc/require_property_name.rs +++ b/crates/oxc_linter/src/rules/jsdoc/require_property_name.rs @@ -9,8 +9,8 @@ use crate::{ }; fn require_property_name_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Missing name in @property tag.") - .with_help("Add a type name to this @property tag.") + OxcDiagnostic::warn("Missing name in `@property` tag.") + .with_help("Add a type name to this `@property` tag.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsdoc/require_property_type.rs b/crates/oxc_linter/src/rules/jsdoc/require_property_type.rs index 180235b379c54..6803e2746c577 100644 --- a/crates/oxc_linter/src/rules/jsdoc/require_property_type.rs +++ b/crates/oxc_linter/src/rules/jsdoc/require_property_type.rs @@ -9,8 +9,8 @@ use crate::{ }; fn require_property_type_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Missing type in @property tag.") - .with_help("Add a {type} to this @property tag.") + OxcDiagnostic::warn("Missing type in `@property` tag.") + .with_help("Add a {type} to this `@property` tag.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/aria_unsupported_elements.rs b/crates/oxc_linter/src/rules/jsx_a11y/aria_unsupported_elements.rs index c541779f9c9a3..d9acfe5c6f947 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/aria_unsupported_elements.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/aria_unsupported_elements.rs @@ -45,7 +45,7 @@ declare_oxc_lint!( pub struct AriaUnsupportedElements; fn aria_unsupported_elements_diagnostic(span: Span, attr_name: &str) -> OxcDiagnostic { - OxcDiagnostic::warn("This element does not support ARIA roles, states and properties.") + OxcDiagnostic::warn("This element does not support ARIA roles, states, or properties.") .with_help(format!("Try removing the prop `{attr_name}`.")) .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/autocomplete_valid.rs b/crates/oxc_linter/src/rules/jsx_a11y/autocomplete_valid.rs index 1b6102675e050..61d423e32e734 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/autocomplete_valid.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/autocomplete_valid.rs @@ -17,8 +17,8 @@ use crate::{ }; fn autocomplete_valid_diagnostic(span: Span, autocomplete: &str) -> OxcDiagnostic { - OxcDiagnostic::warn(format!("`{autocomplete}` is not a valid value for autocomplete.")) - .with_help(format!("Change `{autocomplete}` to a valid value for autocomplete.")) + OxcDiagnostic::warn(format!("`{autocomplete}` is not a valid value for `autocomplete`.")) + .with_help(format!("Change `{autocomplete}` to a valid value for `autocomplete`.")) .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/click_events_have_key_events.rs b/crates/oxc_linter/src/rules/jsx_a11y/click_events_have_key_events.rs index 6a1853d75bdc5..c2da8569053dd 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/click_events_have_key_events.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/click_events_have_key_events.rs @@ -16,7 +16,7 @@ use crate::{ fn click_events_have_key_events_diagnostic(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Enforce a clickable non-interactive element has at least one keyboard event listener.") - .with_help("Visible, non-interactive elements with click handlers must have one of keyup, keydown, or keypress listener.") + .with_help("Visible, non-interactive elements with click handlers must have one of `keyup`, `keydown`, or `keypress` listener.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs b/crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs index ff64fa611f545..ec5c7413fc595 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/html_has_lang.rs @@ -15,12 +15,12 @@ use crate::{ fn missing_lang_prop(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Missing lang attribute.") - .with_help("Add a lang attribute to the html element whose value represents the primary language of document.") + .with_help("Add a `lang` attribute to the `html` element whose value represents the primary language of document.") .with_label(span) } fn missing_lang_value(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Missing value for lang attribute") + OxcDiagnostic::warn("Missing value for `lang` attribute") .with_help("Must have meaningful value for `lang` prop.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/iframe_has_title.rs b/crates/oxc_linter/src/rules/jsx_a11y/iframe_has_title.rs index 5e6326345cea5..05330229b5baa 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/iframe_has_title.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/iframe_has_title.rs @@ -15,7 +15,7 @@ use crate::{ fn iframe_has_title_diagnostic(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Missing `title` attribute for the `iframe` element.") - .with_help("Provide title property for iframe element.") + .with_help("Provide `title` property for `iframe` element.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/img_redundant_alt.rs b/crates/oxc_linter/src/rules/jsx_a11y/img_redundant_alt.rs index 7b1c72399a27c..bbe64d99d090a 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/img_redundant_alt.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/img_redundant_alt.rs @@ -21,8 +21,8 @@ use crate::{ }; fn img_redundant_alt_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Redundant alt attribute.") - .with_help("Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom words) in the alt prop.").with_label(span) + OxcDiagnostic::warn("Redundant `alt` attribute.") + .with_help("Provide no redundant alt text for image. Screen-readers already announce `img` tags as an image. You don't need to use the words `image`, `photo,` or `picture` (or any specified custom words) in the `alt` prop.").with_label(span) } #[derive(Debug, Default, Clone)] diff --git a/crates/oxc_linter/src/rules/jsx_a11y/lang.rs b/crates/oxc_linter/src/rules/jsx_a11y/lang.rs index 6a9e53b31708f..22c6556917291 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/lang.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/lang.rs @@ -15,8 +15,8 @@ use crate::{ }; fn lang_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Lang attribute must have a valid value.") - .with_help("Set a valid value for lang attribute.") + OxcDiagnostic::warn("`lang` attribute must have a valid value.") + .with_help("Set a valid value for `lang` attribute.") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/media_has_caption.rs b/crates/oxc_linter/src/rules/jsx_a11y/media_has_caption.rs index c4252d8b9a09e..76c6f778e6d46 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/media_has_caption.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/media_has_caption.rs @@ -14,9 +14,11 @@ use serde_json::Value; use crate::{AstNode, context::LintContext, rule::Rule, utils::get_element_type}; fn media_has_caption_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Missing element with captions inside