CodeSampleX

샘플

@typescript-eslint/scope-manager 8.69.0: DefinitionType

검증된 샘플 — npm @typescript-eslint/scope-manager 8.69.0: DefinitionType. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다.

sha256:e924a81e673b38204b8086d214564970dab45d2a7d53f0a756d149711cd0957e

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

실행 증거

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

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

검증 실행 환경

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

케이스

HOW
목표
verify @typescript-eslint/scope-manager.DefinitionType in pkg:npm/%40typescript-eslint/scope-manager@8.69.0
패키지
심벌
  • @typescript-eslint/scope-manager.DefinitionType
환경
node 22.23.2
생성일
2026-10-11T18:35:10Z

컨트랙트

  1. assert DefinitionType exports discriminators for declaration binding categories
  2. assert FunctionDeclaration binds FunctionName definition in enclosing scope and Parameter definition in function scope
  3. assert ImportDeclaration creates ImportBinding definition with matching DefinitionType
  4. assert ClassDeclaration creates ClassName definition with matching DefinitionType

파일

  • 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 @typescript-eslint/scope-manager.DefinitionType in pkg:npm/%40typescript-eslint/scope-manager@8.69.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40typescript-eslint/scope-manager@8.69.0
Demonstrate these symbols/APIs:
  - @typescript-eslint/scope-manager.DefinitionType

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:269bef6e855c73ce904e0a8548fc64bb61627cb9b5638754cc2821d120a8da35","contract":["assert DefinitionType exports discriminators for declaration binding categories","assert FunctionDeclaration binds FunctionName definition in enclosing scope and Parameter definition in function scope","assert ImportDeclaration creates ImportBinding definition with matching DefinitionType","assert ClassDeclaration creates ClassName definition with matching DefinitionType"],"goal":"verify @typescript-eslint/scope-manager.DefinitionType in pkg:npm/%40typescript-eslint/scope-manager@8.69.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/scope-manager@8.69.0"],"schemaVersion":1,"symbols":["@typescript-eslint/scope-manager.DefinitionType"]},"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.69.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/scope-manager@8.69.0","symbols":["@typescript-eslint/scope-manager.DefinitionType"],"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.69.0"
      }
    },
    "node_modules/@typescript-eslint/scope-manager": {
      "version": "8.69.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.69.0.tgz",
      "integrity": "sha512-ewfspqWvSxKSOaplqAUNbaSFO0eB6w1EtQ+esfYFRm3614Ty4uNtExkcbgd6nWsXphbqKyf9ZYdbZdv2xEoWEQ==",
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.69.0",
        "@typescript-eslint/visitor-keys": "8.69.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.69.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.69.0.tgz",
      "integrity": "sha512-K3VrubUPhlo9VDBS6QdI8YB5j7ClpqLRdefcz6PFrhnwicehBweqQ9Evhl4l+FYz0HdDmMqIiSX0aldGRYtDCA==",
      "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.69.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.69.0.tgz",
      "integrity": "sha512-+rmdgPA+EXkNgKYvHvFfhrs35utXbwaC5PGpDquSXcoXQDKUA5UjV0LmTucG/4JXkM31BTu4TilHtrN8IVBe8w==",
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.69.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.69.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @typescript-eslint/scope-manager.DefinitionType in pkg:npm/%40typescript-eslint/scope-manager@8.69.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/scope-manager@8.69.0"
  ],
  "symbols": [
    "@typescript-eslint/scope-manager.DefinitionType"
  ]
}
test/contract.cjs
const assert = require("node:assert");
const { analyze, DefinitionType } = require("@typescript-eslint/scope-manager");

// 1. Assert DefinitionType exports discriminators for declaration binding categories
assert.strictEqual(DefinitionType.Parameter, "Parameter");
assert.strictEqual(DefinitionType.FunctionName, "FunctionName");
assert.strictEqual(DefinitionType.ClassName, "ClassName");
assert.strictEqual(DefinitionType.ImportBinding, "ImportBinding");
assert.strictEqual(DefinitionType.Variable, "Variable");
assert.strictEqual(DefinitionType.Type, "Type");

const ast = {
  type: "Program",
  body: [
    // import { foo } from "./mod";
    {
      type: "ImportDeclaration",
      specifiers: [
        {
          type: "ImportSpecifier",
          imported: { type: "Identifier", name: "foo", range: [9, 12], decorators: [] },
          local: { type: "Identifier", name: "foo", range: [9, 12], decorators: [] },
          range: [9, 12]
        }
      ],
      source: { type: "Literal", value: "./mod", raw: '"./mod"', range: [20, 27] },
      range: [0, 28]
    },
    // function greet(name) { return name; }
    {
      type: "FunctionDeclaration",
      id: { type: "Identifier", name: "greet", range: [38, 43], decorators: [] },
      generator: false,
      async: false,
      params: [
        { type: "Identifier", name: "name", range: [44, 48], decorators: [] }
      ],
      body: {
        type: "BlockStatement",
        body: [
          {
            type: "ReturnStatement",
            argument: { type: "Identifier", name: "name", range: [58, 62], decorators: [] },
            range: [51, 63]
          }
        ],
        range: [50, 65]
      },
      range: [29, 65]
    },
    // class User {}
    {
      type: "ClassDeclaration",
      id: { type: "Identifier", name: "User", range: [72, 76], decorators: [] },
      superClass: null,
      implements: [],
      body: { type: "ClassBody", body: [], range: [77, 79] },
      range: [66, 79],
      decorators: []
    }
  ],
  sourceType: "module",
  range: [0, 80],
  comments: [],
  tokens: []
};

const scopeManager = analyze(ast, { sourceType: "module" });
const moduleScope = scopeManager.scopes.find(s => s.type === "module");
assert(moduleScope, "moduleScope exists");

// 2. Assert FunctionDeclaration binds FunctionName definition in enclosing scope and Parameter definition in function scope
const greetVar = moduleScope.set.get("greet");
assert(greetVar, "moduleScope contains greet function variable");
assert.strictEqual(greetVar.defs.length, 1, "greet variable has 1 definition");
assert.strictEqual(greetVar.defs[0].type, DefinitionType.FunctionName, "greet def type is FunctionName");
assert.strictEqual(greetVar.defs[0].name.name, "greet", "greet def name matches");

const fnNode = ast.body[1];
const greetScope = scopeManager.acquire(fnNode);
assert(greetScope, "greetScope acquired");
const paramVar = greetScope.set.get("name");
assert(paramVar, "greetScope contains name parameter");
assert.strictEqual(paramVar.defs.length, 1, "param variable has 1 definition");
assert.strictEqual(paramVar.defs[0].type, DefinitionType.Parameter, "param def type is Parameter");
assert.strictEqual(paramVar.defs[0].name.name, "name", "param def name matches");

// 3. Assert ImportDeclaration creates ImportBinding definition with matching DefinitionType
const importVar = moduleScope.set.get("foo");
assert(importVar, "moduleScope contains foo import variable");
assert.strictEqual(importVar.defs.length, 1, "foo variable has 1 definition");
assert.strictEqual(importVar.defs[0].type, DefinitionType.ImportBinding, "foo def type is ImportBinding");
assert.strictEqual(importVar.defs[0].name.name, "foo", "foo def name matches");

// 4. Assert ClassDeclaration creates ClassName definition with matching DefinitionType
const classVar = moduleScope.set.get("User");
assert(classVar, "moduleScope contains User class variable");
assert.strictEqual(classVar.defs.length, 1, "User variable has 1 definition");
assert.strictEqual(classVar.defs[0].type, DefinitionType.ClassName, "User def type is ClassName");
assert.strictEqual(classVar.defs[0].name.name, "User", "User def name matches");

오리진 시더

익명