CodeSampleX

샘플

eslint-scope 8.4.0

검증된 샘플 — npm eslint-scope 8.4.0. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: analyze extracts destructured object and array identifiers into…

sha256:0ce13efdb04b5567e2b04ea0ca6f82768109c1ff6513e0eb5417f2a0f987a30e

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

케이스

HOW
목표
verify pkg:npm/eslint-scope@8.4.0
패키지
환경
node 22.23.2
생성일
2026-08-26T08:34:27Z

컨트랙트

  1. analyze extracts destructured object and array identifiers into parameter variable definitions
  2. hoists var declarations across block boundaries to enclosing function scope
  3. creates block scope for lexical let and const declarations without containing hoisted var
  4. creates catch scope containing CatchClause parameter definition
  5. tracks childScopes hierarchy and variableScope references across nested blocks

파일

  • 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 pkg:npm/eslint-scope@8.4.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/eslint-scope@8.4.0
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:82b6ef1cfcfd64384ccf8520d56307a5bcfc7aa47cbd6867292af3720e798d89","constraints":{"executionContext":"node"},"contract":["analyze extracts destructured object and array identifiers into parameter variable definitions","hoists var declarations across block boundaries to enclosing function scope","creates block scope for lexical let and const declarations without containing hoisted var","creates catch scope containing CatchClause parameter definition","tracks childScopes hierarchy and variableScope references across nested blocks"],"goal":"verify pkg:npm/eslint-scope@8.4.0","kind":"HOW","packages":["pkg:npm/eslint-scope@8.4.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/eslint-scope@8.4.0"],"schemaVersion":1,"subject":"pkg:npm/eslint-scope@8.4.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-eslint-scope",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-eslint-scope",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "eslint-scope": "8.4.0"
      }
    },
    "node_modules/eslint-scope": {
      "version": "8.4.0",
      "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
      "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "esrecurse": "^4.3.0",
        "estraverse": "^5.2.0"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/esrecurse": {
      "version": "4.3.0",
      "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
      "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "estraverse": "^5.2.0"
      },
      "engines": {
        "node": ">=4.0"
      }
    },
    "node_modules/estraverse": {
      "version": "5.3.0",
      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
      "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
      "license": "BSD-2-Clause",
      "engines": {
        "node": ">=4.0"
      }
    }
  }
}
package.json
{
  "name": "sample-eslint-scope",
  "version": "1.0.0",
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "eslint-scope": "8.4.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/eslint-scope@8.4.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/eslint-scope@8.4.0"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const { analyze } = require('eslint-scope');

// Build an ESTree AST representing destructuring parameters, block scoping with var hoisting, and catch clause
const functionNode = {
  type: 'FunctionDeclaration',
  range: [0, 260],
  id: { type: 'Identifier', name: 'processData', range: [9, 20] },
  params: [
    {
      type: 'ObjectPattern',
      range: [21, 45],
      properties: [
        {
          type: 'Property',
          range: [23, 25],
          kind: 'init',
          shorthand: true,
          key: { type: 'Identifier', name: 'id', range: [23, 25] },
          value: { type: 'Identifier', name: 'id', range: [23, 25] }
        },
        {
          type: 'Property',
          range: [27, 43],
          kind: 'init',
          shorthand: false,
          key: { type: 'Identifier', name: 'meta', range: [27, 31] },
          value: {
            type: 'ArrayPattern',
            range: [33, 43],
            elements: [
              { type: 'Identifier', name: 'tag', range: [34, 37] }
            ]
          }
        }
      ]
    }
  ],
  body: {
    type: 'BlockStatement',
    range: [47, 260],
    body: [
      {
        type: 'VariableDeclaration',
        kind: 'var',
        range: [53, 72],
        declarations: [
          {
            type: 'VariableDeclarator',
            range: [57, 71],
            id: { type: 'Identifier', name: 'hoistedVar', range: [57, 67] },
            init: { type: 'Literal', value: 10, range: [70, 72] }
          }
        ]
      },
      {
        type: 'IfStatement',
        range: [77, 175],
        test: { type: 'Literal', value: true, range: [81, 85] },
        consequent: {
          type: 'BlockStatement',
          range: [87, 175],
          body: [
            {
              type: 'VariableDeclaration',
              kind: 'let',
              range: [97, 122],
              declarations: [
                {
                  type: 'VariableDeclarator',
                  range: [101, 121],
                  id: { type: 'Identifier', name: 'blockScopedLet', range: [101, 115] },
                  init: { type: 'Literal', value: 20, range: [118, 120] }
                }
              ]
            },
            {
              type: 'VariableDeclaration',
              kind: 'var',
              range: [133, 163],
              declarations: [
                {
                  type: 'VariableDeclarator',
                  range: [137, 162],
                  id: { type: 'Identifier', name: 'nestedHoistedVar', range: [137, 153] },
                  init: { type: 'Literal', value: 30, range: [156, 158] }
                }
              ]
            }
          ]
        },
        alternate: null
      },
      {
        type: 'TryStatement',
        range: [180, 256],
        block: {
          type: 'BlockStatement',
          range: [184, 190],
          body: []
        },
        handler: {
          type: 'CatchClause',
          range: [191, 256],
          param: { type: 'Identifier', name: 'err', range: [198, 201] },
          body: {
            type: 'BlockStatement',
            range: [203, 256],
            body: [
              {
                type: 'VariableDeclaration',
                kind: 'const',
                range: [215, 246],
                declarations: [
                  {
                    type: 'VariableDeclarator',
                    range: [221, 245],
                    id: { type: 'Identifier', name: 'caughtMessage', range: [221, 234] },
                    init: {
                      type: 'MemberExpression',
                      range: [237, 248],
                      object: { type: 'Identifier', name: 'err', range: [237, 240] },
                      property: { type: 'Identifier', name: 'message', range: [241, 248] },
                      computed: false
                    }
                  }
                ]
              }
            ]
          }
        },
        finalizer: null
      }
    ]
  }
};

const ast = {
  type: 'Program',
  range: [0, 260],
  sourceType: 'module',
  body: [functionNode]
};

const scopeManager = analyze(ast, { ecmaVersion: 2022, sourceType: 'module' });

// 1. analyze extracts destructured object and array identifiers into parameter variable definitions
const moduleScope = scopeManager.scopes.find(s => s.type === 'module');
assert.ok(moduleScope, 'ModuleScope should be present');

const functionScope = scopeManager.acquire(functionNode);
assert.ok(functionScope, 'FunctionScope should be acquired from FunctionDeclaration');
assert.equal(functionScope.type, 'function');

const idVar = functionScope.set.get('id');
assert.ok(idVar, 'id variable from ObjectPattern destructuring should exist in function scope');
assert.equal(idVar.defs.length, 1);
assert.equal(idVar.defs[0].type, 'Parameter');
assert.equal(idVar.defs[0].name.name, 'id');

const tagVar = functionScope.set.get('meta') || functionScope.set.get('tag');
assert.ok(tagVar, 'tag variable from nested ArrayPattern destructuring should exist in function scope');
assert.equal(tagVar.name, 'tag');
assert.equal(tagVar.defs[0].type, 'Parameter');

// 2. hoists var declarations across block boundaries to enclosing function scope
assert.ok(functionScope.set.has('hoistedVar'), 'hoistedVar should be defined in function scope');
assert.ok(functionScope.set.has('nestedHoistedVar'), 'nestedHoistedVar inside if-block should be hoisted to function scope');
const nestedHoisted = functionScope.set.get('nestedHoistedVar');
assert.equal(nestedHoisted.defs[0].type, 'Variable');

// 3. creates block scope for lexical let and const declarations without containing hoisted var
const ifConsequentBlock = functionNode.body.body[1].consequent;
const blockScope = scopeManager.acquire(ifConsequentBlock);
assert.ok(blockScope, 'BlockScope should be acquired from if consequent block');
assert.equal(blockScope.type, 'block');
assert.equal(blockScope.upper, functionScope);
assert.equal(blockScope.variableScope, functionScope);
assert.ok(blockScope.set.has('blockScopedLet'), 'blockScopedLet must exist in block scope');
assert.equal(blockScope.set.has('nestedHoistedVar'), false, 'nestedHoistedVar must NOT be bound in block scope set');

// 4. creates catch scope containing CatchClause parameter definition
const catchClause = functionNode.body.body[2].handler;
const catchScope = scopeManager.acquire(catchClause);
assert.ok(catchScope, 'CatchScope should be acquired from CatchClause');
assert.equal(catchScope.type, 'catch');
assert.equal(catchScope.upper, functionScope);
assert.ok(catchScope.set.has('err'), 'err parameter should be defined in catch scope');

const errVar = catchScope.set.get('err');
assert.equal(errVar.defs[0].type, 'CatchClause');
assert.equal(errVar.references.length, 1);
assert.ok(errVar.references[0].isRead(), 'err reference in member expression should be a read');

// 5. tracks childScopes hierarchy and variableScope references across nested blocks
assert.ok(functionScope.childScopes.includes(blockScope), 'functionScope.childScopes must contain blockScope');
assert.ok(functionScope.childScopes.includes(catchScope), 'functionScope.childScopes must contain catchScope');
const catchBodyBlock = catchClause.body;
const catchBlockScope = scopeManager.acquire(catchBodyBlock);
assert.ok(catchBlockScope, 'Catch body BlockScope should exist');
assert.equal(catchBlockScope.upper, catchScope);
assert.equal(catchBlockScope.variableScope, functionScope);
assert.ok(catchBlockScope.set.has('caughtMessage'), 'caughtMessage const must exist in catch body block scope');

오리진 시더

익명