Skip to content

Commit

Permalink
refactor: remove outdated comments
Browse files Browse the repository at this point in the history
Mostly
- Commented out code
- Eslint commands that don't do anything
- Type descriptions which are now handled through TS
  • Loading branch information
ComradeVanti committed Dec 21, 2023
1 parent a9f68c3 commit 8a9c3a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/cmd-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export const add = async function (
}
// verify version
const versions = Object.keys(pkgInfo.versions) as SemanticVersion[];
// eslint-disable-next-line require-atomic-updates
if (!version || version === "latest")
version = tryGetLatestVersion(pkgInfo);
if (versions.filter((x) => x === version).length <= 0) {
Expand Down
5 changes: 0 additions & 5 deletions src/cmd-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ export async function search(
results = (await searchOld(env.registry, keyword)) || [];
}
// search upstream
// if (env.upstream) {
// const upstreamResults =
// (await searchEndpoint(keyword, env.upstreamRegistry)) || [];
// results.push(...upstreamResults);
// }
if (results && results.length) {
results.forEach((x) => table.push(x.slice(0, -1)));
console.log(table.toString());
Expand Down
22 changes: 4 additions & 18 deletions src/registry-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,12 @@ export const fetchPackageInfo = async function (
const client = getNpmClient();
try {
return await client.get(pkgPath, { auth: registry.auth || undefined });
// eslint-disable-next-line no-empty
} catch (err) {}
} catch (err) {
/* empty */
}
};

/* Fetch package [valid dependencies, invalid dependencies] with a structure of
[
{
name,
version,
upstream, // whether belongs to upstream registry
self, // whether is the source package
internal, // whether is an internal package
reason // invalid reason of "version404", "package404"
}, ...
]
*/
// Fetch package dependencies
export const fetchPackageDependencies = async function (
registry: Registry,
upstreamRegistry: Registry,
Expand Down Expand Up @@ -221,7 +211,6 @@ export const fetchPackageDependencies = async function (
if (!entry.version || entry.version == "latest") {
const latestVersion = tryGetLatestVersion(pkgInfo);
assert(latestVersion !== undefined);
// eslint-disable-next-line require-atomic-updates
depObj.version = entry.version = latestVersion;
}
// handle version not exist
Expand All @@ -234,9 +223,6 @@ export const fetchPackageDependencies = async function (
)} is not a valid choice of ${versions.reverse().join(", ")}`
);
depObj.reason = "version404";
// eslint-disable-next-line require-atomic-updates
// depObj.version = entry.version = getLatestVersion(pkgInfo);
// log.warn("notarget", `fallback to ${entry.name}@${entry.version}`);
depsInvalid.push(depObj);
continue;
}
Expand Down
2 changes: 0 additions & 2 deletions src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ export const parseEnv = async function (
env.registry.auth = tryGetAuthForRegistry(env.registry.url);
env.upstreamRegistry.auth = tryGetAuthForRegistry(env.upstreamRegistry.url);
}
// log.verbose("env.npmAuth", env.npmAuth);
// log.verbose("env.auth", env.auth);
// return if no need to check path
if (!checkPath) return env;
// cwd
Expand Down

0 comments on commit 8a9c3a0

Please sign in to comment.