UNPKG

@storm-software/eslint

Version:

A package containing the base ESLint configuration used by Storm Software across many projects.

34 lines (31 loc) 1.15 kB
import { joinPaths } from "./chunk-4T2VGUKQ.js"; import { init_esm_shims } from "./chunk-VQHWUYQL.js"; // src/utils/tsconfig-path.ts init_esm_shims(); import { existsSync, statSync } from "node:fs"; function getTsConfigPath(tsconfigPath = "./", workspaceRoot = "./") { let result = "tsconfig.json"; if (tsconfigPath && existsSync(tsconfigPath) && statSync(tsconfigPath).isFile()) { result = tsconfigPath; } else if (tsconfigPath === workspaceRoot && existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) { result = "tsconfig.base.json"; } else if (existsSync(joinPaths(tsconfigPath, "tsconfig.app.json"))) { result = "tsconfig.app.json"; } else if (existsSync(joinPaths(tsconfigPath, "tsconfig.lib.json"))) { result = "tsconfig.lib.json"; } else if (existsSync(joinPaths(workspaceRoot, "tsconfig.base.json"))) { result = "tsconfig.base.json"; } else { console.warn( `No tsconfig.json found${tsconfigPath !== "./" ? ` provided: ${tsconfigPath}` : ""}. Consider adding a tsconfig.json file to your project's ESLint configuration.` ); } return result; } export { getTsConfigPath };