Open Sheraff opened 1 year ago
hi @Sheraff thank you for reporting
A PR would be great.
There are BDD style tests here for that feature so that’s probably a place to start
https://github.com/pzavolinsky/ts-unused-exports/blob/master/features/ignore-locally-used.feature
Additionally there are e2e tests here that we add for some cases
https://github.com/pzavolinsky/ts-unused-exports/tree/master/example
thank you sean
@mrseanryan How do you run the tests? Sorry I'm mostly familiar with the jest/vitest/playwright family of test syntax. I tried making a failing test (in both the cucumber syntax and the shell E2E syntax) and couldn't make them fail...
to run the tests see https://github.com/pzavolinsky/ts-unused-exports/blob/master/CONTRIBUTING.md
if you get stuck, push a pr anyway, i could have a look at weekend
Possibly this is fixed in 10.2.0 - via #300
For me upgrading to 10.1.0 caused ts-unused-exports
to stop reporting any unused exports when ignoreLocallyUsed
is enabled. I had to downgrade to 10.0.1
Anyone else have the same issue?
TL;DR:
ignoreLocallyUsed
does not work when the export is used in{ foo: a };
${a};
<div>{a}</div>;
Reproduction: https://stackblitz.com/edit/ts-unused-exports-object-key-yuxcdk?file=src%2Fexports.jsx
Example:
In the code sample above, if
a
is not imported anywhere, even with the--ignoreLocallyUsed
option it will be reported as unused.PS: I'm willing to work on a PR, I'm used to playing with ASTs, but only those like ESLint's and not the
ts
stuff. So I'd love a little guidance for where to look.