Skip to content

no-unused-vars false positive #5391

@eventualbuddha

Description

@eventualbuddha

This line triggers a no-unused-vars warning when it should not: https://github.com/votingworks/vxsuite/blob/720f72ac404bfff011034f275317a02f5d69cff9/libs/ui/src/hand_marked_paper_ballot_prose.tsx#L10:

Here's a stripped down–but not minimal–version of the code that still reproduces the issue:

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')};
`;

Here's the output from oxlint:

❯ npx oxlint@latest libs/ui/src/hand_marked_paper_ballot_prose_minimal.tsx

  ⚠ eslint(no-unused-vars): Parameter 'density' is declared but never used.
    ╭─[libs/ui/src/hand_marked_paper_ballot_prose_minimal.tsx:10:21]
  9 │ export const HandMarkedPaperBallotProse = styled(Prose)<Props>`
 10 │   line-height: ${({ density }) => (density !== 0 ? '1.1' : '1.3')};
    ·                     ───┬───
    ·                        ╰── 'density' is declared here
 11 │ `;
    ╰────
  help: Consider removing this parameter.

Finished in 4ms on 1 file with 93 rules using 3 threads.
Found 1 warning and 0 errors.

Metadata

Metadata

Assignees

Labels

A-linterArea - LinterC-bugCategory - Buggood first issueExperience Level - Good for newcomers

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions