Skip to content

Commit

Permalink
Improve a few names
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 5, 2022
1 parent 3a4c90d commit 458cb5a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ Options:
--onlyExports Report only unused exports
--onlyTypes Report only unused types
--onlyDuplicates Report only unused duplicate exports
--ignoreNamespaceImports Ignore namespace imports (affects onlyFiles and onlyDuplicates)
--ignoreNamespaceImports Ignore namespace imports (affects onlyExports and onlyTypes)
--noProgress Don't show dynamic progress updates
Examples:
Expand Down
8 changes: 4 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
onlyTypes,
onlyDuplicates,
ignoreNamespaceImports = false,
hideProgress = false
noProgress = false
}
} = parseArgs({
allowPositionals: true,
Expand All @@ -29,7 +29,7 @@ const {
onlyTypes: { type: 'boolean' },
onlyDuplicates: { type: 'boolean' },
ignoreNamespaceImports: { type: 'boolean' },
hideProgress: { type: 'boolean' }
noProgress: { type: 'boolean' }
}
});

Expand All @@ -42,7 +42,7 @@ const cwd = cwdArg ? path.resolve(cwdArg) : process.cwd();

const configuration: Configuration = require(path.resolve(config));

const isShowProgress = !hideProgress || !process.stdout.isTTY;
const isShowProgress = !noProgress || !process.stdout.isTTY;
const isFindAll = !onlyFiles && !onlyExports && !onlyTypes && !onlyDuplicates;
const isFindUnusedFiles = onlyFiles === true || isFindAll;
const isFindUnusedExports = onlyExports === true || isFindAll;
Expand All @@ -58,7 +58,7 @@ const main = async () => {
isFindUnusedExports,
isFindUnusedTypes,
isFindDuplicateExports,
isIgnoreNamespaceImports: Boolean(ignoreNamespaceImports)
isFollowSymbols: !ignoreNamespaceImports
});

if (isFindUnusedFiles) logIssueGroupResult(cwd, 'UNUSED FILES', issues.file);
Expand Down
4 changes: 2 additions & 2 deletions src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Options:
--onlyExports Report only unused exports
--onlyTypes Report only unused types
--onlyDuplicates Report only unused duplicate exports
--ignoreNamespaceImports Ignore namespace imports (affects onlyFiles and onlyDuplicates)
--hideProgress Hide dynamic progress updates
--ignoreNamespaceImports Ignore namespace imports (affects onlyExports and onlyTypes)
--noProgress Don't show dynamic progress updates
Examples:
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function run(configuration: Configuration) {
isFindUnusedExports,
isFindUnusedTypes,
isFindDuplicateExports,
isIgnoreNamespaceImports
isFollowSymbols
} = configuration;

// Create workspace for entry files + resolved dependencies
Expand Down Expand Up @@ -134,7 +134,7 @@ export async function run(configuration: Configuration) {

if (!isReferencedOnlyBySelf) return; // This identifier is used somewhere else

if (!isIgnoreNamespaceImports) {
if (isFollowSymbols) {
const symbol = identifier.getSymbol();
if (symbol) {
const referencingSourceFiles = sourceFile.getReferencingSourceFiles();
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type Configuration = {
isFindUnusedExports?: boolean;
isFindUnusedTypes?: boolean;
isFindDuplicateExports?: boolean;
isIgnoreNamespaceImports?: boolean;
isFollowSymbols?: boolean;
};

type FilePath = string;
Expand Down
2 changes: 1 addition & 1 deletion test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('run', async () => {
isFindUnusedExports: true,
isFindUnusedTypes: true,
isFindDuplicateExports: true,
isIgnoreNamespaceImports: false
isFollowSymbols: false
});

assert(issues.file.length === 1);
Expand Down

0 comments on commit 458cb5a

Please sign in to comment.