CodeSampleX

샘플

@eslint/config-array 0.23.5

검증된 샘플 — npm @eslint/config-array 0.23.5. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: ConfigArray can be instantiated with config objects…

sha256:72de675c08d8ea87fe53f23e423e5f44cc370a9e1e6dbb2f76e747f6d901c3a3

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

실행 증거

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

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

검증 실행 환경

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

케이스

HOW
목표
verify pkg:npm/%40eslint/config-array@0.23.5
패키지
환경
node 22.23.2
생성일
2026-08-27T22:58:30Z

컨트랙트

  1. ConfigArray can be instantiated with config objects, basePath, custom schema, and extraConfigTypes
  2. normalizeSync flattens configs and evaluates synchronous config functions with context
  3. normalize asynchronously resolves config functions and promises with context
  4. getConfigWithStatus returns matched config or accurate status for unconfigured, ignored, and external files
  5. getConfig returns merged configuration adhering to override precedence and schema merge rules
  6. files and ignores getters expose aggregated matchers across all configurations
  7. isFileIgnored and isDirectoryIgnored accurately evaluate ignore patterns and directory boundaries

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.mjs
  • 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 pkg:npm/%40eslint/config-array@0.23.5
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40eslint/config-array@0.23.5
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:48c954c4ed59db84d2fcc0b82a77b93a3d33c21d40dc06505a83e7a89527e5f6","constraints":{"executionContext":"node"},"contract":["ConfigArray can be instantiated with config objects, basePath, custom schema, and extraConfigTypes","normalizeSync flattens configs and evaluates synchronous config functions with context","normalize asynchronously resolves config functions and promises with context","getConfigWithStatus returns matched config or accurate status for unconfigured, ignored, and external files","getConfig returns merged configuration adhering to override precedence and schema merge rules","files and ignores getters expose aggregated matchers across all configurations","isFileIgnored and isDirectoryIgnored accurately evaluate ignore patterns and directory boundaries"],"goal":"verify pkg:npm/%40eslint/config-array@0.23.5","kind":"HOW","packages":["pkg:npm/%40eslint/config-array@0.23.5"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","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/config-array@0.23.5"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/config-array@0.23.5","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "verify-eslint-config-array",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "verify-eslint-config-array",
      "version": "1.0.0",
      "dependencies": {
        "@eslint/config-array": "0.23.5"
      }
    },
    "node_modules/@eslint/config-array": {
      "version": "0.23.5",
      "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz",
      "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==",
      "license": "Apache-2.0",
      "dependencies": {
        "@eslint/object-schema": "^3.0.5",
        "debug": "^4.3.1",
        "minimatch": "^10.2.4"
      },
      "engines": {
        "node": "^20.19.0 || ^22.13.0 || >=24"
      }
    },
    "node_modules/@eslint/object-schema": {
      "version": "3.0.5",
      "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz",
      "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==",
      "license": "Apache-2.0",
      "engines": {
        "node": "^20.19.0 || ^22.13.0 || >=24"
      }
    },
    "node_modules/balanced-match": {
      "version": "4.0.4",
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
      "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
      "license": "MIT",
      "engines": {
        "node": "18 || 20 || >=22"
      }
    },
    "node_modules/brace-expansion": {
      "version": "5.0.9",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
      "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^4.0.2"
      },
      "engines": {
        "node": "20 || >=22"
      }
    },
    "node_modules/debug": {
      "version": "4.4.3",
      "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
      "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
      "license": "MIT",
      "dependencies": {
        "ms": "^2.1.3"
      },
      "engines": {
        "node": ">=6.0"
      },
      "peerDependenciesMeta": {
        "supports-color": {
          "optional": true
        }
      }
    },
    "node_modules/minimatch": {
      "version": "10.2.6",
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
      "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
      "license": "BlueOak-1.0.0",
      "dependencies": {
        "brace-expansion": "^5.0.8"
      },
      "engines": {
        "node": "18 || 20 || >=22"
      },
      "funding": {
        "url": "https://github.com/sponsors/isaacs"
      }
    },
    "node_modules/ms": {
      "version": "2.1.3",
      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "verify-eslint-config-array",
  "version": "1.0.0",
  "type": "module",
  "dependencies": {
    "@eslint/config-array": "0.23.5"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40eslint/config-array@0.23.5",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40eslint/config-array@0.23.5"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.mjs
import { ConfigArray, ConfigArraySymbol, ObjectSchema } from '@eslint/config-array';

/**
 * Creates and normalizes a ConfigArray instance with custom schema and options.
 *
 * @param {Array<Object|Function>} configs - Array of configuration objects or functions.
 * @param {Object} [options] - Options including basePath, schema, extraConfigTypes.
 * @param {Object} [context] - Optional context object for normalization.
 * @returns {ConfigArray} Normalized ConfigArray instance.
 */
export function createConfigArray(configs, options = {}, context = undefined) {
  const configArray = new ConfigArray(configs, options);
  configArray.normalizeSync(context);
  return configArray;
}

/**
 * Asynchronously creates and normalizes a ConfigArray instance.
 *
 * @param {Array<Object|Function|Promise>} configs - Array of configs or async functions.
 * @param {Object} [options] - Options including basePath, schema, extraConfigTypes.
 * @param {Object} [context] - Optional context object for normalization.
 * @returns {Promise<ConfigArray>} Normalized ConfigArray instance.
 */
export async function createConfigArrayAsync(configs, options = {}, context = undefined) {
  const configArray = new ConfigArray(configs, options);
  await configArray.normalize(context);
  return configArray;
}

export { ConfigArray, ConfigArraySymbol, ObjectSchema };
test/contract.mjs
import assert from 'node:assert/strict';
import {
  ConfigArray,
  ObjectSchema,
  createConfigArray,
  createConfigArrayAsync
} from '../src/index.mjs';

const customSchema = {
  settings: {
    validate(value) {
      if (typeof value !== 'object' || value === null) {
        throw new TypeError('Settings must be an object');
      }
    },
    merge(first = {}, second = {}) {
      return { ...first, ...second };
    }
  },
  rules: {
    validate(value) {
      if (typeof value !== 'object' || value === null) {
        throw new TypeError('Rules must be an object');
      }
    },
    merge(first = {}, second = {}) {
      return { ...first, ...second };
    }
  }
};

const rawConfigs = [
  {
    name: 'base-js',
    files: ['**/*.js', '**/*.mjs'],
    settings: { env: 'production', version: 20 },
    rules: { semi: 'always', quotes: 'double' }
  },
  {
    name: 'test-overrides',
    files: ['**/test/**/*.js', '**/*.test.js'],
    settings: { env: 'test' },
    rules: { quotes: 'single' }
  },
  (context) => ({
    name: 'dynamic-context-config',
    files: ['src/**/*.js'],
    settings: { dynamicBuildId: context.buildId }
  }),
  {
    name: 'global-ignores',
    ignores: ['**/dist/**', '**/coverage/**', 'build/']
  }
];

// 1. ConfigArray can be instantiated with config objects, basePath, custom schema, and extraConfigTypes
const configArray = new ConfigArray(rawConfigs, {
  basePath: '/workspace/project',
  schema: customSchema,
  extraConfigTypes: ['function']
});

assert.ok(configArray instanceof ConfigArray, 'configArray must be an instance of ConfigArray');
assert.equal(configArray.basePath, '/workspace/project', 'basePath should match constructor option');
assert.equal(configArray.isNormalized(), false, 'isNormalized should initially be false');

// 2. normalizeSync flattens configs and evaluates synchronous config functions with context
configArray.normalizeSync({ buildId: 'build-123' });
assert.equal(configArray.isNormalized(), true, 'isNormalized should be true after normalizeSync');

// 3. normalize asynchronously resolves config functions and promises with context
const asyncArray = new ConfigArray([
  async (ctx) => ({
    name: 'async-entry',
    files: ['**/*.ts'],
    settings: { env: 'async-env', region: ctx.region }
  })
], {
  basePath: '/workspace/project',
  schema: customSchema,
  extraConfigTypes: ['function']
});
assert.equal(asyncArray.isNormalized(), false);
await asyncArray.normalize({ region: 'us-east' });
assert.equal(asyncArray.isNormalized(), true);
const asyncConfig = asyncArray.getConfig('/workspace/project/src/app.ts');
assert.deepEqual(asyncConfig.settings, { env: 'async-env', region: 'us-east' });

// 4. getConfigWithStatus returns matched config or accurate status for unconfigured, ignored, and external files
const matchedResult = configArray.getConfigWithStatus('/workspace/project/src/index.js');
assert.equal(matchedResult.status, 'matched');
assert.ok(matchedResult.config);
assert.equal(matchedResult.config.rules.semi, 'always');
assert.equal(matchedResult.config.settings.dynamicBuildId, 'build-123');

const unconfiguredResult = configArray.getConfigWithStatus('/workspace/project/README.md');
assert.equal(unconfiguredResult.status, 'unconfigured');
assert.equal(unconfiguredResult.config, undefined);

const ignoredResult = configArray.getConfigWithStatus('/workspace/project/dist/bundle.js');
assert.equal(ignoredResult.status, 'ignored');
assert.equal(ignoredResult.config, undefined);

const externalResult = configArray.getConfigWithStatus('/outside/project/index.js');
assert.equal(externalResult.status, 'external');
assert.equal(externalResult.config, undefined);

// 5. getConfig returns merged configuration adhering to override precedence and schema merge rules
const testConfig = configArray.getConfig('/workspace/project/test/unit.test.js');
assert.ok(testConfig);
assert.deepEqual(testConfig.settings, {
  env: 'test',
  version: 20
});
assert.equal(testConfig.rules.quotes, 'single');
assert.equal(testConfig.rules.semi, 'always');

// 6. files and ignores getters expose aggregated matchers across all configurations
assert.ok(Array.isArray(configArray.files), 'files getter should return an array');
assert.equal(configArray.files.length, 5, 'files getter should aggregate all matchers');
assert.ok(Array.isArray(configArray.ignores), 'ignores getter should return an array');
assert.equal(configArray.ignores.length, 1, 'ignores getter should aggregate all global ignore entries');

// 7. isFileIgnored and isDirectoryIgnored accurately evaluate ignore patterns and directory boundaries
assert.equal(configArray.isFileIgnored('/workspace/project/dist/app.min.js'), true);
assert.equal(configArray.isFileIgnored('/workspace/project/coverage/lcov.info'), true);
assert.equal(configArray.isFileIgnored('/workspace/project/src/index.js'), false);

assert.equal(configArray.isDirectoryIgnored('/workspace/project/build'), true);
assert.equal(configArray.isDirectoryIgnored('/workspace/project/src'), false);
assert.equal(configArray.isDirectoryIgnored('/outside/project'), true, 'external directories should be treated as ignored');

// Helper createConfigArray and createConfigArrayAsync verification
const helperSync = createConfigArray(rawConfigs, {
  basePath: '/workspace/project',
  schema: customSchema,
  extraConfigTypes: ['function']
}, { buildId: 'build-123' });
assert.ok(helperSync.isNormalized());
assert.deepEqual(
  helperSync.getConfig('/workspace/project/src/index.js'),
  matchedResult.config
);

const helperAsync = await createConfigArrayAsync([
  async (ctx) => ({
    name: 'async-entry',
    files: ['**/*.ts'],
    settings: { env: 'async-env', region: ctx.region }
  })
], {
  basePath: '/workspace/project',
  schema: customSchema,
  extraConfigTypes: ['function']
}, { region: 'us-east' });
assert.ok(helperAsync.isNormalized());
assert.deepEqual(
  helperAsync.getConfig('/workspace/project/src/app.ts'),
  asyncConfig
);

console.log('All contract assertions for @eslint/config-array passed successfully.');

오리진 시더

익명