CodeSampleX

Sample

@eslint/config-helpers 0.4.2: defineConfig

Verified sample for npm @eslint/config-helpers 0.4.2: defineConfig. The contract ran on node 22 · linux debian/x64 · docker and passed.

sha256:c5f26c63cd30bec07e525a0a370e745c3abbffd8827204fd7ccdec9e30543451

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

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

Case

HOW
Goal
verify @eslint/config-helpers.defineConfig in pkg:npm/%40eslint/config-helpers@0.4.2
Packages
Symbols
  • @eslint/config-helpers.defineConfig
Created
2026-09-06T20:56:45Z

Contract

  1. defineConfig accepts a single configuration object or array and normalizes to an array
  2. defineConfig recursively flattens nested configuration arrays while preserving object order
  3. defineConfig extends configuration objects by combining files patterns and appending ignores
  4. defineConfig resolves and scopes plugin configs referenced by string in extends
  5. defineConfig throws TypeError when called with invalid arguments such as null, primitives, or undefined

Files

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

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 @eslint/config-helpers.defineConfig in pkg:npm/%40eslint/config-helpers@0.4.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40eslint/config-helpers@0.4.2
Demonstrate these symbols/APIs:
  - @eslint/config-helpers.defineConfig

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:b3ddeee85533a56bd9cc8705874aaebc89716d02a1560cc25883f6f8bc8b6e70","contract":["defineConfig accepts a single configuration object or array and normalizes to an array","defineConfig recursively flattens nested configuration arrays while preserving object order","defineConfig extends configuration objects by combining files patterns and appending ignores","defineConfig resolves and scopes plugin configs referenced by string in extends","defineConfig throws TypeError when called with invalid arguments such as null, primitives, or undefined"],"goal":"verify @eslint/config-helpers.defineConfig in pkg:npm/%40eslint/config-helpers@0.4.2","kind":"HOW","packages":["pkg:npm/%40eslint/config-helpers@0.4.2"],"schemaVersion":1,"symbols":["@eslint/config-helpers.defineConfig"]},"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/config-helpers@0.4.2"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/config-helpers@0.4.2","symbols":["@eslint/config-helpers.defineConfig"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-eslint-config-helpers",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-eslint-config-helpers",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@eslint/config-helpers": "0.4.2"
      }
    },
    "node_modules/@eslint/config-helpers": {
      "version": "0.4.2",
      "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",
      "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
      "license": "Apache-2.0",
      "dependencies": {
        "@eslint/core": "^0.17.0"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      }
    },
    "node_modules/@eslint/core": {
      "version": "0.17.0",
      "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
      "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
      "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-config-helpers",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@eslint/config-helpers": "0.4.2"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @eslint/config-helpers.defineConfig in pkg:npm/%40eslint/config-helpers@0.4.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40eslint/config-helpers@0.4.2"
  ],
  "symbols": [
    "@eslint/config-helpers.defineConfig"
  ]
}
test/contract.mjs
import assert from "node:assert/strict";
import { defineConfig } from "@eslint/config-helpers";

// 1. defineConfig accepts a single configuration object or array and normalizes to an array
const singleConfig = { name: "my-base", rules: { semi: "error" } };
const singleResult = defineConfig(singleConfig);
assert.equal(Array.isArray(singleResult), true);
assert.equal(singleResult.length, 1);
assert.equal(singleResult[0].name, "my-base");
assert.equal(singleResult[0].rules.semi, "error");

// 2. defineConfig recursively flattens nested configuration arrays while preserving object order
const configA = { name: "cfg-a", rules: { "no-unused-vars": "error" } };
const configB = { name: "cfg-b", files: ["src/**/*.js"] };
const configC = { name: "cfg-c", rules: { "no-debugger": "warn" } };
const flattened = defineConfig([configA, [configB, [configC]]]);
assert.equal(flattened.length, 3);
assert.equal(flattened[0].name, "cfg-a");
assert.equal(flattened[1].name, "cfg-b");
assert.deepEqual(flattened[1].files, ["src/**/*.js"]);
assert.equal(flattened[2].name, "cfg-c");

// 3. defineConfig extends configuration objects by combining files patterns and appending ignores
const subConfig = {
  name: "sub-config",
  files: ["*.ts"],
  ignores: ["temp/**"],
  rules: { "no-var": "error" },
};
const parentConfig = defineConfig({
  name: "root-config",
  files: ["src/**"],
  ignores: ["dist/**"],
  extends: [subConfig],
  rules: { eqeqeq: "error" },
});
assert.equal(parentConfig.length, 2);
assert.equal(parentConfig[0].name, "root-config > sub-config");
assert.deepEqual(parentConfig[0].files, [["src/**", "*.ts"]]);
assert.deepEqual(parentConfig[0].ignores, ["dist/**", "temp/**"]);
assert.equal(parentConfig[0].rules["no-var"], "error");
assert.equal(parentConfig[1].name, "root-config");
assert.equal(parentConfig[1].rules.eqeqeq, "error");

// 4. defineConfig resolves and scopes plugin configs referenced by string in extends
const mockPlugin = {
  meta: { name: "eslint-plugin-sample", namespace: "sample" },
  configs: {
    recommended: {
      rules: { "sample/no-bad-logic": "error" },
    },
  },
};
const pluginResult = defineConfig({
  name: "consumer-config",
  plugins: { customPlugin: mockPlugin },
  extends: ["customPlugin/recommended"],
});
assert.equal(pluginResult.length, 2);
assert.equal(
  pluginResult[0].name,
  "consumer-config > customPlugin/recommended"
);
assert.equal(pluginResult[0].rules["customPlugin/no-bad-logic"], "error");

// 5. defineConfig throws TypeError when called with invalid arguments such as null, primitives, or undefined
assert.throws(() => defineConfig(), { name: "TypeError" });
assert.throws(() => defineConfig(null), { name: "TypeError" });
assert.throws(() => defineConfig("invalid"), { name: "TypeError" });
assert.throws(() => defineConfig(123), { name: "TypeError" });

Origin Seeder

anonymous