CodeSampleX

Beispiel

@eslint/plugin-kit 0.7.3

Verifiziertes Beispiel für npm @eslint/plugin-kit 0.7.3. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.

sha256:53468ef8415c0ab1870233253d246c2954b17b5c413dde97e3ad03d18614d74a

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

Fall

HOW
Ziel
verify pkg:npm/%40eslint/plugin-kit@0.7.3
Pakete
Umgebung
node 22.23.2
Erstellt
2026-09-05T16:23:28Z

Contract

  1. assert ConfigCommentParser parseDirective extracts label, value, and justification
  2. assert ConfigCommentParser parseDirective handles directives without justification returning empty string
  3. assert ConfigCommentParser parseStringConfig maps comma and whitespace separated key-values with default null
  4. assert ConfigCommentParser parseListConfig parses comma-separated rule names into boolean map
  5. assert ConfigCommentParser parseJSONLikeConfig parses relaxed and commaless configurations into ok result with config
  6. assert ConfigCommentParser parseJSONLikeConfig returns ok false with error on invalid configuration syntax

Dateien

  • PROMPT.md
  • csx.json
  • index.js
  • 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/plugin-kit@0.7.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40eslint/plugin-kit@0.7.3
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:475758bad971f78e678c68d7028926948e2a4da5bd0c5ebeb720b4a8214d6440","constraints":{"executionContext":"node"},"contract":["assert ConfigCommentParser parseDirective extracts label, value, and justification","assert ConfigCommentParser parseDirective handles directives without justification returning empty string","assert ConfigCommentParser parseStringConfig maps comma and whitespace separated key-values with default null","assert ConfigCommentParser parseListConfig parses comma-separated rule names into boolean map","assert ConfigCommentParser parseJSONLikeConfig parses relaxed and commaless configurations into ok result with config","assert ConfigCommentParser parseJSONLikeConfig returns ok false with error on invalid configuration syntax"],"goal":"verify pkg:npm/%40eslint/plugin-kit@0.7.3","kind":"HOW","packages":["pkg:npm/%40eslint/plugin-kit@0.7.3"],"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/%40eslint/plugin-kit@0.7.3"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/plugin-kit@0.7.3","verifierAdapter":"node-typescript@1"}
index.js
const {
  ConfigCommentParser,
  Directive,
} = require("@eslint/plugin-kit");

/**
 * Service for parsing ESLint-style configuration comments and directives.
 */
class PluginCommentParser {
  /**
   * @param {ConfigCommentParser} [parser]
   */
  constructor(parser = new ConfigCommentParser()) {
    this.parser = parser;
  }

  /**
   * Parses an inline comment into a Directive object if it represents an ESLint directive.
   * @param {string} comment
   * @param {unknown} [node]
   * @returns {Directive|null}
   */
  parseDirective(comment, node = null) {
    const parsed = this.parser.parseDirective(comment);
    if (!parsed) {
      return null;
    }

    if (!parsed.label.startsWith("eslint-")) {
      return null;
    }

    const directiveType = parsed.label.slice("eslint-".length);
    const validTypes = ["disable", "enable", "disable-line", "disable-next-line"];
    if (!validTypes.includes(directiveType)) {
      return null;
    }

    return new Directive({
      type: directiveType,
      node,
      value: parsed.value,
      justification: parsed.justification,
    });
  }

  /**
   * Parses a global variables comment (e.g. "foo: readonly, bar: writable").
   * @param {string} comment
   * @returns {Record<string, string|null>}
   */
  parseGlobals(comment) {
    return this.parser.parseStringConfig(comment);
  }

  /**
   * Parses a comma-separated rule list (e.g. "rule-a, rule-b").
   * @param {string} comment
   * @returns {Record<string, boolean>}
   */
  parseRuleList(comment) {
    return this.parser.parseListConfig(comment);
  }

  /**
   * Parses a relaxed JSON-like rule configuration comment.
   * @param {string} comment
   * @returns {{ ok: boolean, config?: Record<string, unknown>, error?: { message: string } }}
   */
  parseRuleConfig(comment) {
    return this.parser.parseJSONLikeConfig(comment);
  }
}

module.exports = {
  PluginCommentParser,
  ConfigCommentParser,
  Directive,
};
package-lock.json
{
  "name": "sample-eslint-plugin-kit",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-eslint-plugin-kit",
      "version": "1.0.0",
      "dependencies": {
        "@eslint/plugin-kit": "0.7.3"
      },
      "license": "MIT-0"
    },
    "node_modules/@eslint/core": {
      "version": "1.2.1",
      "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz",
      "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==",
      "license": "Apache-2.0",
      "dependencies": {
        "@types/json-schema": "^7.0.15"
      },
      "engines": {
        "node": "^20.19.0 || ^22.13.0 || >=24"
      }
    },
    "node_modules/@eslint/plugin-kit": {
      "version": "0.7.3",
      "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz",
      "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==",
      "license": "Apache-2.0",
      "dependencies": {
        "@eslint/core": "^1.2.1",
        "levn": "^0.4.1"
      },
      "engines": {
        "node": "^20.19.0 || ^22.13.0 || >=24"
      }
    },
    "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"
    },
    "node_modules/levn": {
      "version": "0.4.1",
      "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
      "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
      "license": "MIT",
      "dependencies": {
        "prelude-ls": "^1.2.1",
        "type-check": "~0.4.0"
      },
      "engines": {
        "node": ">= 0.8.0"
      }
    },
    "node_modules/prelude-ls": {
      "version": "1.2.1",
      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
      "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.8.0"
      }
    },
    "node_modules/type-check": {
      "version": "0.4.0",
      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
      "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
      "license": "MIT",
      "dependencies": {
        "prelude-ls": "^1.2.1"
      },
      "engines": {
        "node": ">= 0.8.0"
      }
    }
  }
}
package.json
{
  "name": "sample-eslint-plugin-kit",
  "version": "1.0.0",
  "description": "Clean-room sample verifying @eslint/plugin-kit configuration comment parser",
  "main": "index.js",
  "license": "MIT-0",
  "dependencies": {
    "@eslint/plugin-kit": "0.7.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40eslint/plugin-kit@0.7.3",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40eslint/plugin-kit@0.7.3"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from "node:assert";
import {
  PluginCommentParser,
  ConfigCommentParser,
  Directive,
} from "../index.js";

const parser = new ConfigCommentParser();
const helper = new PluginCommentParser(parser);

// 1. assert ConfigCommentParser parseDirective extracts label, value, and justification
const d1 = parser.parseDirective("eslint-disable-next-line no-console, no-alert -- temporary debugging");
assert.ok(d1 !== undefined, "Expected parsed directive");
assert.strictEqual(d1.label, "eslint-disable-next-line");
assert.strictEqual(d1.value, "no-console, no-alert");
assert.strictEqual(d1.justification, "temporary debugging");

const dirNode = { type: "LineComment", value: "eslint-disable-line no-eval -- security" };
const parsedDirective = helper.parseDirective(dirNode.value, dirNode);
assert.ok(parsedDirective instanceof Directive);
assert.strictEqual(parsedDirective.type, "disable-line");
assert.strictEqual(parsedDirective.value, "no-eval");
assert.strictEqual(parsedDirective.justification, "security");
assert.strictEqual(parsedDirective.node, dirNode);

// 2. assert ConfigCommentParser parseDirective handles directives without justification returning empty string
const d2 = parser.parseDirective("eslint-enable no-alert");
assert.ok(d2 !== undefined, "Expected parsed directive");
assert.strictEqual(d2.label, "eslint-enable");
assert.strictEqual(d2.value, "no-alert");
assert.strictEqual(d2.justification, "");

// 3. assert ConfigCommentParser parseStringConfig maps comma and whitespace separated key-values with default null
const strConfig = parser.parseStringConfig("browser: true, node: false, es2024");
assert.strictEqual(Object.getPrototypeOf(strConfig), null);
assert.deepStrictEqual(strConfig, Object.assign(Object.create(null), {
  browser: "true",
  node: "false",
  es2024: null,
}));

const globals = helper.parseGlobals("window: readonly document: readonly customVar");
assert.strictEqual(Object.getPrototypeOf(globals), null);
assert.deepStrictEqual(globals, Object.assign(Object.create(null), {
  window: "readonly",
  document: "readonly",
  customVar: null,
}));

// 4. assert ConfigCommentParser parseListConfig parses comma-separated rule names into boolean map
const listConfig = parser.parseListConfig("plugin/no-magic, plugin/prefer-const");
assert.strictEqual(Object.getPrototypeOf(listConfig), null);
assert.deepStrictEqual(listConfig, Object.assign(Object.create(null), {
  "plugin/no-magic": true,
  "plugin/prefer-const": true,
}));

const rules = helper.parseRuleList("no-console, no-debugger");
assert.strictEqual(Object.getPrototypeOf(rules), null);
assert.deepStrictEqual(rules, Object.assign(Object.create(null), {
  "no-console": true,
  "no-debugger": true,
}));

// 5. assert ConfigCommentParser parseJSONLikeConfig parses relaxed and commaless configurations into ok result with config
const jsonConfig = parser.parseJSONLikeConfig("semi: [2, \"always\"], quotes: [1, \"double\"]");
assert.strictEqual(jsonConfig.ok, true);
assert.deepStrictEqual(jsonConfig.config, {
  semi: [2, "always"],
  quotes: [1, "double"],
});

const commalessConfig = helper.parseRuleConfig("no-alert: 2 no-console: 1");
assert.strictEqual(commalessConfig.ok, true);
assert.deepStrictEqual(commalessConfig.config, {
  "no-alert": 2,
  "no-console": 1,
});

// 6. assert ConfigCommentParser parseJSONLikeConfig returns ok false with error on invalid configuration syntax
const invalidConfig = parser.parseJSONLikeConfig("invalid:::json:::syntax");
assert.strictEqual(invalidConfig.ok, false);
assert.ok(invalidConfig.error);
assert.strictEqual(typeof invalidConfig.error.message, "string");
assert.ok(invalidConfig.error.message.length > 0);

console.log("All contract assertions passed.");

Ursprungs-Seeder

anonym