pzavolinsky / ts-unused-exports

ts-unused-exports finds unused exported symbols in your Typescript project
MIT License
738 stars 46 forks source link

Add `disable-file` option via comment in file #226

Closed ThomasAribart closed 1 year ago

ThomasAribart commented 1 year ago

Hi and thanks for this nice lib!

It would be useful sometimes to disable the unused-exports checks on a whole file, say an index.ts or index.js that serves as an entry point for other imports, even if said imports don't exist yet.

mrseanryan commented 1 year ago

hi @ThomasAribart thank you for the suggestion. However, I believe this is already possible with this setting:

ignoreFiles

please see the README for more details. Thank you

ThomasAribart commented 1 year ago

@mrseanryan I agree that the goal is the same but the API is completely different. ignoreFiles is a CLI option while I'm talking about a file comment. The second API is much more scalable.

mrseanryan commented 1 year ago

hm I see - have updated the title.

It seems a bit unusual to exclude files from a tool by adding a comment inside the file.

Also we’d need more specific details

@pzavolinsky what do you think?

OfficialCRUGG commented 1 year ago

It's not unusual at all actually.

ESLint allows for disabling it in an entire file using

/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable */

or for the next line using

// eslint-disable-next-line @typescript-eslint/no-unused-vars

TypeScript also has

// @ts-expect-error
// @ts-ignore

Or Prettier has

// prettier-ignore

to ignore the next line.