From 4285cb339d4ddfe564a98b030bcba6c621584e81 Mon Sep 17 00:00:00 2001 From: Yazan AbdAl-Rahman Date: Mon, 19 Aug 2024 23:42:13 +0300 Subject: fix(lint): support linting tsx/jsx from stdin (#24955) Co-authored-by: David Sherret --- tests/integration/lint_tests.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/integration') diff --git a/tests/integration/lint_tests.rs b/tests/integration/lint_tests.rs index c0b1b4286..b47a98da4 100644 --- a/tests/integration/lint_tests.rs +++ b/tests/integration/lint_tests.rs @@ -4,6 +4,7 @@ use deno_core::serde_json::json; use test_util::assert_contains; use test_util::assert_not_contains; use test_util::itest; +use test_util::TestContext; use test_util::TestContextBuilder; itest!(ignore_unexplicit_files { @@ -235,3 +236,32 @@ fn opt_out_top_level_exclude_via_lint_unexclude() { assert_contains!(output, "excluded.ts"); assert_not_contains!(output, "actually_excluded.ts"); } + +#[test] +fn lint_stdin_jsx() { + TestContext::default() + .new_command() + .args("lint --ext=jsx -") + .stdin_text( + r#" +const data =
hello
; +"#, + ) + .run() + .assert_matches_text( + r#"error[no-unused-vars]: `data` is never used + --> [WILDLINE]$deno$stdin.jsx:2:7 + | +2 | const data =
hello
; + | ^^^^ + = hint: If this is intentional, prefix it with an underscore like `_data` + + docs: https://lint.deno.land/rules/no-unused-vars + + +Found 1 problem +Checked 1 file +"#, + ) + .assert_exit_code(1); +} -- cgit v1.2.3