Fix lint script now that types are in types directory (#15372)

This commit is contained in:
Andy 2017-03-24 15:04:36 -07:00 committed by GitHub
parent 0ba0c1dd7d
commit 78f4536c66
3 changed files with 6 additions and 4 deletions

View File

@ -4,9 +4,11 @@ const execSync = require("child_process").execSync;
const existsSync = require("fs").existsSync;
const path = require("path");
const pkgPath = path.join("types", pkg);
// Path of tslint when `types-publisher` is symlinked
const symlinkedTslintPath = "../node_modules/types-publisher/node_modules/tslint"
let tslintPath = existsSync(path.join(pkg, symlinkedTslintPath)) ? symlinkedTslintPath : "../node_modules/tslint";
const symlinkedTslintPath = "../../node_modules/types-publisher/node_modules/tslint"
let tslintPath = existsSync(path.join(pkgPath, symlinkedTslintPath)) ? symlinkedTslintPath : "../node_modules/tslint";
// An older version (e.g. abs/v0) is in a nested directory, so needs to look one more level up for tslint.
if (pkg.includes("/") && pkg[pkg.length - 1] !== "/") {
tslintPath = path.join("..", tslintPath);
@ -17,7 +19,7 @@ console.log(cmd);
try {
// Child process writes directly to our own stdout
execSync(cmd, { cwd: pkg, stdio: "inherit" });
execSync(cmd, { cwd: pkgPath, stdio: "inherit" });
} catch (_) {
// Process should have printed out error info
}

View File

@ -1 +0,0 @@
{ "extends": "./node_modules/types-publisher/tslint-definitions.json" }

1
types/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "../node_modules/types-publisher/tslint-definitions.json" }