CodeSampleX

Beispiel

@eslint/core 0.13.0

Verifiziertes Beispiel für npm @eslint/core 0.13.0. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: package manifest specifies ESM and…

sha256:72c8aabd206479f6154246da7081a8bbec409f321b13f1d051bc7bdb8793ced0

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

Fall

HOW
Ziel
verify pkg:npm/%40eslint/core@0.13.0
Pakete
Erstellt
2026-08-28T10:06:22Z

Contract

  1. package manifest specifies ESM and CJS type declaration exports and dependency on @types/json-schema
  2. declares Language, File, and ParseResult interfaces for language plugins, source AST parsing, and error reporting
  3. declares RuleDefinition, RuleContext, and RulesMeta interfaces with generic rule options, visitor methods, deprecation info, and violation reporting
  4. declares SourceCodeBase, TextSourceCode, and BinarySourceCode interfaces supporting AST traversal, getLoc, and getRange
  5. declares TraversalStep discriminated union with VisitTraversalStep and CallTraversalStep for AST walking
  6. declares configuration, directive, and editor types including LinterOptionsConfig, Directive, and RuleTextEditor

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • 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/%40eslint/core@0.13.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40eslint/core@0.13.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:efee6839dee704632b826eaf16f3728161bf8b8d73343519602a1aae144ee16b","contract":["package manifest specifies ESM and CJS type declaration exports and dependency on @types/json-schema","declares Language, File, and ParseResult interfaces for language plugins, source AST parsing, and error reporting","declares RuleDefinition, RuleContext, and RulesMeta interfaces with generic rule options, visitor methods, deprecation info, and violation reporting","declares SourceCodeBase, TextSourceCode, and BinarySourceCode interfaces supporting AST traversal, getLoc, and getRange","declares TraversalStep discriminated union with VisitTraversalStep and CallTraversalStep for AST walking","declares configuration, directive, and editor types including LinterOptionsConfig, Directive, and RuleTextEditor"],"goal":"verify pkg:npm/%40eslint/core@0.13.0","kind":"HOW","packages":["pkg:npm/%40eslint/core@0.13.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/%40eslint/core@0.13.0"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/core@0.13.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-eslint-core",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-eslint-core",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@eslint/core": "0.13.0"
      }
    },
    "node_modules/@eslint/core": {
      "version": "0.13.0",
      "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.13.0.tgz",
      "integrity": "sha512-yfkgDw1KR66rkT5A8ci4irzDysN7FRpq3ttJolR88OqQikAWqwA8j5VZyas+vjyBNFIJ7MfybJ9plMILI2UrCw==",
      "license": "Apache-2.0",
      "dependencies": {
        "@types/json-schema": "^7.0.15"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      }
    },
    "node_modules/@types/json-schema": {
      "version": "7.0.15",
      "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
      "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-eslint-core",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@eslint/core": "0.13.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40eslint/core@0.13.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40eslint/core@0.13.0"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';

// Locate package directory from node_modules relative to process.cwd() or import.meta.url
const cwdPkgDir = path.resolve(process.cwd(), 'node_modules/@eslint/core');
const scriptRelativePkgDir = path.resolve(path.dirname(new URL(import.meta.url).pathname), '../node_modules/@eslint/core');
const pkgDir = fs.existsSync(cwdPkgDir) ? cwdPkgDir : scriptRelativePkgDir;
const pkgPath = path.join(pkgDir, 'package.json');

assert.ok(fs.existsSync(pkgPath), 'package.json must exist in node_modules/@eslint/core');

const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

// 1. Resolve @eslint/core package manifest and verify type declaration export paths
assert.equal(pkg.name, '@eslint/core', 'Package name must be @eslint/core');
assert.equal(pkg.version, '0.13.0', 'Package version must be 0.13.0');
assert.equal(pkg.type, 'module', 'Package type must be module');
assert.equal(pkg.types, './dist/esm/types.d.ts', 'types entry must point to ./dist/esm/types.d.ts');
assert.equal(
  pkg.exports?.types?.import,
  './dist/esm/types.d.ts',
  'ESM types export must point to ./dist/esm/types.d.ts'
);
assert.equal(
  pkg.exports?.types?.require,
  './dist/cjs/types.d.cts',
  'CJS types export must point to ./dist/cjs/types.d.cts'
);
assert.ok(
  pkg.dependencies?.['@types/json-schema'],
  'Package must declare dependency on @types/json-schema'
);

const esmDtsContent = fs.readFileSync(path.join(pkgDir, 'dist/esm/types.d.ts'), 'utf8');
const cjsDtsContent = fs.readFileSync(path.join(pkgDir, 'dist/cjs/types.d.cts'), 'utf8');

// 2. Verify Language, File, and ParseResult interfaces
assert.ok(
  esmDtsContent.includes('export interface Language<Options extends LanguageTypeOptions'),
  'Language interface with LanguageTypeOptions generic must be exported'
);
assert.ok(
  esmDtsContent.includes('fileType: "text";') &&
  esmDtsContent.includes('lineStart: 0 | 1;') &&
  esmDtsContent.includes('columnStart: 0 | 1;') &&
  esmDtsContent.includes('nodeTypeKey: string;') &&
  esmDtsContent.includes('validateLanguageOptions(languageOptions: Options["LangOptions"]): void;') &&
  esmDtsContent.includes('parse(file: File, context: LanguageContext<Options["LangOptions"]>): ParseResult<Options["RootNode"]>;') &&
  esmDtsContent.includes('createSourceCode(file: File, input: OkParseResult<Options["RootNode"]>, context: LanguageContext<Options["LangOptions"]>): Options["Code"];'),
  'Language interface must declare fileType, lineStart, columnStart, nodeTypeKey, validateLanguageOptions, parse, and createSourceCode'
);
assert.ok(
  esmDtsContent.includes('export interface File {') &&
  esmDtsContent.includes('path: string;') &&
  esmDtsContent.includes('physicalPath: string;') &&
  esmDtsContent.includes('bom: boolean;') &&
  esmDtsContent.includes('body: string | Uint8Array;'),
  'File interface must declare path, physicalPath, bom, and body'
);
assert.ok(
  esmDtsContent.includes('export interface OkParseResult<RootNode = unknown> {') &&
  esmDtsContent.includes('export interface NotOkParseResult {') &&
  esmDtsContent.includes('export type ParseResult<RootNode = unknown> = OkParseResult<RootNode> | NotOkParseResult;'),
  'ParseResult discriminated union with OkParseResult and NotOkParseResult must be exported'
);

// 3. Verify RuleDefinition, RuleContext, and RulesMeta interfaces
assert.ok(
  esmDtsContent.includes('export interface RuleDefinition<Options extends RuleDefinitionTypeOptions'),
  'RuleDefinition interface must be exported'
);
assert.ok(
  esmDtsContent.includes('export interface RuleContext<Options extends RuleContextTypeOptions'),
  'RuleContext interface must be exported'
);
assert.ok(
  esmDtsContent.includes('export interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[], ExtRuleDocs = unknown> {'),
  'RulesMeta interface must be exported with generic MessageIds, RuleOptions, and ExtRuleDocs'
);
assert.ok(
  esmDtsContent.includes('defaultOptions?: RuleOptions;') &&
  esmDtsContent.includes('dialects?: string[];') &&
  esmDtsContent.includes('language?: string;'),
  'RulesMeta must support defaultOptions, dialects, and language'
);
assert.ok(
  esmDtsContent.includes('export interface DeprecatedInfo {') &&
  esmDtsContent.includes('export interface ReplacedByInfo {'),
  'DeprecatedInfo and ReplacedByInfo interfaces must be exported'
);
assert.ok(
  esmDtsContent.includes('cwd: string;') &&
  esmDtsContent.includes('filename: string;') &&
  esmDtsContent.includes('physicalFilename: string;') &&
  esmDtsContent.includes('sourceCode: Options["Code"];') &&
  esmDtsContent.includes('settings: SettingsConfig;') &&
  esmDtsContent.includes('languageOptions: Options["LangOptions"];') &&
  esmDtsContent.includes('id: string;') &&
  esmDtsContent.includes('options: Options["RuleOptions"];') &&
  esmDtsContent.includes('report(violation: ViolationReport<Options["Node"], Options["MessageIds"]>): void;'),
  'RuleContext must provide cwd, filename, physicalFilename, sourceCode, settings, languageOptions, id, options, report'
);
assert.ok(
  esmDtsContent.includes('export type RuleVisitor = Record<string, ((...args: any[]) => void) | undefined>;'),
  'RuleVisitor type alias must be exported'
);

// 4. Verify SourceCodeBase, TextSourceCode, and BinarySourceCode interfaces
assert.ok(
  esmDtsContent.includes('interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions'),
  'SourceCodeBase interface must be declared'
);
assert.ok(
  esmDtsContent.includes('getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation;') &&
  esmDtsContent.includes('getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange;') &&
  esmDtsContent.includes('traverse(): Iterable<TraversalStep>;'),
  'SourceCodeBase must declare getLoc, getRange, and traverse methods'
);
assert.ok(
  esmDtsContent.includes('export interface TextSourceCode<') &&
  esmDtsContent.includes('text: string;') &&
  esmDtsContent.includes('export interface BinarySourceCode<') &&
  esmDtsContent.includes('body: Uint8Array;') &&
  esmDtsContent.includes('export type SourceCode<Options extends SourceCodeBaseTypeOptions'),
  'TextSourceCode, BinarySourceCode, and SourceCode union must be exported'
);
assert.ok(
  esmDtsContent.includes('export interface SourceLocation {') &&
  esmDtsContent.includes('start: Position;') &&
  esmDtsContent.includes('end: Position;') &&
  esmDtsContent.includes('export type SourceRange = [number, number];'),
  'SourceLocation and SourceRange must be exported'
);

// 5. Verify TraversalStep discriminated union
assert.ok(
  esmDtsContent.includes('export interface VisitTraversalStep {') &&
  esmDtsContent.includes('kind: 1;') &&
  esmDtsContent.includes('phase: 1 | 2;') &&
  esmDtsContent.includes('export interface CallTraversalStep {') &&
  esmDtsContent.includes('kind: 2;') &&
  esmDtsContent.includes('target: string;') &&
  esmDtsContent.includes('export type TraversalStep = VisitTraversalStep | CallTraversalStep;'),
  'TraversalStep discriminated union with VisitTraversalStep and CallTraversalStep must be exported'
);

// 6. Verify configuration, directive, and editor types
assert.ok(
  esmDtsContent.includes('export interface LinterOptionsConfig {') &&
  esmDtsContent.includes('noInlineConfig?: boolean;') &&
  esmDtsContent.includes('reportUnusedDisableDirectives?: boolean | Severity;'),
  'LinterOptionsConfig interface must declare noInlineConfig and reportUnusedDisableDirectives'
);
assert.ok(
  esmDtsContent.includes('export interface Directive {') &&
  esmDtsContent.includes('type: DirectiveType;') &&
  esmDtsContent.includes('node: unknown;') &&
  esmDtsContent.includes('value: string;') &&
  esmDtsContent.includes('justification?: string;'),
  'Directive interface must declare type, node, value, and justification'
);
assert.ok(
  esmDtsContent.includes('export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";'),
  'DirectiveType must include disable, enable, disable-line, and disable-next-line'
);
assert.ok(
  esmDtsContent.includes('export interface RuleTextEditor<EditableSyntaxElement = unknown> {') &&
  esmDtsContent.includes('insertTextAfter(') &&
  esmDtsContent.includes('insertTextBefore(') &&
  esmDtsContent.includes('remove(') &&
  esmDtsContent.includes('replaceText(') &&
  esmDtsContent.includes('replaceTextRange('),
  'RuleTextEditor interface must declare insertTextAfter, insertTextBefore, remove, replaceText, replaceTextRange'
);
assert.ok(
  esmDtsContent.includes('export interface RuleTextEdit {') &&
  esmDtsContent.includes('range: SourceRange;') &&
  esmDtsContent.includes('text: string;'),
  'RuleTextEdit interface must declare range and text'
);

// 7. Verify CJS declaration mirrors ESM declaration
assert.equal(
  cjsDtsContent,
  esmDtsContent,
  'dist/cjs/types.d.cts must match dist/esm/types.d.ts'
);

console.log('Contract tests passed successfully.');

Ursprungs-Seeder

anonym