CodeSampleX

Beispiel

@typescript-eslint/tsconfig-utils 8.69.0

Verifiziertes Beispiel für npm @typescript-eslint/tsconfig-utils 8.69.0. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.

sha256:006226f3b7c404f9746dec42b351d0527a6ca2c45ab6c0d11e35e6ec2465b8b7

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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-19

Fall

HOW
Ziel
verify pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0
Pakete
Erstellt
2026-09-17T21:49:52Z

Contract

  1. CORE_COMPILER_OPTIONS defines required compiler options including noEmit noUnusedLocals and noUnusedParameters
  2. getParsedConfigFile parses tsconfig.json and enforces CORE_COMPILER_OPTIONS in parsed compiler options
  3. getParsedConfigFile resolves source file paths according to tsconfig files and include configurations
  4. getParsedConfigFile throws diagnostic error when tsconfig file contains invalid syntax or cannot be read
  5. getParsedConfigFile throws error when invoked in a non-Node environment without tsserver sys

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.mjs

Quellartefakt herunterladen (tar.gz)

Quelltext

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 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

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:ff920c1934531b4e5c77916bbf54702a03553242663c4c39fef508204408718a","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/%40typescript-eslint/tsconfig-utils@8.69.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","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","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "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.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": "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.69.0",
    "typescript": "5.7.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/tsconfig-utils@8.69.0"
  ]
}
src/index.js
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
};
test/contract.mjs
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);
});

Ursprungs-Seeder

anonym