1/** 2 * @factory/config — shared toolchain configuration. 3 * 4 * The canonical artifacts live next to this module; they are also exported 5 * from here so tooling (build scripts, codegen, CI checks) can consume them 6 * programmatically without hardcoding paths: 7 * 8 * ```ts 9 * import { baseCompilerOptions, prettierBase, eslintBaseConfig } from "@factory/config"; 10 * ``` 11 * 12 * JSON is loaded via `createRequire` — static JSON imports would need import 13 * attributes on Node, and this keeps the package importable both in Node 14 * (source-first) and in any bundler. 15 */ 16 17import { createRequire } from "node:module"; 18import eslintBaseConfig from "./eslint.base.js"; 19 20const require = createRequire(import.meta.url); 21 22interface TsconfigBaseShape { 23 compilerOptions: Record<string, unknown>; 24} 25 26/** Compiler options shared by every package and app (see tsconfig.base.json). */ 27export const baseCompilerOptions: Record<string, unknown> = ( 28 require("./tsconfig.base.json") as TsconfigBaseShape 29).compilerOptions; 30 31/** Prettier settings shared by every package and app (mirrors root .prettierrc.json). */ 32export const prettierBase: Record<string, unknown> = require("./prettier.base.json"); 33 34/** 35 * ESLint base (eslintrc shape, matching root .eslintrc.json conventions). 36 * Named re-export so `import { eslintBaseConfig } from "@factory/config"`. 37 */ 38export { eslintBaseConfig }; 39export type EslintBaseConfig = typeof eslintBaseConfig; 40 41/** 42 * Convenience: the `extends` entry a new package tsconfig should use (relative 43 * to packages/<name>/), plus the include globs. 44 */ 45export const newPackageTsconfig = { 46 extends: "../../tsconfig.json", 47 compilerOptions: { noEmit: true }, 48 include: ["src"], 49} as const; 50