diff --git a/packages/definitions-parser/src/mocks.ts b/packages/definitions-parser/src/mocks.ts index 6c4caf4f90..38b2863d3f 100644 --- a/packages/definitions-parser/src/mocks.ts +++ b/packages/definitions-parser/src/mocks.ts @@ -257,13 +257,13 @@ console.log(jQuery); ); const allowedDep = dt.pkgDir("allowed-dep"); - allowedDep.set("package.json", packageJson("allowed-dep", "1.0", { "prettier": "*" })); + allowedDep.set("package.json", packageJson("allowed-dep", "1.0", { prettier: "*" })); const nonAllowedDep = dt.pkgDir("non-allowed-dep"); nonAllowedDep.set("package.json", packageJson("non-allowed-dep", "1.0", { "not-allowed": "*" })); const allowedPeerDep = dt.pkgDir("allowed-peer-dep"); - allowedPeerDep.set("package.json", packageJson("allowed-peer-dep", "1.0", {}, { "prettier": "*" })); + allowedPeerDep.set("package.json", packageJson("allowed-peer-dep", "1.0", {}, { prettier: "*" })); const nonAllowedPeerDep = dt.pkgDir("non-allowed-peer-dep"); nonAllowedPeerDep.set("package.json", packageJson("non-allowed-peer-dep", "1.0", {}, { "not-allowed-peer": "*" })); @@ -299,7 +299,12 @@ ${testNames.map((s) => " " + JSON.stringify(s)).join(",\n")} }`; } -function packageJson(packageName: string, version: string, dependencies: Record, peerDependencies?: Record) { +function packageJson( + packageName: string, + version: string, + dependencies: Record, + peerDependencies?: Record, +) { return `{ "private": true, "name": "@types/${packageName}", @@ -314,11 +319,15 @@ function packageJson(packageName: string, version: string, dependencies: Record< .map(([name, version]) => ` "${name}": "${version}"`) .join(",\n")} }, - ${peerDependencies ? `"peerDependencies": { + ${ + peerDependencies + ? `"peerDependencies": { ${Object.entries(peerDependencies) .map(([name, version]) => ` "${name}": "${version}"`) .join(",\n")} - },` : ""} + },` + : "" + } "devDependencies": { "@types/${packageName}": "workspace:." } diff --git a/packages/definitions-parser/test/definition-parser.test.ts b/packages/definitions-parser/test/definition-parser.test.ts index a15369de7c..a6d6258bc0 100644 --- a/packages/definitions-parser/test/definition-parser.test.ts +++ b/packages/definitions-parser/test/definition-parser.test.ts @@ -442,7 +442,7 @@ import route = require('@ember/routing/route'); return expect(getTypingInfo("non-allowed-dep", dt.fs)).resolves.toEqual({ errors: [ "In package.json: Dependency not-allowed not in the allowed dependencies list.\n" + - "Please make a pull request to microsoft/DefinitelyTyped-tools adding it to `packages/definitions-parser/allowedPackageJsonDependencies.txt`.", + "Please make a pull request to microsoft/DefinitelyTyped-tools adding it to `packages/definitions-parser/allowedPackageJsonDependencies.txt`.", ], }); }); @@ -459,7 +459,7 @@ import route = require('@ember/routing/route'); return expect(getTypingInfo("non-allowed-peer-dep", dt.fs)).resolves.toEqual({ errors: [ "In package.json: Dependency not-allowed-peer not in the allowed dependencies list.\n" + - "Please make a pull request to microsoft/DefinitelyTyped-tools adding it to `packages/definitions-parser/allowedPackageJsonDependencies.txt`.", + "Please make a pull request to microsoft/DefinitelyTyped-tools adding it to `packages/definitions-parser/allowedPackageJsonDependencies.txt`.", ], }); }); diff --git a/packages/definitions-parser/test/packages.test.ts b/packages/definitions-parser/test/packages.test.ts index 3674c5acbf..54b8ddb3e8 100644 --- a/packages/definitions-parser/test/packages.test.ts +++ b/packages/definitions-parser/test/packages.test.ts @@ -138,7 +138,7 @@ describe(TypingsData, () => { }, { "peer-dependency-1": "*", - } + }, ); data = new TypingsData(dt.fs, versions["1.0"], true); }); diff --git a/packages/eslint-plugin/src/rules/no-import-of-dev-dependencies.ts b/packages/eslint-plugin/src/rules/no-import-of-dev-dependencies.ts index 7c3e03cb62..c2d1848bbb 100644 --- a/packages/eslint-plugin/src/rules/no-import-of-dev-dependencies.ts +++ b/packages/eslint-plugin/src/rules/no-import-of-dev-dependencies.ts @@ -39,7 +39,12 @@ const rule = createRule({ } return dep; }) - .filter((dep) => dep !== info.realName && packageJson.dependencies?.[dep] === undefined && packageJson.peerDependencies?.[dep] === undefined); // TODO(jakebailey): add test for this case from https://github.com/microsoft/DefinitelyTyped-tools/pull/773 + .filter( + (dep) => + dep !== info.realName && + packageJson.dependencies?.[dep] === undefined && + packageJson.peerDependencies?.[dep] === undefined, + ); // TODO(jakebailey): add test for this case from https://github.com/microsoft/DefinitelyTyped-tools/pull/773 commentsMatching(context.sourceCode, //, (ref, comment) => { if (devDeps.includes(ref)) { diff --git a/packages/mergebot/src/pr-info.ts b/packages/mergebot/src/pr-info.ts index b79589861b..3a92a73275 100644 --- a/packages/mergebot/src/pr-info.ts +++ b/packages/mergebot/src/pr-info.ts @@ -467,7 +467,7 @@ configSuspicious["package.json"] = makeChecker({}, urls.packageJson, { return { peerDependencies: data.peerDependencies }; } return {}; - } + }, }); configSuspicious[".npmignore"] = () => undefined; configSuspicious["tsconfig.json"] = makeChecker( diff --git a/packages/publisher/src/generate-packages.ts b/packages/publisher/src/generate-packages.ts index 2125dec38a..522a008f0e 100644 --- a/packages/publisher/src/generate-packages.ts +++ b/packages/publisher/src/generate-packages.ts @@ -209,7 +209,9 @@ export function createReadme(typing: TypingsData, packageFS: FS): string { lines.push(""); const peerDependencies = Object.keys(typing.peerDependencies).sort(); if (peerDependencies.length) { - lines.push(` * Peer dependencies: ${peerDependencies.map((d) => `[${d}](https://npmjs.com/package/${d})`).join(", ")}`); + lines.push( + ` * Peer dependencies: ${peerDependencies.map((d) => `[${d}](https://npmjs.com/package/${d})`).join(", ")}`, + ); lines.push(""); } diff --git a/packages/publisher/test/generate-packages.test.ts b/packages/publisher/test/generate-packages.test.ts index dbdfaf2b29..4297029f9a 100644 --- a/packages/publisher/test/generate-packages.test.ts +++ b/packages/publisher/test/generate-packages.test.ts @@ -32,7 +32,7 @@ function createRawPackage(license: License): TypingsDataRaw { typesVersions: [], license, dependencies: { "@types/madeira": "^1" }, - peerDependencies: { "@types/express": "*"}, + peerDependencies: { "@types/express": "*" }, devDependencies: { "@types/jquery": "workspace:." }, olderVersionDirectories: [], }; @@ -58,7 +58,7 @@ function defaultFS() { { name: "E", githubUsername: "e" }, ], dependencies: { "@types/madeira": "^1" }, - peerDependencies: { "@types/express": "*"}, + peerDependencies: { "@types/express": "*" }, devDependencies: { "@types/jquery": "workspace:." }, }, undefined,