Ejemplo
@typescript-eslint/typescript-estree 8.67.0: createProgram
Muestra verificada para npm @typescript-eslint/typescript-estree 8.67.0: createProgram. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:e825f22ca4746331e2a805e0badd0326e6487fb3b3dd325c0e4d0f1637ab68ff
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-09-02 |
Caso
HOW- Objetivo
- verify createProgram in pkg:npm/%40typescript-eslint/typescript-estree@8.67.0
- Símbolos
-
- createProgram
- Entorno
- node 22.23.2
- Creado
- 2026-09-02T00:55:14Z
Contrato
- assert createProgram loads and parses tsconfig.json into a TypeScript Program instance
- assert createProgram resolves configuration relative to projectDirectory
- assert program.getCompilerOptions reflects settings from tsconfig.json
- assert program.getTypeChecker provides semantic type information for project symbols
- assert program.getSourceFile retrieves the ts.SourceFile AST for configured root files
- assert parseAndGenerateServices consumes createProgram instance to produce ESTree AST and type services
- assert createProgram throws diagnostic error when config file does not exist
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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 createProgram in pkg:npm/%40typescript-eslint/typescript-estree@8.67.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40typescript-eslint/typescript-estree@8.67.0
Demonstrate these symbols/APIs:
- createProgram
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.
{"case":{"caseId":"case:sha256:059c559b4963458590e429f9d2dedac66ec38a9783a1fb6e4906f194e3a7af95","contract":["assert createProgram loads and parses tsconfig.json into a TypeScript Program instance","assert createProgram resolves configuration relative to projectDirectory","assert program.getCompilerOptions reflects settings from tsconfig.json","assert program.getTypeChecker provides semantic type information for project symbols","assert program.getSourceFile retrieves the ts.SourceFile AST for configured root files","assert parseAndGenerateServices consumes createProgram instance to produce ESTree AST and type services","assert createProgram throws diagnostic error when config file does not exist"],"goal":"verify createProgram in pkg:npm/%40typescript-eslint/typescript-estree@8.67.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/typescript-estree@8.67.0"],"schemaVersion":1,"symbols":["createProgram"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","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/typescript-estree@8.67.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/typescript-estree@8.67.0","symbols":["createProgram"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-typescript-eslint-typescript-estree-create-program",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-typescript-eslint-typescript-estree-create-program",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/typescript-estree": "8.67.0"
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.67.0.tgz",
"integrity": "sha512-cvE8c7ulYeXN9fYuszhCeCsbzyVEXuhrRCybnBre7TUmqb5nRmBfQAwCj0O3WJFDeyAZt4VYv51vMCC9LHSdYw==",
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.67.0",
"@typescript-eslint/types": "^8.67.0",
"debug": "^4.4.3"
},
"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-eslint/tsconfig-utils": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.67.0.tgz",
"integrity": "sha512-vV+LUSv5njUWsknE71fqKTlXUva+R76SaeORd6Zojcunk/6DvKFXONU3BrAs2H49mbygUXt6gbYunzwqNwlhdg==",
"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-eslint/types": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.67.0.tgz",
"integrity": "sha512-sBtgslww8nsMYUjhdPBiSyUqSzT8uR6g93A2QXnQC8+cGdjz0CyaOdqHDRJb1AtORbZCNUJBBeFA/tNR2uQmww==",
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.67.0.tgz",
"integrity": "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw==",
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.67.0",
"@typescript-eslint/tsconfig-utils": "8.67.0",
"@typescript-eslint/types": "8.67.0",
"@typescript-eslint/visitor-keys": "8.67.0",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"semver": "^7.7.3",
"tinyglobby": "^0.2.15",
"ts-api-utils": "^2.5.0"
},
"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-eslint/visitor-keys": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.67.0.tgz",
"integrity": "sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA==",
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.67.0",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/balanced-match": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
"integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
"license": "MIT",
"engines": {
"node": "18 || 20 || >=22"
}
},
"node_modules/brace-expansion": {
"version": "5.0.9",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"engines": {
"node": "20 || >=22"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/eslint-visitor-keys": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
"integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
"license": "Apache-2.0",
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"license": "MIT",
"engines": {
"node": ">=12.0.0"
},
"peerDependencies": {
"picomatch": "^3 || ^4"
},
"peerDependenciesMeta": {
"picomatch": {
"optional": true
}
}
},
"node_modules/minimatch": {
"version": "10.2.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
"integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.8"
},
"engines": {
"node": "18 || 20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/picomatch": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/semver": {
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/tinyglobby": {
"version": "0.2.17",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
"license": "MIT",
"dependencies": {
"fdir": "^6.5.0",
"picomatch": "^4.0.4"
},
"engines": {
"node": ">=12.0.0"
},
"funding": {
"url": "https://github.com/sponsors/SuperchupuDev"
}
},
"node_modules/ts-api-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
"integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==",
"license": "MIT",
"engines": {
"node": ">=18.12"
},
"peerDependencies": {
"typescript": ">=4.8.4"
}
},
"node_modules/typescript": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}
{
"name": "sample-typescript-eslint-typescript-estree-create-program",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/typescript-estree": "8.67.0"
}
}
{
"schemaVersion": 1,
"goal": "verify createProgram in pkg:npm/%40typescript-eslint/typescript-estree@8.67.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40typescript-eslint/typescript-estree@8.67.0"
],
"symbols": [
"createProgram"
]
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { createProgram, parseAndGenerateServices } from '@typescript-eslint/typescript-estree';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Setup fixture directory for offline testing
const fixtureDir = path.join(__dirname, 'fixtures');
if (!fs.existsSync(fixtureDir)) {
fs.mkdirSync(fixtureDir, { recursive: true });
}
const tsconfigPath = path.join(fixtureDir, 'tsconfig.json');
const sourceFilePath = path.join(fixtureDir, 'example.ts');
const tsconfigContent = {
compilerOptions: {
target: 'ES2022',
module: 'commonjs',
strict: true,
skipLibCheck: true
},
include: ['example.ts']
};
const tsSourceCode = `
export interface User {
id: number;
name: string;
}
export function getUser(): User {
return { id: 1, name: 'Alice' };
}
`;
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfigContent, null, 2));
fs.writeFileSync(sourceFilePath, tsSourceCode);
try {
// 1. assert createProgram loads and parses tsconfig.json into a TypeScript Program instance
const program = createProgram('tsconfig.json', fixtureDir);
assert.ok(program, 'createProgram should return a program object');
assert.strictEqual(typeof program.getTypeChecker, 'function');
assert.strictEqual(typeof program.getSourceFiles, 'function');
assert.strictEqual(typeof program.getRootFileNames, 'function');
assert.strictEqual(typeof program.getCompilerOptions, 'function');
// 2. assert createProgram resolves configuration relative to projectDirectory
const rootFiles = program.getRootFileNames();
assert.ok(Array.isArray(rootFiles));
assert.ok(rootFiles.length > 0);
assert.ok(rootFiles.some((f) => f.includes('example.ts')));
// 3. assert program.getCompilerOptions reflects settings from tsconfig.json
const compilerOptions = program.getCompilerOptions();
assert.strictEqual(compilerOptions.strict, true);
assert.strictEqual(compilerOptions.skipLibCheck, true);
// 4. assert program.getTypeChecker provides semantic type information for project symbols
const checker = program.getTypeChecker();
assert.ok(checker, 'getTypeChecker should return a TypeChecker instance');
assert.strictEqual(typeof checker.getTypeAtLocation, 'function');
assert.strictEqual(typeof checker.getSymbolAtLocation, 'function');
// 5. assert program.getSourceFile retrieves the ts.SourceFile AST for configured root files
const sourceFile = program.getSourceFile(sourceFilePath);
assert.ok(sourceFile, 'getSourceFile should return a SourceFile for existing path');
assert.strictEqual(typeof sourceFile.text, 'string');
assert.ok(sourceFile.text.includes('getUser'));
// 6. assert parseAndGenerateServices consumes createProgram instance to produce ESTree AST and type services
const services = parseAndGenerateServices(tsSourceCode, {
filePath: sourceFilePath,
programs: [program]
});
assert.ok(services.ast, 'services should contain parsed ESTree AST');
assert.strictEqual(services.ast.type, 'Program');
assert.ok(services.services, 'services object should be present');
assert.strictEqual(services.services.program, program);
assert.ok(services.services.esTreeNodeToTSNodeMap, 'esTreeNodeToTSNodeMap should be present');
assert.ok(services.services.tsNodeToESTreeNodeMap, 'tsNodeToESTreeNodeMap should be present');
// 7. assert createProgram throws diagnostic error when config file does not exist
assert.throws(
() => {
createProgram('nonexistent-tsconfig.json', fixtureDir);
},
(err) => {
assert.ok(err instanceof Error);
assert.ok(err.message.includes('Cannot read file') || err.message.includes('TS5012'));
return true;
}
);
console.log('All contract assertions passed successfully.');
} finally {
// Cleanup fixture files
if (fs.existsSync(fixtureDir)) {
fs.rmSync(fixtureDir, { recursive: true, force: true });
}
}
Seeder de origen
anónimo