Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(linter): change no-disabled-tests error message's position #857

Merged
merged 1 commit into from
Sep 4, 2023
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
chore(linter): change diagnostic position
  • Loading branch information
mysteryven committed Sep 4, 2023
commit b64960662e9e5e5f2f76e310d57a6391ba527739
6 changes: 3 additions & 3 deletions crates/oxc_linter/src/rules/jest/no_disabled_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use oxc_diagnostics::{
thiserror::Error,
};
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use oxc_span::{GetSpan, Span};

use crate::{
context::LintContext,
Expand Down Expand Up @@ -109,7 +109,7 @@ impl Rule for NoDisabledTests {
} else {
Message::DisabledTestWithX.details()
};
ctx.diagnostic(NoDisabledTestsDiagnostic(error, help, call_expr.span));
ctx.diagnostic(NoDisabledTestsDiagnostic(error, help, call_expr.callee.span()));
return;
}

Expand All @@ -121,7 +121,7 @@ impl Rule for NoDisabledTests {
} else {
Message::DisabledTestWithSkip.details()
};
ctx.diagnostic(NoDisabledTestsDiagnostic(error, help, call_expr.span));
ctx.diagnostic(NoDisabledTestsDiagnostic(error, help, call_expr.callee.span()));
}
} else if let Expression::Identifier(ident) = &call_expr.callee {
if ident.name.as_str() == "pending"
Expand Down
40 changes: 20 additions & 20 deletions crates/oxc_linter/src/snapshots/no_disabled_tests.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,140 +5,140 @@ expression: no_disabled_tests
⚠ eslint(jest/no-disabled-tests): "Disabled test suite"
╭─[no_disabled_tests.tsx:1:1]
1 │ describe.skip('foo', function () {})
· ────────────────────────────────────
· ─────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test suite"
╭─[no_disabled_tests.tsx:1:1]
1 │ describe.skip.each([1, 2, 3])('%s', (a, b) => {});
· ─────────────────────────────────────────────────
· ─────────────────────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test suite"
╭─[no_disabled_tests.tsx:1:1]
1 │ xdescribe.each([1, 2, 3])('%s', (a, b) => {});
· ─────────────────────────────────────────────
· ─────────────────────────
╰────
help: "Remove x prefix"

⚠ eslint(jest/no-disabled-tests): "Disabled test suite"
╭─[no_disabled_tests.tsx:1:1]
1 │ describe[`skip`]('foo', function () {})
· ───────────────────────────────────────
· ────────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test suite"
╭─[no_disabled_tests.tsx:1:1]
1 │ describe['skip']('foo', function () {})
· ───────────────────────────────────────
· ────────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ it.skip('foo', function () {})
· ──────────────────────────────
· ───────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ it['skip']('foo', function () {})
· ─────────────────────────────────
· ──────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ test.skip('foo', function () {})
· ────────────────────────────────
· ─────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ it.skip.each``('foo', function () {})
· ─────────────────────────────────────
· ──────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ test.skip.each``('foo', function () {})
· ───────────────────────────────────────
· ────────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ it.skip.each([])('foo', function () {})
· ───────────────────────────────────────
· ────────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ test.skip.each([])('foo', function () {})
· ─────────────────────────────────────────
· ──────────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ test['skip']('foo', function () {})
· ───────────────────────────────────
· ────────────
╰────
help: "Remove the appending `.skip`"

⚠ eslint(jest/no-disabled-tests): "Disabled test suite"
╭─[no_disabled_tests.tsx:1:1]
1 │ xdescribe('foo', function () {})
· ────────────────────────────────
· ─────────
╰────
help: "Remove x prefix"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ xit('foo', function () {})
· ──────────────────────────
· ───
╰────
help: "Remove x prefix"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ xtest('foo', function () {})
· ────────────────────────────
· ─────
╰────
help: "Remove x prefix"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ xit.each``('foo', function () {})
· ─────────────────────────────────
· ──────────
╰────
help: "Remove x prefix"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ xtest.each``('foo', function () {})
· ───────────────────────────────────
· ────────────
╰────
help: "Remove x prefix"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ xit.each([])('foo', function () {})
· ───────────────────────────────────
· ────────────
╰────
help: "Remove x prefix"

⚠ eslint(jest/no-disabled-tests): "Disabled test"
╭─[no_disabled_tests.tsx:1:1]
1 │ xtest.each([])('foo', function () {})
· ─────────────────────────────────────
· ──────────────
╰────
help: "Remove x prefix"

Expand Down