CodeSampleX

Beispiel

@typescript-eslint/project-service 8.69.0: createProjectService

Verifiziertes Beispiel für npm @typescript-eslint/project-service 8.69.0: createProjectService. Der Vertrag lief auf node 22 · linux debian/x64 · docker und…

sha256:755b0cf4d6e323932b2611c4e3e5b5cae2ea8df3b27fdd7fae16cfccb6fce089

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 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

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

Fall

HOW
Ziel
verify @typescript-eslint/project-service.createProjectService in pkg:npm/%40typescript-eslint/project-service@8.69.0
Pakete
Symbole
  • @typescript-eslint/project-service.createProjectService
Umgebung
node 22.23.2
Erstellt
2026-10-09T22:00:30Z

Contract

  1. createProjectService returns ProjectServiceAndMetadata with configured options and timestamp
  2. service opens TypeScript source file associating it with tsconfig.json
  3. service retrieves open ScriptInfo confirming file is tracked
  4. service opens standalone file permitted by allowDefaultProject

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.ts
  • src/standalone.ts
  • test/contract.cjs
  • tsconfig.json

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 @typescript-eslint/project-service.createProjectService in pkg:npm/%40typescript-eslint/project-service@8.69.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40typescript-eslint/project-service@8.69.0
Demonstrate these symbols/APIs:
  - @typescript-eslint/project-service.createProjectService
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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:87973d0e253013c4e5ad984d2c7c787d5e0cb7678dc7cf5404485f2c2cf9a72b","constraints":{"executionContext":"node"},"contract":["createProjectService returns ProjectServiceAndMetadata with configured options and timestamp","service opens TypeScript source file associating it with tsconfig.json","service retrieves open ScriptInfo confirming file is tracked","service opens standalone file permitted by allowDefaultProject"],"goal":"verify @typescript-eslint/project-service.createProjectService in pkg:npm/%40typescript-eslint/project-service@8.69.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/project-service@8.69.0"],"schemaVersion":1,"symbols":["@typescript-eslint/project-service.createProjectService"]},"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/project-service@8.69.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/project-service@8.69.0","symbols":["@typescript-eslint/project-service.createProjectService"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-project-service-create",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-project-service-create",
      "version": "1.0.0",
      "dependencies": {
        "@typescript-eslint/project-service": "8.69.0",
        "typescript": "5.7.3"
      }
    },
    "node_modules/@typescript-eslint/project-service": {
      "version": "8.69.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.69.0.tgz",
      "integrity": "sha512-yi4obFrHMmnsesWehHbkg9zMA7Jt8cXT+mKM08G999pH1yT6nqgsHx7MYm0uY1wAj8CqiBXYRJ7WAT0QdQHQXg==",
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/tsconfig-utils": "^8.69.0",
        "@typescript-eslint/types": "^8.69.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.71.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.71.1.tgz",
      "integrity": "sha512-oTvkml5SxXhgg+WWKhod5qWQICDXtOB+/Hi9VdPKFAANJ2b7YOgMffgvzXuqog7R6A/JtrzRf128dsxummyWhg==",
      "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.71.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.71.1.tgz",
      "integrity": "sha512-ybYnPTUwg3VQQOFEiBPLs8Jxl1ry2vXdn1kVKguomBbvxpetdu3MKTNDqFNUrlG8ylP9MpZosmXMFYlGQHk1oQ==",
      "license": "MIT",
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/typescript-eslint"
      }
    },
    "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/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/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-project-service-create",
  "version": "1.0.0",
  "description": "Clean-room code sample verifying @typescript-eslint/project-service.createProjectService in @typescript-eslint/project-service@8.69.0",
  "main": "src/index.ts",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "@typescript-eslint/project-service": "8.69.0",
    "typescript": "5.7.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @typescript-eslint/project-service.createProjectService in pkg:npm/%40typescript-eslint/project-service@8.69.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/project-service@8.69.0"
  ],
  "symbols": [
    "@typescript-eslint/project-service.createProjectService"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.ts
export function greet(name: string): string {
  return `Hello, ${name}!`;
}
src/standalone.ts
export const ANSWER = 42;
test/contract.cjs
const assert = require('assert');
const path = require('path');
const { createProjectService } = require('@typescript-eslint/project-service');

function runContract() {
  const rootDir = path.resolve(__dirname, '..');
  const result = createProjectService({
    tsconfigRootDir: rootDir,
    options: {
      defaultProject: 'tsconfig.json',
      maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 10,
      allowDefaultProject: ['src/standalone.ts']
    }
  });

  // Assertion 1: createProjectService returns ProjectServiceAndMetadata with configured options and timestamp
  assert(result !== null && typeof result === 'object', 'Result must be an object');
  assert(result.service !== null && typeof result.service === 'object', 'service must be an object');
  assert(typeof result.lastReloadTimestamp === 'number' && result.lastReloadTimestamp > 0, 'lastReloadTimestamp must be a positive number');
  assert.strictEqual(result.maximumDefaultProjectFileMatchCount, 10, 'maximumDefaultProjectFileMatchCount must match configured value');
  assert.deepStrictEqual(result.allowDefaultProject, ['src/standalone.ts'], 'allowDefaultProject must match configured array');

  // Assertion 2: service opens TypeScript source file associating it with tsconfig.json
  const targetFile = path.join(rootDir, 'src', 'index.ts');
  const openResult = result.service.openClientFile(targetFile);
  assert(openResult !== null && typeof openResult === 'object', 'openClientFile must return an object');
  assert(openResult.configFileName && openResult.configFileName.endsWith('tsconfig.json'), 'configFileName must resolve to tsconfig.json');
  assert(Array.isArray(openResult.configFileErrors) && openResult.configFileErrors.length === 0, 'configFileErrors must be empty');

  // Assertion 3: service retrieves open ScriptInfo confirming file is tracked
  const scriptInfo = result.service.getScriptInfo(targetFile);
  assert(scriptInfo !== null && typeof scriptInfo === 'object', 'ScriptInfo must not be null');
  assert.strictEqual(scriptInfo.fileName, targetFile, 'ScriptInfo fileName must match target file');
  assert.strictEqual(scriptInfo.isScriptOpen(), true, 'ScriptInfo must report script is open');

  // Assertion 4: service opens standalone file permitted by allowDefaultProject
  const standaloneFile = path.join(rootDir, 'src', 'standalone.ts');
  const standaloneResult = result.service.openClientFile(standaloneFile);
  assert(standaloneResult !== null && typeof standaloneResult === 'object', 'openClientFile for standalone file must return an object');
  const standaloneScriptInfo = result.service.getScriptInfo(standaloneFile);
  assert(standaloneScriptInfo !== null && typeof standaloneScriptInfo === 'object', 'ScriptInfo for standalone file must not be null');
  assert.strictEqual(standaloneScriptInfo.fileName, standaloneFile, 'ScriptInfo fileName must match standalone file');

  console.log('Contract assertions passed successfully.');
}

runContract();
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "commonjs",
    "moduleResolution": "node",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": [
    "src/**/*"
  ]
}

Ursprungs-Seeder

anonym