diff options
author | Yazan AbdAl-Rahman <yazan.abdalrahman@exalt.ps> | 2024-08-19 23:42:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-19 20:42:13 +0000 |
commit | 4285cb339d4ddfe564a98b030bcba6c621584e81 (patch) | |
tree | d049aa0560b1b00e00a0e2710a9480ced4772b04 /tests/integration/lint_tests.rs | |
parent | b5051e25c219c188f17d499ee4e101a64eb62e37 (diff) |
fix(lint): support linting tsx/jsx from stdin (#24955)
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Diffstat (limited to 'tests/integration/lint_tests.rs')
-rw-r--r-- | tests/integration/lint_tests.rs | 30 |
1 files changed, 30 insertions, 0 deletions
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 = <div>hello</div>; +"#, + ) + .run() + .assert_matches_text( + r#"error[no-unused-vars]: `data` is never used + --> [WILDLINE]$deno$stdin.jsx:2:7 + | +2 | const data = <div>hello</div>; + | ^^^^ + = 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); +} |