New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: [no-unused-vars] false positive if name is type/value merged and exported #6188
Comments
Also affected by this, we use the following quite often for React components: interface Test {
test: string;
}
export const Test = ({ test }: Test) => <>{test}</>; |
Having the same issue with interface ToStringAble {
toString(): string;
}
export interface EqualAble {
equals(other: EqualAble): boolean;
}
export const ToStringAble = (object: ToStringAble): EqualAble => ({
equals: (other: ToStringAble) => object.toString() === other.toString(),
}); |
The bug is in this function here: typescript-eslint/packages/eslint-plugin/src/util/collectUnusedVariables.ts Lines 425 to 440 in 8ee0cbb
Specifically that it only considers if the FIRST declaration is exported. |
Thanks for suggestion @bradzacher , opened PR: #6873 |
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=4.9.3&jsx=true&sourceType=module&showAST=es&code=C4TwDgpgBAZg9nKBeKBvAvgbgFAQB5hwBOwUAxnAHYDOp8iKAFAIZEDmAXLAgJTIB8abFChEIwAK5FKUVmxzpsQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tidmUQAmtAG4BDaKgyRE0aB2iRwYAL4hlQA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA
Repro Code
ESLint Config
tsconfig
Expected Result
no error because the type
foo
is used and the valuefoo
is exportedActual Result
Additional Info
No response
The text was updated successfully, but these errors were encountered: