CodeSampleX

샘플

@typescript-eslint/scope-manager 8.66.0

검증된 샘플 — npm @typescript-eslint/scope-manager 8.66.0. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: assert analyze parses AST and creates…

sha256:8892e7609cd5a8531b661fcd4a24f6eb26d6b034dad44e344e0ff3cd28c838a9

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

케이스

HOW
목표
verify pkg:npm/%40typescript-eslint/scope-manager@8.66.0
패키지
환경
node 22.23.2
생성일
2026-08-21T09:35:45Z

컨트랙트

  1. assert analyze parses AST and creates ScopeManager with global and module scopes
  2. assert analyze resolves TypeScript type declarations and variables into scope definitions
  3. assert acquire returns the function scope associated with a FunctionDeclaration AST node
  4. assert references differentiate between variable write definitions and variable read references

파일

  • PROMPT.md
  • csx.json
  • 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 pkg:npm/%40typescript-eslint/scope-manager@8.66.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40typescript-eslint/scope-manager@8.66.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:dbe00e5d883d5f02f6ae7049e9a8782ee3ec18ce2da209071a6747129ce5d941","constraints":{"executionContext":"node"},"contract":["assert analyze parses AST and creates ScopeManager with global and module scopes","assert analyze resolves TypeScript type declarations and variables into scope definitions","assert acquire returns the function scope associated with a FunctionDeclaration AST node","assert references differentiate between variable write definitions and variable read references"],"goal":"verify pkg:npm/%40typescript-eslint/scope-manager@8.66.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/scope-manager@8.66.0"],"schemaVersion":1},"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","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40typescript-eslint/scope-manager@8.66.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/scope-manager@8.66.0","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-typescript-eslint-scope-manager",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-typescript-eslint-scope-manager",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@typescript-eslint/scope-manager": "8.66.0"
      }
    },
    "node_modules/@typescript-eslint/scope-manager": {
      "version": "8.66.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.66.0.tgz",
      "integrity": "sha512-8TGcH25j9zqJ/IULB/ppyhRvxA8QYfFEZ7nfbg6/BN9spDgb8fPWQXlE5l8TWBL50EtUx007uZ1o9VOwrq2/9g==",
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.66.0",
        "@typescript-eslint/visitor-keys": "8.66.0"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/typescript-eslint"
      }
    },
    "node_modules/@typescript-eslint/types": {
      "version": "8.66.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.66.0.tgz",
      "integrity": "sha512-H6gcYaSDOyvL3AD/jHUtUFo2jqGgn/F6nuyuZSu0QTesxL+cP4dQoIMrODRofuJC09g64+WgZ6tE19Y1N2YIFQ==",
      "license": "MIT",
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/typescript-eslint"
      }
    },
    "node_modules/@typescript-eslint/visitor-keys": {
      "version": "8.66.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.66.0.tgz",
      "integrity": "sha512-dkKR8q+lKciskj1Y3vthHktl+3cMLWGyVUP23bRiPZ5O9BRT++4EqDDV+TVeIKBL1VXVEqrJlz8MYbcnvJcAlg==",
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.66.0",
        "eslint-visitor-keys": "^5.0.0"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/typescript-eslint"
      }
    },
    "node_modules/eslint-visitor-keys": {
      "version": "5.0.1",
      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
      "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
      "license": "Apache-2.0",
      "engines": {
        "node": "^20.19.0 || ^22.13.0 || >=24"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    }
  }
}
package.json
{
  "name": "sample-typescript-eslint-scope-manager",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@typescript-eslint/scope-manager": "8.66.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40typescript-eslint/scope-manager@8.66.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/scope-manager@8.66.0"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
const assert = require("node:assert");
const {
  analyze,
  ScopeManager,
  ScopeType,
  DefinitionType,
  Reference,
  Variable
} = require("@typescript-eslint/scope-manager");

// 1. Assert analyze parses AST and creates ScopeManager with global and module scopes
const ast = {
  type: "Program",
  body: [
    // type Status = string;
    {
      type: "TSTypeAliasDeclaration",
      id: { type: "Identifier", name: "Status", range: [5, 11], decorators: [] },
      typeAnnotation: { type: "TSStringKeyword", range: [14, 20] },
      range: [0, 20],
      decorators: []
    },
    // let currentStatus: Status = "idle";
    {
      type: "VariableDeclaration",
      kind: "let",
      declarations: [
        {
          type: "VariableDeclarator",
          id: {
            type: "Identifier",
            name: "currentStatus",
            typeAnnotation: {
              type: "TSTypeAnnotation",
              typeAnnotation: {
                type: "TSTypeReference",
                typeName: { type: "Identifier", name: "Status", range: [19, 25], decorators: [] },
                range: [19, 25]
              },
              range: [17, 25]
            },
            range: [4, 25],
            decorators: []
          },
          init: {
            type: "Literal",
            value: "idle",
            raw: "\"idle\"",
            range: [28, 34]
          },
          range: [4, 34]
        }
      ],
      range: [0, 35],
      decorators: []
    },
    // function updateStatus(nextStatus: Status) { currentStatus = nextStatus; return currentStatus; }
    {
      type: "FunctionDeclaration",
      id: { type: "Identifier", name: "updateStatus", range: [45, 57], decorators: [] },
      params: [
        {
          type: "Identifier",
          name: "nextStatus",
          typeAnnotation: {
            type: "TSTypeAnnotation",
            typeAnnotation: {
              type: "TSTypeReference",
              typeName: { type: "Identifier", name: "Status", range: [69, 75], decorators: [] },
              range: [69, 75]
            },
            range: [67, 75]
          },
          range: [58, 75],
          decorators: []
        }
      ],
      body: {
        type: "BlockStatement",
        body: [
          {
            type: "ExpressionStatement",
            expression: {
              type: "AssignmentExpression",
              operator: "=",
              left: { type: "Identifier", name: "currentStatus", range: [79, 92], decorators: [] },
              right: { type: "Identifier", name: "nextStatus", range: [95, 105], decorators: [] },
              range: [79, 105]
            },
            range: [79, 106]
          },
          {
            type: "ReturnStatement",
            argument: { type: "Identifier", name: "currentStatus", range: [114, 127], decorators: [] },
            range: [107, 128]
          }
        ],
        range: [77, 130]
      },
      range: [36, 130],
      decorators: []
    }
  ],
  sourceType: "module",
  range: [0, 130],
  comments: [],
  tokens: []
};

const scopeManager = analyze(ast, { sourceType: "module" });

// 1. Assert analyze parses AST and creates ScopeManager with global and module scopes
assert(scopeManager instanceof ScopeManager, "analyze returns a ScopeManager instance");
assert.strictEqual(scopeManager.globalScope.type, ScopeType.global, "root scope is global");
const moduleScope = scopeManager.scopes.find((s) => s.type === ScopeType.module);
assert(moduleScope, "module scope exists");

// 2. Assert analyze resolves TypeScript type declarations and variables into scope definitions
const statusVar = moduleScope.set.get("Status");
assert(statusVar instanceof Variable, "Status is tracked as a Variable");
assert.strictEqual(statusVar.defs[0].type, DefinitionType.Type, "Status definition is Type");
assert.strictEqual(statusVar.isTypeVariable, true, "Status is marked as type variable");

const currentStatusVar = moduleScope.set.get("currentStatus");
assert(currentStatusVar instanceof Variable, "currentStatus is tracked as a Variable");
assert.strictEqual(currentStatusVar.defs[0].type, DefinitionType.Variable, "currentStatus definition is Variable");
assert.strictEqual(currentStatusVar.isValueVariable, true, "currentStatus is marked as value variable");

// 3. Assert acquire returns the function scope associated with a FunctionDeclaration AST node
const fnNode = ast.body[2];
const fnScope = scopeManager.acquire(fnNode);
assert(fnScope, "scopeManager.acquire returns function scope");
assert.strictEqual(fnScope.type, ScopeType.function, "acquired scope type is function");
assert.strictEqual(fnScope.block, fnNode, "function scope block matches function AST node");
assert(fnScope.set.has("nextStatus"), "parameter nextStatus exists in function scope");
assert.strictEqual(fnScope.set.get("nextStatus").defs[0].type, DefinitionType.Parameter, "nextStatus def is Parameter");

// 4. Assert references differentiate between variable write definitions and variable read references
assert.strictEqual(currentStatusVar.references.length, 3, "currentStatus has 3 references across module and function");

const writeRefs = currentStatusVar.references.filter((r) => r.isWrite());
const readRefs = currentStatusVar.references.filter((r) => r.isRead());

assert.strictEqual(writeRefs.length, 2, "2 write references (init declarator and assignment expression)");
assert.strictEqual(readRefs.length, 1, "1 read reference (return statement)");

assert.strictEqual(writeRefs[0].isWriteOnly(), true, "init declarator is write-only");
assert.strictEqual(writeRefs[1].isWriteOnly(), true, "assignment expression is write-only");
assert.strictEqual(readRefs[0].isReadOnly(), true, "return statement is read-only");

오리진 시더

익명