Skip to content

Commit

Permalink
test(linter/no-unused-vars): arrow functions in tagged templates (#5510)
Browse files Browse the repository at this point in the history
Closes  #5391
  • Loading branch information
DonIsaac authored Sep 5, 2024
1 parent b96bea4 commit 340b535
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/oxc_linter/src/rules/eslint/no_unused_vars/tests/oxc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ fn test_vars_simple() {
});",
None,
),
// https://github.com/oxc-project/oxc/issues/5391
(
"
import styled from 'styled-components';
import { Prose, ProseProps } from './prose';
interface Props extends ProseProps {
density?: number;
}
export const HandMarkedPaperBallotProse = styled(Prose)<Props>`
line-height: ${({ density }) => (density !== 0 ? '1.1' : '1.3')};
`;
",
None,
),
];
let fail = vec![
("let a = 1", None),
Expand Down
23 changes: 23 additions & 0 deletions crates/oxc_semantic/tests/integration/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,26 @@ fn test_arrow_explicit_return() {
.has_number_of_writes(1)
.test();
}

#[test]
fn test_tagged_templates() {
// https://github.com/oxc-project/oxc/issues/5391
SemanticTester::tsx(
"
import styled from 'styled-components';
import { Prose, ProseProps } from './prose';
interface Props extends ProseProps {
density?: number;
}
export const HandMarkedPaperBallotProse = styled(Prose)<Props>`
line-height: ${({ density }) => (density !== 0 ? '1.1' : '1.3')};
`;
",
)
.has_some_symbol("density")
.has_number_of_reads(1)
.has_number_of_writes(0)
.test();
}

0 comments on commit 340b535

Please sign in to comment.