Skip to content

Commit

Permalink
Shift around absolute checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Feb 21, 2024
1 parent 87de946 commit a80dc03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/definitions-parser/src/get-affected-packages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { assertDefined, execAndThrowErrors, mapDefined, normalizeSlashes, withoutStart } from "@definitelytyped/utils";
import { AllPackages, PackageId, formatTypingVersion, getDependencyFromFile } from "./packages";
import { resolve } from "path";
import { isAbsolute, resolve } from "path";

Check failure on line 3 in packages/definitions-parser/src/get-affected-packages.ts

View workflow job for this annotation

GitHub Actions / build and test (ubuntu-latest)

'resolve' is declared but its value is never read.

Check failure on line 3 in packages/definitions-parser/src/get-affected-packages.ts

View workflow job for this annotation

GitHub Actions / build and test (windows-latest)

'resolve' is declared but its value is never read.

Check failure on line 3 in packages/definitions-parser/src/get-affected-packages.ts

View workflow job for this annotation

GitHub Actions / build and test (macos-latest)

'resolve' is declared but its value is never read.
import { satisfies } from "semver";
import assert from "assert";
export interface PreparePackagesResult {
readonly packageNames: Set<string>;
readonly dependents: Set<string>;
Expand Down Expand Up @@ -77,7 +78,8 @@ export async function getAffectedPackagesWorker(
dependentOutputs: string[],
definitelyTypedPath: string,
): Promise<PreparePackagesResult> {
const dt = resolve(definitelyTypedPath);
assert(isAbsolute(definitelyTypedPath), "definitelyTypedPath should be absolute");
const dt = definitelyTypedPath;
const changedDirs = mapDefined(changedOutput.split("\n"), getDirectoryName(dt));
const dependentDirs = mapDefined(dependentOutputs.join("\n").split("\n"), getDirectoryName(dt));
const packageNames = new Set([
Expand Down
2 changes: 2 additions & 0 deletions packages/dtslint-runner/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import fs from "fs";
import { RunDTSLintOptions } from "./types";
import { prepareAllPackages } from "./prepareAllPackages";
import { prepareAffectedPackages } from "./prepareAffectedPackages";
import { resolve } from "path";

export async function runDTSLint({
definitelyTypedAcquisition,
Expand Down Expand Up @@ -36,6 +37,7 @@ export async function runDTSLint({
} else {
definitelyTypedPath = definitelyTypedAcquisition.path;
}
definitelyTypedPath = resolve(definitelyTypedPath);

if (!fs.existsSync(definitelyTypedPath)) {
throw new Error(`Path '${definitelyTypedPath}' does not exist.`);
Expand Down

0 comments on commit a80dc03

Please sign in to comment.