pzavolinsky / ts-unused-exports

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

The "excludePathsFromReport" option does not support regex #293

Closed ismarbesic closed 1 year ago

ismarbesic commented 1 year ago

In some projects there can sometimes be files with exports that are being used by the deployment provider but unused in the project itself. An example of such provider is Firebase Cloud Functions where the index.ts file exports one variable per function. An example of such a project can look like this:

folder/a.ts

export function a() {
  return 0;
}

folder/b.ts

export function b() {
  return 0;
}

folder/index.ts

export { a } from './a';
export { b } from './b';

Currently it is possible to ignore files from being analyzed using regex, in this case index.ts. However, since the file is ignored, fileA.ts and fileB.ts will now have unused exports.

Using the excludePathsFromReport it is possible to exclude files separated by semi-colons. In larger projects this becomes trick very easily, especially with long folder names. Since the ignoreFiles option already supports regex, a suggestion is to add support for regex for the excludePathsFromReport option as well for consistency.

mrseanryan commented 1 year ago

Thanks for contributing! Will release as 10.0.0

ismarbesic commented 1 year ago

Glad I could contribute :)