Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn default_diagnostic(x0: &str, span1: Span) -> OxcDiagnostic {
"eslint-plugin-import(default): No default export found in imported module {x0:?}"
))
.with_help(format!("does {x0:?} have the default export?"))
.with_labels([span1.into()])
.with_label(span1)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/default.md>
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn no_named_export(span0: Span, x1: &str) -> OxcDiagnostic {
OxcDiagnostic::warn(format!(
"eslint-plugin-import(export): No named exports found in module '{x1}'"
))
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/export.md>
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{context::LintContext, rule::Rule};
fn named_diagnostic(x0: &str, x1: &str, span2: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("eslint-plugin-import(named): named import {x0:?} not found"))
.with_help(format!("does {x1:?} have the export {x0:?}?"))
.with_labels([span2.into()])
.with_label(span2)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/named.md>
Expand Down
8 changes: 4 additions & 4 deletions crates/oxc_linter/src/rules/import/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ fn no_export(span0: Span, x1: &str, x2: &str) -> OxcDiagnostic {
OxcDiagnostic::warn(format!(
"eslint-plugin-import(namespace): {x1:?} not found in imported namespace {x2:?}."
))
.with_labels([span0.into()])
.with_label(span0)
}

fn no_export_in_deeply_imported_namespace(span0: Span, x1: &str, x2: &str) -> OxcDiagnostic {
OxcDiagnostic::warn(format!(
"eslint-plugin-import(namespace): {x1:?} not found in deeply imported namespace {x2:?}."
))
.with_labels([span0.into()])
.with_label(span0)
}

fn computed_reference(span0: Span, x1: &str) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("eslint-plugin-import(namespace): Unable to validate computed reference to imported namespace {x1:?}.")).with_labels([span0.into()])
OxcDiagnostic::warn(format!("eslint-plugin-import(namespace): Unable to validate computed reference to imported namespace {x1:?}.")).with_label(span0)
}

fn assignment(span0: Span, x1: &str) -> OxcDiagnostic {
OxcDiagnostic::warn(format!(
"eslint-plugin-import(namespace): Assignment to member of namespace {x1:?}.'"
))
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/namespace.md>
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/no_amd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn no_amd_diagnostic(span0: Span, x1: &str) -> OxcDiagnostic {
"eslint-plugin-import(no-amd): Do not use AMD `require` and `define` calls.",
)
.with_help(format!("Expected imports instead of AMD {x1}()"))
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/no_cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{context::LintContext, rule::Rule};
fn no_cycle_diagnostic(span0: Span, x1: &str) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-import(no-cycle): Dependency cycle detected")
.with_help(format!("These paths form a cycle: \n{x1}"))
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md>
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/no_default_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{context::LintContext, rule::Rule};

fn no_default_export_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-import(no-default-export): Prefer named exports")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{context::LintContext, rule::Rule};
fn no_named_as_default_diagnostic(span0: Span, x1: &str, x2: &str) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("eslint-plugin-import(no-named-as-default): Module {x2:?} has named export {x1:?}"))
.with_help(format!("Using default import as {x1:?} can be confusing. Use another name for default import to avoid confusion."))
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn no_named_as_default_member_dignostic(
"eslint-plugin-import(no-named-as-default-member): {x1:?} also has a named export {x2:?}"
))
.with_help(format!("Check if you meant to write `import {{{x2:}}} from {x3:?}`"))
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md>
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/no_self_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn no_self_import_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(
"eslint-plugin-import(no-self-import): module importing itself is not allowed",
)
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/import/no_unused_modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{context::LintContext, rule::Rule};

fn no_exports_found(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-import(no-unused-modules): No exports found")
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md>
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/expect_expect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
fn expect_expect_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(expect-expect): Test has no assertions")
.with_help("Add assertion(s) in this Test")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/max_expects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
fn exceeded_max_assertion(x0: usize, x1: usize, span2: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(max-expects): Enforces a maximum number assertion calls in a test body.")
.with_help(format!("Too many assertion calls ({x0:?}) - maximum allowed is {x1:?}"))
.with_labels([span2.into()])
.with_label(span2)
}

#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/max_nested_describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn exceeded_max_depth(current: usize, max: usize, span0: Span) -> OxcDiagnostic
"eslint-plugin-jest(max-nested-describe): Enforces a maximum depth to nested describe calls.",
)
.with_help(format!("Too many nested describe calls ({current}) - maximum allowed is {max}"))
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_alias_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
fn no_alias_methods_diagnostic(x0: &str, x1: &str, span2: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("eslint-plugin-jest(no-alias-methods): Unexpected alias {x0:?}"))
.with_help(format!("Replace {x0:?} with its canonical name of {x1:?}"))
.with_labels([span2.into()])
.with_label(span2)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn no_commented_out_tests_diagnostic(span0: Span) -> OxcDiagnostic {
"eslint-plugin-jest(no-commented-out-tests): Some tests seem to be commented",
)
.with_help("Remove or uncomment this comment")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
fn no_conditional_expect_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-conditional-expect): Unexpected conditional expect")
.with_help("Avoid calling `expect` conditionally`")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ use crate::{
fn no_global_set_timeout_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-confusing-set-timeout)")
.with_help("`jest.setTimeout` should be call in `global` scope")
.with_labels([span0.into()])
.with_label(span0)
}

fn no_multiple_set_timeouts_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-confusing-set-timeout)")
.with_help("Do not call `jest.setTimeout` multiple times, as only the last call will have an effect")
.with_labels([span0.into()])
.with_label(span0)
}

fn no_unorder_set_timeout_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-confusing-set-timeout)")
.with_help("`jest.setTimeout` should be placed before any other jest methods")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn deprecated_function(x0: &str, x1: &str, span2: Span) -> OxcDiagnostic {
"eslint-plugin-jest(no-deprecated-functions): Disallow use of deprecated functions",
)
.with_help(format!("{x0:?} has been deprecated in favor of {x1:?}"))
.with_labels([span2.into()])
.with_label(span2)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_disabled_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ declare_oxc_lint!(
fn no_disabled_tests_diagnostic(x0: &str, x1: &str, x2: &str, span3: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("{x0}(no-disabled-tests): {x1:?}"))
.with_help(format!("{x2:?}"))
.with_labels([span3.into()])
.with_label(span3)
}

enum Message {
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/jest/no_done_callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ fn no_done_callback(span0: Span) -> OxcDiagnostic {
"eslint-plugin-jest(no-done-callback): Function parameter(s) use the `done` argument",
)
.with_help("Return a Promise instead of relying on callback parameter")
.with_labels([span0.into()])
.with_label(span0)
}

fn use_await_instead_of_callback(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(
"eslint-plugin-jest(no-done-callback): Function parameter(s) use the `done` argument",
)
.with_help("Use await instead of callback in async functions")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_duplicate_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn no_duplicate_hooks_diagnostic(x0: &str, span0: Span) -> OxcDiagnostic {
"eslint-plugin-jest(no-duplicate-hooks): Disallow duplicate setup and teardown hooks.",
)
.with_help(format!("Duplicate {x0:?} in describe block."))
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{context::LintContext, rule::Rule, utils::is_jest_file};
fn no_export_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-export): Do not export from a test file.")
.with_help("If you want to share code between tests, move it into a separate file and import it from there.")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_focused_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
fn no_focused_tests_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-focused-tests): Unexpected focused test.")
.with_help("Remove focus from test.")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{

fn unexpected_hook_diagonsitc(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-hooks): Disallow setup and teardown hooks.")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/jest/no_identical_title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use crate::{
fn describe_repeat(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-identical-title): Describe block title is used multiple times in the same describe block.")
.with_help("Change the title of describe block.")
.with_labels([span0.into()])
.with_label(span0)
}

fn test_repeat(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-identical-title): Test title is used multiple times in the same describe block.").with_help("Change the title of test.").with_labels([span0.into()])
OxcDiagnostic::warn("eslint-plugin-jest(no-identical-title): Test title is used multiple times in the same describe block.").with_help("Change the title of test.").with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
fn no_interpolation_in_snapshots_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-interpolation-in-snapshots): Do not use string interpolation inside of snapshots")
.with_help("Remove string interpolation from snapshots")
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_jasmine_globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{context::LintContext, rule::Rule};
fn no_jasmine_globals_diagnostic(x0: &str, x1: &str, span2: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("eslint-plugin-jest(no-jasmine-globals): {x0:?}"))
.with_help(format!("{x1:?}"))
.with_labels([span2.into()])
.with_label(span2)
}

/// <https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-jasmine-globals.md>
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/jest/no_large_snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ use crate::{
fn no_snapshot(x0: usize, span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-large-snapshots): Disallow large snapshots.")
.with_help(format!("`{x0:?}`s should begin with lowercase"))
.with_labels([span0.into()])
.with_label(span0)
}

fn too_long_snapshots(x0: usize, x1: usize, span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-large-snapshots): Disallow large snapshots.")
.with_help(format!(
"Expected Jest snapshot to be smaller than {x0:?} lines but was {x1:?} lines long"
))
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_mocks_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{context::LintContext, rule::Rule};
fn no_mocks_import_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-mocks-import): Mocks should not be manually imported from a `__mocks__` directory.")
.with_help("Instead use `jest.mock` and import from the original module path.")
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-mocks-import.md>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ fn restricted_jest_method(x0: &str, span1: Span) -> OxcDiagnostic {
"eslint-plugin-jest(no-restricted-jest-methods): Disallow specific `jest.` methods",
)
.with_help(format!("Use of `{x0:?}` is disallowed"))
.with_labels([span1.into()])
.with_label(span1)
}

fn restricted_jest_method_with_message(x0: &str, span1: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(
"eslint-plugin-jest(no-restricted-jest-methods): Disallow specific `jest.` methods",
)
.with_help(format!("{x0:?}"))
.with_labels([span1.into()])
.with_label(span1)
}

#[derive(Debug, Default, Clone)]
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/jest/no_restricted_matchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ fn restricted_chain(x0: &str, span1: Span) -> OxcDiagnostic {
"eslint-plugin-jest(no-restricted-matchers): Disallow specific matchers & modifiers",
)
.with_help(format!("Use of `{x0:?}` is disallowed`"))
.with_labels([span1.into()])
.with_label(span1)
}

fn restricted_chain_with_message(x0: &str, span1: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(
"eslint-plugin-jest(no-restricted-matchers): Disallow specific matchers & modifiers",
)
.with_help(format!("{x0:?}"))
.with_labels([span1.into()])
.with_label(span1)
}

#[derive(Debug, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_standalone_expect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn no_standalone_expect_diagnostic(span0: Span) -> OxcDiagnostic {
"eslint-plugin-jest(no-standalone-expect): Expect must be inside of a test block.",
)
.with_help("Did you forget to wrap `expect` in a `test` or `it` block?")
.with_labels([span0.into()])
.with_label(span0)
}

/// <https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-standalone-expect.md>
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/no_test_prefixes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{

fn no_test_prefixes_diagnostic(x0: &str, span1: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("eslint-plugin-jest(no-test-prefixes): Use {x0:?} instead."))
.with_labels([span1.into()])
.with_label(span1)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn no_test_return_statement_diagnostic(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(
"eslint-plugin-jest(no-test-return-statement): Jest tests should not return a value",
)
.with_labels([span0.into()])
.with_label(span0)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
fn add_type_parameter_to_module_mock_diagnostic(x0: &str, span1: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("eslint-plugin-jest(no-untyped-mock-factory): Disallow using `jest.mock()` factories without an explicit type parameter.")
.with_help(format!("Add a type parameter to the mock factory such as `typeof import({x0:?})`"))
.with_labels([span1.into()])
.with_label(span1)
}

#[derive(Debug, Default, Clone)]
Expand Down
Loading