test(linter/no-unused-vars): arrow functions in tagged templates (#5510)

Closes  #5391
This commit is contained in:
Don Isaac 2024-09-05 14:55:39 -04:00 committed by GitHub
parent b96bea4f0d
commit 340b535715
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 0 deletions

View file

@ -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),

View file

@ -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();
}