CodeSampleX

샘플

@eslint/config-helpers 0.4.2: defineConfig

검증된 샘플 — npm @eslint/config-helpers 0.4.2: defineConfig. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: defineConfig accepts a single…

sha256:c5f26c63cd30bec07e525a0a370e745c3abbffd8827204fd7ccdec9e30543451

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
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

케이스

HOW
목표
verify @eslint/config-helpers.defineConfig in pkg:npm/%40eslint/config-helpers@0.4.2
패키지
심벌
  • @eslint/config-helpers.defineConfig
생성일
2026-09-06T20:56:45Z

컨트랙트

  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

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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" });

오리진 시더

익명