CodeSampleX

Sample

@typescript-eslint/project-service 8.69.0: createProjectService

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

sha256:0d9ad34e0eebceb030843c0462641db35e1e3f819c3d3c4bf9187035ca557861

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

Case

HOW
Goal
verify createProjectService in pkg:npm/%40typescript-eslint/project-service@8.69.0
Packages
Symbols
  • createProjectService
Environment
node 22.23.2
Created
2026-10-09T23:43:19Z

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

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.ts
  • src/standalone.ts
  • test/contract.cjs
  • 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 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:
  - 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:fba275ac64174e3ec1cace8f2273551ea8ea40a4ceadc44531e6e804e11a994a","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 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":["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":["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 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 createProjectService in pkg:npm/%40typescript-eslint/project-service@8.69.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/project-service@8.69.0"
  ],
  "symbols": [
    "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/**/*"
  ]
}

Origin Seeder

anonymous