CodeSampleX

샘플

@eslint/eslintrc 3.3.6: Legacy.CascadingConfigArrayFactory

검증된 샘플 — npm @eslint/eslintrc 3.3.6: Legacy.CascadingConfigArrayFactory. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다.

sha256:d8969a81a9b0b4c761d1d39c326c7befbee3d3f431050174751cae18f30328ba

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

실행 증거

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

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript 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-01

케이스

HOW
목표
verify Legacy.CascadingConfigArrayFactory in pkg:npm/%40eslint/eslintrc@3.3.6
패키지
심벌
  • Legacy.CascadingConfigArrayFactory
환경
node 22.23.2
생성일
2026-09-01T16:47:16Z

컨트랙트

  1. CascadingConfigArrayFactory initializes with base configuration and resolves current working directory
  2. getConfigArrayForFile returns a ConfigArray merging base config and CLI overrides
  3. extractConfig applies file-specific pattern overrides from cascading configuration
  4. setOverrideConfig and clearCache dynamically update override rules across file targets

파일

  • PROMPT.md
  • csx.json
  • index.js
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

소스 아티팩트 내려받기 (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 Legacy.CascadingConfigArrayFactory in pkg:npm/%40eslint/eslintrc@3.3.6
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40eslint/eslintrc@3.3.6
Demonstrate these symbols/APIs:
  - Legacy.CascadingConfigArrayFactory

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:4f207f89a27e7cccc48f752ce5406f2b5017ff7b995e6a5db306c0a12fe04cca","contract":["CascadingConfigArrayFactory initializes with base configuration and resolves current working directory","getConfigArrayForFile returns a ConfigArray merging base config and CLI overrides","extractConfig applies file-specific pattern overrides from cascading configuration","setOverrideConfig and clearCache dynamically update override rules across file targets"],"goal":"verify Legacy.CascadingConfigArrayFactory in pkg:npm/%40eslint/eslintrc@3.3.6","kind":"HOW","packages":["pkg:npm/%40eslint/eslintrc@3.3.6"],"schemaVersion":1,"symbols":["Legacy.CascadingConfigArrayFactory"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40eslint/eslintrc@3.3.6"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/eslintrc@3.3.6","symbols":["Legacy.CascadingConfigArrayFactory"],"verifierAdapter":"node-typescript@1"}
index.js
'use strict';

const path = require('node:path');
const { Legacy } = require('@eslint/eslintrc');

const { CascadingConfigArrayFactory } = Legacy;

/**
 * Creates a CascadingConfigArrayFactory configured for hierarchical ESLint config resolution.
 * @param {Object} [options] - Configuration options for the factory.
 * @param {string} [options.cwd] - Current working directory (defaults to process.cwd()).
 * @param {Object} [options.baseConfig] - Base ESLint configuration object.
 * @param {Object} [options.cliConfig] - CLI-level override configuration object.
 * @param {boolean} [options.useEslintrc] - Whether to search for ancestor config files.
 * @returns {Legacy.CascadingConfigArrayFactory}
 */
function createCascadingFactory(options = {}) {
  const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd();
  return new CascadingConfigArrayFactory({
    cwd,
    useEslintrc: options.useEslintrc ?? false,
    baseConfig: options.baseConfig || null,
    cliConfig: options.cliConfig || null,
    ...options
  });
}

/**
 * Resolves cascading configuration for a specific target file.
 * @param {Legacy.CascadingConfigArrayFactory} factory - The cascading factory instance.
 * @param {string} filePath - Path to the target file.
 * @returns {Object} Extracted configuration object for the target file.
 */
function resolveCascadingConfig(factory, filePath) {
  const configArray = factory.getConfigArrayForFile(filePath);
  const absolutePath = path.isAbsolute(filePath) ? filePath : path.resolve(factory.cwd, filePath);
  return configArray.extractConfig(absolutePath);
}

module.exports = {
  Legacy,
  CascadingConfigArrayFactory,
  createCascadingFactory,
  resolveCascadingConfig
};
package-lock.json
{
  "name": "sample-eslint-eslintrc-cascading-config-array-factory",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-eslint-eslintrc-cascading-config-array-factory",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@eslint/eslintrc": "3.3.6"
      }
    },
    "node_modules/@eslint/eslintrc": {
      "version": "3.3.6",
      "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.6.tgz",
      "integrity": "sha512-l2Ul9PrHsPCKcEY/ac7VgFj9D80C7S68sOKc618SyHDPK36s1XcFebXY0iTzUVn4Yq+YbwvSnDmCz9yxjX+QrA==",
      "license": "MIT",
      "dependencies": {
        "ajv": "^6.14.0",
        "debug": "^4.3.2",
        "espree": "^10.0.1",
        "globals": "^14.0.0",
        "ignore": "^5.2.0",
        "import-fresh": "^3.2.1",
        "js-yaml": "^4.3.0",
        "minimatch": "^3.1.5",
        "strip-json-comments": "^3.1.1"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/acorn": {
      "version": "8.18.0",
      "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
      "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
      "license": "MIT",
      "bin": {
        "acorn": "bin/acorn"
      },
      "engines": {
        "node": ">=0.4.0"
      }
    },
    "node_modules/acorn-jsx": {
      "version": "5.3.2",
      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
      "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
      "license": "MIT",
      "peerDependencies": {
        "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
      }
    },
    "node_modules/ajv": {
      "version": "6.15.0",
      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
      "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
      "license": "MIT",
      "dependencies": {
        "fast-deep-equal": "^3.1.1",
        "fast-json-stable-stringify": "^2.0.0",
        "json-schema-traverse": "^0.4.1",
        "uri-js": "^4.2.2"
      },
      "funding": {
        "type": "github",
        "url": "https://github.com/sponsors/epoberezkin"
      }
    },
    "node_modules/argparse": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
      "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
      "license": "Python-2.0"
    },
    "node_modules/balanced-match": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
      "license": "MIT"
    },
    "node_modules/brace-expansion": {
      "version": "1.1.18",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz",
      "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^1.0.0",
        "concat-map": "0.0.1"
      }
    },
    "node_modules/callsites": {
      "version": "3.1.0",
      "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
      "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
      "license": "MIT",
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/concat-map": {
      "version": "0.0.1",
      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
      "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
      "license": "MIT"
    },
    "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/eslint-visitor-keys": {
      "version": "4.2.1",
      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
      "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
      "license": "Apache-2.0",
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/espree": {
      "version": "10.4.0",
      "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
      "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "acorn": "^8.15.0",
        "acorn-jsx": "^5.3.2",
        "eslint-visitor-keys": "^4.2.1"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/fast-deep-equal": {
      "version": "3.1.3",
      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
      "license": "MIT"
    },
    "node_modules/fast-json-stable-stringify": {
      "version": "2.1.0",
      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
      "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
      "license": "MIT"
    },
    "node_modules/globals": {
      "version": "14.0.0",
      "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
      "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
      "license": "MIT",
      "engines": {
        "node": ">=18"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/ignore": {
      "version": "5.3.2",
      "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
      "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
      "license": "MIT",
      "engines": {
        "node": ">= 4"
      }
    },
    "node_modules/import-fresh": {
      "version": "3.3.1",
      "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
      "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
      "license": "MIT",
      "dependencies": {
        "parent-module": "^1.0.0",
        "resolve-from": "^4.0.0"
      },
      "engines": {
        "node": ">=6"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/js-yaml": {
      "version": "4.3.2",
      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
      "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
      "funding": [
        {
          "type": "github",
          "url": "https://github.com/sponsors/puzrin"
        },
        {
          "type": "github",
          "url": "https://github.com/sponsors/nodeca"
        }
      ],
      "license": "MIT",
      "dependencies": {
        "argparse": "^2.0.1"
      },
      "bin": {
        "js-yaml": "bin/js-yaml.js"
      }
    },
    "node_modules/json-schema-traverse": {
      "version": "0.4.1",
      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
      "license": "MIT"
    },
    "node_modules/minimatch": {
      "version": "3.1.5",
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
      "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
      "license": "ISC",
      "dependencies": {
        "brace-expansion": "^1.1.7"
      },
      "engines": {
        "node": "*"
      }
    },
    "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"
    },
    "node_modules/parent-module": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
      "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
      "license": "MIT",
      "dependencies": {
        "callsites": "^3.0.0"
      },
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/punycode": {
      "version": "2.3.1",
      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
      "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
      "license": "MIT",
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/resolve-from": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
      "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
      "license": "MIT",
      "engines": {
        "node": ">=4"
      }
    },
    "node_modules/strip-json-comments": {
      "version": "3.1.1",
      "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
      "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
      "license": "MIT",
      "engines": {
        "node": ">=8"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/uri-js": {
      "version": "4.4.1",
      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
      "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "punycode": "^2.1.0"
      }
    }
  }
}
package.json
{
  "name": "sample-eslint-eslintrc-cascading-config-array-factory",
  "version": "1.0.0",
  "description": "verify Legacy.CascadingConfigArrayFactory in pkg:npm/%40eslint/eslintrc@3.3.6",
  "main": "index.js",
  "type": "commonjs",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "license": "MIT-0",
  "dependencies": {
    "@eslint/eslintrc": "3.3.6"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify Legacy.CascadingConfigArrayFactory in pkg:npm/%40eslint/eslintrc@3.3.6",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40eslint/eslintrc@3.3.6"
  ],
  "symbols": [
    "Legacy.CascadingConfigArrayFactory"
  ]
}
test/contract.cjs
'use strict';

const assert = require('node:assert/strict');
const path = require('node:path');
const {
  Legacy,
  CascadingConfigArrayFactory,
  createCascadingFactory,
  resolveCascadingConfig
} = require('../index.js');

const cwd = path.resolve(__dirname, '..');

// 1. CascadingConfigArrayFactory initializes with base configuration and resolves current working directory
const baseConfig = {
  rules: {
    'no-unused-vars': 'warn',
    semi: ['error', 'always']
  },
  globals: {
    CustomGlobal: 'readonly'
  },
  overrides: [
    {
      files: ['*.test.js', '*.spec.js'],
      rules: {
        'no-unused-vars': 'off'
      }
    }
  ]
};

const cliConfig = {
  rules: {
    semi: ['warn', 'never']
  }
};

const factory = new CascadingConfigArrayFactory({
  cwd,
  useEslintrc: false,
  baseConfig,
  cliConfig
});

assert.ok(factory instanceof Legacy.CascadingConfigArrayFactory, 'factory must be instance of CascadingConfigArrayFactory');
assert.strictEqual(factory.cwd, cwd, 'factory.cwd must match configured cwd');

const helperFactory = createCascadingFactory({ cwd, useEslintrc: false, baseConfig, cliConfig });
assert.ok(helperFactory instanceof CascadingConfigArrayFactory, 'createCascadingFactory helper returns factory instance');

// 2. getConfigArrayForFile returns a ConfigArray merging base config and CLI overrides
const defaultArray = factory.getConfigArrayForFile();
assert.ok(defaultArray instanceof Legacy.ConfigArray, 'default getConfigArrayForFile must return ConfigArray');

const srcFilePath = path.join(cwd, 'src/index.js');
const srcArray = factory.getConfigArrayForFile(srcFilePath);
assert.ok(srcArray instanceof Legacy.ConfigArray, 'getConfigArrayForFile with filePath must return ConfigArray');

const srcConfig = srcArray.extractConfig(srcFilePath);
assert.ok(srcConfig, 'extracted config for source file must exist');
assert.deepStrictEqual(srcConfig.rules['no-unused-vars'], ['warn'], 'baseConfig rule must be present in source config');
assert.deepStrictEqual(srcConfig.rules.semi, ['warn', 'never'], 'cliConfig must override baseConfig semi rule');
assert.strictEqual(srcConfig.globals.CustomGlobal, 'readonly', 'baseConfig global must be resolved');

const helperResolved = resolveCascadingConfig(factory, srcFilePath);
assert.deepStrictEqual(helperResolved.rules, srcConfig.rules, 'resolveCascadingConfig helper must match direct extraction');

// 3. extractConfig applies file-specific pattern overrides from cascading configuration
const testFilePath = path.join(cwd, 'src/index.test.js');
const testArray = factory.getConfigArrayForFile(testFilePath);
const testConfig = testArray.extractConfig(testFilePath);

assert.ok(testConfig, 'extracted config for test file must exist');
assert.deepStrictEqual(testConfig.rules['no-unused-vars'], ['off'], 'pattern override must turn off no-unused-vars in test files');
assert.deepStrictEqual(testConfig.rules.semi, ['warn', 'never'], 'CLI override must remain active with file overrides');

// 4. setOverrideConfig and clearCache dynamically update override rules across file targets
factory.setOverrideConfig({
  rules: {
    'no-debugger': 'error'
  }
});
factory.clearCache();

const updatedArray = factory.getConfigArrayForFile(srcFilePath);
const updatedConfig = updatedArray.extractConfig(srcFilePath);

assert.ok(updatedConfig, 'extracted updated config must exist');
assert.deepStrictEqual(updatedConfig.rules['no-debugger'], ['error'], 'new override rule must be active after setOverrideConfig and clearCache');
assert.deepStrictEqual(updatedConfig.rules.semi, ['error', 'always'], 'baseConfig semi rule must be restored when cliConfig is replaced');

console.log('Contract verification succeeded.');

오리진 시더

익명