Exemplo
@typescript-eslint/tsconfig-utils 8.65.0
Amostra verificada para npm @typescript-eslint/tsconfig-utils 8.65.0. O contrato rodou em node 22 · linux alpine/x64 · docker e passou.
sha256:a162932de77c6a9b0c2eb2aa243eaad94a29ce645d3ec00e7f649aaff2666b04
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Caso
HOW- Objetivo
- verify pkg:npm/@typescript-eslint/tsconfig-utils@8.65.0
- Ambiente
- node 22.23.2
- Criado
- 2026-08-27T17:11:33Z
Contrato
- CORE_COMPILER_OPTIONS defines required compiler options including noEmit noUnusedLocals and noUnusedParameters
- getParsedConfigFile parses tsconfig.json and enforces CORE_COMPILER_OPTIONS in parsed compiler options
- getParsedConfigFile resolves source file paths according to tsconfig files and include configurations
- getParsedConfigFile throws diagnostic error when tsconfig file contains invalid syntax or cannot be read
- getParsedConfigFile throws error when invoked in a non-Node environment without tsserver sys
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Código-fonte
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 pkg:npm/@typescript-eslint/tsconfig-utils@8.65.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40typescript-eslint/tsconfig-utils@8.65.0
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:f35b67cecaf8f5ea2212d82a8b361394aeeeba29555b388744d31174a616a9a6","constraints":{"executionContext":"node"},"contract":["CORE_COMPILER_OPTIONS defines required compiler options including noEmit noUnusedLocals and noUnusedParameters","getParsedConfigFile parses tsconfig.json and enforces CORE_COMPILER_OPTIONS in parsed compiler options","getParsedConfigFile resolves source file paths according to tsconfig files and include configurations","getParsedConfigFile throws diagnostic error when tsconfig file contains invalid syntax or cannot be read","getParsedConfigFile throws error when invoked in a non-Node environment without tsserver sys"],"goal":"verify pkg:npm/@typescript-eslint/tsconfig-utils@8.65.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/tsconfig-utils@8.65.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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.65.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/tsconfig-utils@8.65.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-tsconfig-utils",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-tsconfig-utils",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "8.65.0",
"typescript": "5.7.3"
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.65.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.65.0.tgz",
"integrity": "sha512-j6GzGqCiRdA7Qhur2VVmKZAkBLfnHFQfx4TaJGL9RMveZqCo48jSHHO0DTgizEnGhtWnqmbtCUSrqSkdiY/0Hg==",
"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"
}
}
}
}
{
"name": "sample-tsconfig-utils",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for @typescript-eslint/tsconfig-utils",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "8.65.0",
"typescript": "5.7.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/@typescript-eslint/tsconfig-utils@8.65.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40typescript-eslint/tsconfig-utils@8.65.0"
]
}
const ts = require('typescript');
const {
CORE_COMPILER_OPTIONS,
getParsedConfigFile
} = require('@typescript-eslint/tsconfig-utils');
/**
* Returns the default core compiler options enforced by tsconfig-utils.
*
* @returns {object} The core compiler options.
*/
function getCoreCompilerOptions() {
return CORE_COMPILER_OPTIONS;
}
/**
* Parses a tsconfig file using TypeScript and tsconfig-utils logic.
*
* @param {string} configPath - Path to tsconfig.json relative to projectRoot.
* @param {string} [projectRoot] - Path to project root (defaults to process.cwd()).
* @returns {object} The parsed command line configuration.
*/
function loadParsedConfig(configPath, projectRoot) {
return getParsedConfigFile(ts, configPath, projectRoot);
}
module.exports = {
CORE_COMPILER_OPTIONS,
getParsedConfigFile,
getCoreCompilerOptions,
loadParsedConfig
};
import assert from 'node:assert/strict';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
CORE_COMPILER_OPTIONS,
getParsedConfigFile,
getCoreCompilerOptions,
loadParsedConfig
} = require('../src/index.js');
const ts = require('typescript');
async function runTests() {
// 1. CORE_COMPILER_OPTIONS defines required compiler options including noEmit noUnusedLocals and noUnusedParameters
assert.equal(typeof CORE_COMPILER_OPTIONS, 'object', 'CORE_COMPILER_OPTIONS must be an object');
assert.equal(CORE_COMPILER_OPTIONS.noEmit, true, 'noEmit must be true');
assert.equal(CORE_COMPILER_OPTIONS.noUnusedLocals, true, 'noUnusedLocals must be true');
assert.equal(CORE_COMPILER_OPTIONS.noUnusedParameters, true, 'noUnusedParameters must be true');
assert.deepEqual(getCoreCompilerOptions(), CORE_COMPILER_OPTIONS, 'getCoreCompilerOptions helper matches constant');
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-tsconfig-test-'));
try {
const srcDir = path.join(tmpDir, 'src');
fs.mkdirSync(srcDir, { recursive: true });
const dummySource = path.join(srcDir, 'index.ts');
fs.writeFileSync(dummySource, 'export const greeting = "hello";');
// 2. getParsedConfigFile parses tsconfig.json and enforces CORE_COMPILER_OPTIONS in parsed compiler options
const tsconfigPath = path.join(tmpDir, 'tsconfig.json');
fs.writeFileSync(
tsconfigPath,
JSON.stringify({
compilerOptions: {
target: 'ES2022',
module: 'commonjs',
strict: true,
noEmit: false,
noUnusedLocals: false
},
files: ['src/index.ts']
}, null, 2)
);
const parsed = loadParsedConfig('tsconfig.json', tmpDir);
assert.ok(parsed, 'Parsed config must not be null');
assert.equal(parsed.options.noEmit, true, 'noEmit must be overridden to true');
assert.equal(parsed.options.noUnusedLocals, true, 'noUnusedLocals must be overridden to true');
assert.equal(parsed.options.noUnusedParameters, true, 'noUnusedParameters must be set to true');
assert.equal(parsed.options.strict, true, 'strict option must be preserved');
// 3. getParsedConfigFile resolves source file paths according to tsconfig files and include configurations
assert.ok(Array.isArray(parsed.fileNames), 'fileNames must be an array');
assert.equal(parsed.fileNames.length, 1, 'fileNames should contain one matched file');
assert.equal(
path.resolve(parsed.fileNames[0]),
path.resolve(dummySource),
'fileNames must resolve to the source file path'
);
// 4. getParsedConfigFile throws diagnostic error when tsconfig file contains invalid syntax or cannot be read
const badConfigPath = path.join(tmpDir, 'bad-tsconfig.json');
fs.writeFileSync(badConfigPath, '{ compilerOptions: { target: ');
assert.throws(
() => {
getParsedConfigFile(ts, 'bad-tsconfig.json', tmpDir);
},
/Unable to parse the specified 'tsconfig' file/,
'Must throw diagnostic error on invalid tsconfig JSON syntax'
);
assert.throws(
() => {
getParsedConfigFile(ts, 'nonexistent-tsconfig.json', tmpDir);
},
/Cannot read file/,
'Must throw error on missing tsconfig file'
);
// 5. getParsedConfigFile throws error when invoked in a non-Node environment without tsserver sys
assert.throws(
() => {
getParsedConfigFile({}, 'tsconfig.json', tmpDir);
},
/only supported in a Node-like environment/,
'Must throw when tsserver.sys is undefined'
);
console.log('All contract assertions for @typescript-eslint/tsconfig-utils passed successfully.');
} finally {
fs.rmSync(tmpDir, { recursive: true, force: true });
}
}
runTests().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Seeder de origem
anônimo