Closed brandonxiang closed 1 year ago
Thank you for the PR.
Can you please add an itest to cover.
This involves adding another example under ./example and then adding a call in:
ispec/run.sh
Also, please add an entry at top of CHANGELOG.md
Also to show the output
- need to extend cli.ts
Unless the silent
option is on, then we should display the "completely unused files".
Those can be shown, after the existing messages.
TODO - fix so the itests pass
(should not need to change the itests)
Probably this can be fixed by updating cli.ts
OK, I will spend some time to refactor that code.
good, I will look again when you push
I have a confused whether I should put the completelyUnused attribute inside the Analysis Object.
Whether I should use the original analysis function?
I have a confused whether I should put the completelyUnused attribute inside the Analysis Object. Whether I should use the original analysis function?
Let's add it to the Analysis type, as optional. Like:
export interface Analysis {
[index: string]: ExportNameAndLocation[];
unusedFiles?: string[]; // <<<<<<
}
Then, we can still just export 1 function, as before:
export default (
files: File[],
extraOptions?: ExtraCommandLineOptions,
): Analysis => {
// (existing code)
// ...
if (extraOptions.findCompletelyUnusedFiles) // <<<
analysis.unusedFiles = getUnusedFiles(files, extraOptions); // <<<
return analysis;
}
This extends the API rather than changes it, which is less risky and is easier for users to pick up...
TODO:
findCompletelyUnusedFiles
and doc it in the READMEhi brandonxiang
There were a couple of things I wanted to tidy up (and also avoid adding lodash) so I just made a new PR.
It is merged!
Will release shortly, as new Major version.
Thank you for contributing !
253