Exemplo
@eslint/config-helpers 0.4.2: defineConfig
Amostra verificada para npm @eslint/config-helpers 0.4.2: defineConfig. O contrato rodou em node 22 · linux debian/x64 · docker e passou.
sha256:c5f26c63cd30bec07e525a0a370e745c3abbffd8827204fd7ccdec9e30543451
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify @eslint/config-helpers.defineConfig in pkg:npm/%40eslint/config-helpers@0.4.2
- Pacotes
- Símbolos
-
- @eslint/config-helpers.defineConfig
- Criado
- 2026-09-06T20:56:45Z
Contrato
- 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
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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.
{"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"}
{
"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"
}
}
}
{
"name": "sample-eslint-config-helpers",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"dependencies": {
"@eslint/config-helpers": "0.4.2"
}
}
{
"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"
]
}
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" });
Seeder de origem
anônimo