CodeSampleX

Sample

@typescript-eslint/tsconfig-utils 8.69.0: getParsedConfigFile

Verified sample for npm @typescript-eslint/tsconfig-utils 8.69.0: getParsedConfigFile. The contract ran on node 22 · linux debian/x64 · docker and passed.

sha256:5669a8f52ced3ed973455ec9b540629f407aacbfd773eabd0dfe4d35a76496e0

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-10-11

Case

HOW
Goal
verify @typescript-eslint/tsconfig-utils.getParsedConfigFile in pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0
Packages
Symbols
  • @typescript-eslint/tsconfig-utils.getParsedConfigFile
Environment
node 22.23.2
Created
2026-10-11T17:23:15Z

Contract

  1. getParsedConfigFile parses a valid tsconfig.json and returns compiler options and matched file names
  2. getParsedConfigFile resolves configuration relative to a custom projectDirectory
  3. getParsedConfigFile inherits and overrides compiler options when tsconfig extends another config
  4. getParsedConfigFile throws descriptive error when tsconfig file contains invalid syntax
  5. getParsedConfigFile throws error when tsserver.sys is undefined

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.cjs
  • test/fixtures/basic/src/main.ts
  • test/fixtures/basic/tsconfig.json
  • test/fixtures/extended/entry.ts
  • test/fixtures/extended/tsconfig.base.json
  • test/fixtures/extended/tsconfig.json
  • test/fixtures/invalid/tsconfig.json

Download the source artifact (tar.gz)

Source

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify @typescript-eslint/tsconfig-utils.getParsedConfigFile in pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0
Demonstrate these symbols/APIs:
  - @typescript-eslint/tsconfig-utils.getParsedConfigFile

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:028a8bdf54349746ff7ff8a5772e070940095498f23dd798bbea6c407fa2d73d","contract":["getParsedConfigFile parses a valid tsconfig.json and returns compiler options and matched file names","getParsedConfigFile resolves configuration relative to a custom projectDirectory","getParsedConfigFile inherits and overrides compiler options when tsconfig extends another config","getParsedConfigFile throws descriptive error when tsconfig file contains invalid syntax","getParsedConfigFile throws error when tsserver.sys is undefined"],"goal":"verify @typescript-eslint/tsconfig-utils.getParsedConfigFile in pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0"],"schemaVersion":1,"symbols":["@typescript-eslint/tsconfig-utils.getParsedConfigFile"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0","symbols":["@typescript-eslint/tsconfig-utils.getParsedConfigFile"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "verify-tsconfig-utils-get-parsed-config-file",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "verify-tsconfig-utils-get-parsed-config-file",
      "version": "1.0.0",
      "dependencies": {
        "@typescript-eslint/tsconfig-utils": "8.69.0",
        "typescript": "5.7.3"
      }
    },
    "node_modules/@typescript-eslint/tsconfig-utils": {
      "version": "8.69.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.69.0.tgz",
      "integrity": "sha512-xNqK7YTDZsLniQMV/4rpFR8Z5JlqeRvVjuG1YgF/mdPVH84HSD19L8CczMA0qg2RfwEV231GHH3VnToJDo4MfQ==",
      "license": "MIT",
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/typescript-eslint"
      },
      "peerDependencies": {
        "typescript": ">=4.8.4 <6.1.0"
      }
    },
    "node_modules/typescript": {
      "version": "5.7.3",
      "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
      "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
      "license": "Apache-2.0",
      "bin": {
        "tsc": "bin/tsc",
        "tsserver": "bin/tsserver"
      },
      "engines": {
        "node": ">=14.17"
      }
    }
  }
}
package.json
{
  "name": "verify-tsconfig-utils-get-parsed-config-file",
  "version": "1.0.0",
  "private": true,
  "description": "verify @typescript-eslint/tsconfig-utils.getParsedConfigFile in pkg:npm/@typescript-eslint/tsconfig-utils@8.69.0",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "@typescript-eslint/tsconfig-utils": "8.69.0",
    "typescript": "5.7.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @typescript-eslint/tsconfig-utils.getParsedConfigFile in pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0"
  ],
  "symbols": [
    "@typescript-eslint/tsconfig-utils.getParsedConfigFile"
  ]
}
src/index.js
'use strict';

const { getParsedConfigFile } = require('@typescript-eslint/tsconfig-utils');

/**
 * Parses a TSConfig file using the provided TypeScript compiler instance.
 *
 * @param {object} ts - The typescript compiler API module
 * @param {string} configFile - Path to tsconfig.json relative to projectDirectory
 * @param {string} [projectDirectory] - The project root directory
 * @returns {object} The parsed command line configuration
 */
function parseConfigFile(ts, configFile, projectDirectory) {
  return getParsedConfigFile(ts, configFile, projectDirectory);
}

/**
 * Extracts compiler options from a parsed tsconfig file.
 *
 * @param {object} ts - The typescript compiler API module
 * @param {string} configFile - Path to tsconfig.json relative to projectDirectory
 * @param {string} [projectDirectory] - The project root directory
 * @returns {object} The resolved compiler options
 */
function getCompilerOptions(ts, configFile, projectDirectory) {
  const parsed = getParsedConfigFile(ts, configFile, projectDirectory);
  return parsed.options;
}

/**
 * Extracts matched source file paths from a parsed tsconfig file.
 *
 * @param {object} ts - The typescript compiler API module
 * @param {string} configFile - Path to tsconfig.json relative to projectDirectory
 * @param {string} [projectDirectory] - The project root directory
 * @returns {string[]} List of matched file paths
 */
function getMatchedFiles(ts, configFile, projectDirectory) {
  const parsed = getParsedConfigFile(ts, configFile, projectDirectory);
  return parsed.fileNames;
}

module.exports = {
  getParsedConfigFile,
  parseConfigFile,
  getCompilerOptions,
  getMatchedFiles,
};
test/contract.cjs
'use strict';

const assert = require('node:assert/strict');
const path = require('node:path');
const ts = require('typescript');
const {
  getParsedConfigFile,
  parseConfigFile,
  getCompilerOptions,
  getMatchedFiles,
} = require('../src/index.js');

const fixturesDir = path.join(__dirname, 'fixtures');

// 1. getParsedConfigFile parses a valid tsconfig.json and returns compiler options and matched file names
const basicDir = path.join(fixturesDir, 'basic');
const basicParsed = getParsedConfigFile(ts, 'tsconfig.json', basicDir);

assert.ok(basicParsed !== null && typeof basicParsed === 'object', 'parsed config must be an object');
assert.strictEqual(basicParsed.options.strict, true, 'strict option must be true');
assert.strictEqual(basicParsed.options.target, ts.ScriptTarget.ES2022, 'target option must match ES2022');
assert.strictEqual(basicParsed.options.module, ts.ModuleKind.CommonJS, 'module option must match CommonJS');
assert.ok(Array.isArray(basicParsed.fileNames), 'fileNames must be an array');
assert.ok(
  basicParsed.fileNames.some((f) => f.endsWith('main.ts')),
  'fileNames must contain main.ts matching include pattern'
);

const helperOptions = getCompilerOptions(ts, 'tsconfig.json', basicDir);
assert.strictEqual(helperOptions.strict, true, 'helper getCompilerOptions must extract options correctly');

const helperFiles = getMatchedFiles(ts, 'tsconfig.json', basicDir);
assert.ok(
  helperFiles.some((f) => f.endsWith('main.ts')),
  'helper getMatchedFiles must extract fileNames correctly'
);

// 2. getParsedConfigFile resolves configuration relative to a custom projectDirectory
const parsedWithCustomDir = parseConfigFile(ts, 'tsconfig.json', basicDir);
assert.ok(parsedWithCustomDir !== null, 'parsed configuration with custom projectDirectory must be valid');
assert.ok(
  parsedWithCustomDir.fileNames[0].startsWith(basicDir),
  'resolved file paths must be rooted in custom projectDirectory'
);

// 3. getParsedConfigFile inherits and overrides compiler options when tsconfig extends another config
const extendedDir = path.join(fixturesDir, 'extended');
const extendedParsed = getParsedConfigFile(ts, 'tsconfig.json', extendedDir);

assert.strictEqual(
  extendedParsed.options.declaration,
  true,
  'declaration option inherited from base config must be true'
);
assert.strictEqual(
  extendedParsed.options.target,
  ts.ScriptTarget.ES2020,
  'target option inherited from base config must be ES2020'
);
assert.strictEqual(
  extendedParsed.options.noImplicitAny,
  false,
  'noImplicitAny option in extending config must override base config'
);
assert.ok(
  extendedParsed.fileNames.some((f) => f.endsWith('entry.ts')),
  'files list must contain entry.ts'
);

// 4. getParsedConfigFile throws descriptive error when tsconfig file contains invalid syntax
const invalidDir = path.join(fixturesDir, 'invalid');
assert.throws(
  () => getParsedConfigFile(ts, 'tsconfig.json', invalidDir),
  /Unable to parse the specified 'tsconfig' file/,
  'must throw error when tsconfig has invalid syntax'
);

// 5. getParsedConfigFile throws error when tsserver.sys is undefined
const fakeTsserver = { ...ts, sys: undefined };
assert.throws(
  () => getParsedConfigFile(fakeTsserver, 'tsconfig.json', basicDir),
  /`getParsedConfigFile` is only supported in a Node-like environment/,
  'must throw error when tsserver.sys is undefined'
);

console.log('Contract assertions passed successfully.');
test/fixtures/basic/src/main.ts
export const greeting = "hello";
test/fixtures/basic/tsconfig.json
{
  "compilerOptions": {
    "target": "es2022",
    "module": "commonjs",
    "strict": true
  },
  "include": [
    "src/**/*"
  ]
}
test/fixtures/extended/entry.ts
export const answer = 42;
test/fixtures/extended/tsconfig.base.json
{
  "compilerOptions": {
    "target": "es2020",
    "declaration": true,
    "noImplicitAny": true
  }
}
test/fixtures/extended/tsconfig.json
{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "noImplicitAny": false
  },
  "files": [
    "entry.ts"
  ]
}
test/fixtures/invalid/tsconfig.json
{ "compilerOptions": { INVALID SYNTAX

Origin Seeder

anonymous