CodeSampleX

サンプル

@typescript-eslint/scope-manager 8.65.0

検証済みサンプル — npm @typescript-eslint/scope-manager 8.65.0. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: assert TSInterfaceDeclaration with…

sha256:6ea3253631bd4c41c822b9eb1e579124d0738742ea907dc1f38f2b13e2a03939

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 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/%40typescript-eslint/scope-manager@8.65.0
パッケージ
環境
node 22.23.2
作成日
2026-08-27T17:11:32Z

コントラクト

  1. assert TSInterfaceDeclaration with TSTypeParameterDeclaration creates TypeScope containing type parameter variables
  2. assert getDeclaredVariables retrieves type variables defined by TSInterfaceDeclaration
  3. assert CatchClause creates CatchScope with CatchClauseDefinition for error parameter
  4. assert ForStatement with lexical declarations creates ForScope isolating loop variable

ファイル

  • 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.65.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40typescript-eslint/scope-manager@8.65.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:70ad4d86b8a70ec7e05ba62e949bf6988f43b3e086608fe2927562d47328b0e0","constraints":{"executionContext":"node"},"contract":["assert TSInterfaceDeclaration with TSTypeParameterDeclaration creates TypeScope containing type parameter variables","assert getDeclaredVariables retrieves type variables defined by TSInterfaceDeclaration","assert CatchClause creates CatchScope with CatchClauseDefinition for error parameter","assert ForStatement with lexical declarations creates ForScope isolating loop variable"],"goal":"verify pkg:npm/%40typescript-eslint/scope-manager@8.65.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/scope-manager@8.65.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.65.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/scope-manager@8.65.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.65.0"
      }
    },
    "node_modules/@typescript-eslint/scope-manager": {
      "version": "8.65.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.65.0.tgz",
      "integrity": "sha512-Esbl8OSYiVxBokYgWPf7VVWg/BE798wXhimnn9ML9Pt5qoDf8bfQlgjlKXR/k98+AcNzlLKYrpCcrcuZ9DZLgg==",
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.65.0",
        "@typescript-eslint/visitor-keys": "8.65.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.65.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.65.0.tgz",
      "integrity": "sha512-JSSwWNy+H0E/01jJEM+hrX6N0OFDzFzeIhHFSAS01tlVaevpG8cFyYRPhS5yjGOvBUx3sqQHVMjCL1CAZZMxBg==",
      "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.65.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.65.0.tgz",
      "integrity": "sha512-8C71BQkGjiMmXtop7pHVJu1l2NNShFdkCyD6a2ezzs5vU/L3LRtb69EtcteFwz0mYMPzIgOw0n6OV4VBUWZd7A==",
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.65.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.65.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40typescript-eslint/scope-manager@8.65.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/scope-manager@8.65.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,
  TypeScope,
  CatchScope,
  ForScope,
  Variable
} = require("@typescript-eslint/scope-manager");

// Construct AST for interface, try-catch, and for-loop
const ast = {
  type: "Program",
  body: [
    // interface Repository<T> { findById(id: string): T; }
    {
      type: "TSInterfaceDeclaration",
      id: { type: "Identifier", name: "Repository", range: [10, 20], decorators: [] },
      typeParameters: {
        type: "TSTypeParameterDeclaration",
        params: [
          {
            type: "TSTypeParameter",
            name: { type: "Identifier", name: "T", range: [21, 22] },
            range: [21, 22]
          }
        ],
        range: [20, 23]
      },
      extends: [],
      body: {
        type: "TSInterfaceBody",
        body: [],
        range: [24, 50]
      },
      range: [0, 50]
    },
    // try { doSomething(); } catch (err) { handleError(err); }
    {
      type: "TryStatement",
      block: { type: "BlockStatement", body: [], range: [56, 75] },
      handler: {
        type: "CatchClause",
        param: { type: "Identifier", name: "err", range: [83, 86] },
        body: { type: "BlockStatement", body: [], range: [88, 110] },
        range: [76, 110]
      },
      finalizer: null,
      range: [52, 110]
    },
    // for (let i = 0; i < 10; i++) { process(i); }
    {
      type: "ForStatement",
      init: {
        type: "VariableDeclaration",
        kind: "let",
        declarations: [
          {
            type: "VariableDeclarator",
            id: { type: "Identifier", name: "i", range: [120, 121], decorators: [] },
            init: { type: "Literal", value: 0, raw: "0", range: [124, 125] },
            range: [120, 125]
          }
        ],
        range: [116, 125],
        decorators: []
      },
      test: null,
      update: null,
      body: { type: "BlockStatement", body: [], range: [135, 150] },
      range: [111, 150]
    }
  ],
  sourceType: "module",
  range: [0, 150],
  comments: [],
  tokens: []
};

const scopeManager = analyze(ast, { sourceType: "module" });
assert(scopeManager instanceof ScopeManager, "analyze returns ScopeManager instance");

// 1. Assert TSInterfaceDeclaration with TSTypeParameterDeclaration creates TypeScope containing type parameter variables
const interfaceNode = ast.body[0];
const typeScope = scopeManager.acquire(interfaceNode);
assert(typeScope instanceof TypeScope, "acquire returns TypeScope for interface with type parameters");
assert.strictEqual(typeScope.type, ScopeType.type, "typeScope type is ScopeType.type");
assert(typeScope.set.has("T"), "typeScope contains type parameter T");
assert.strictEqual(typeScope.set.get("T").defs[0].type, DefinitionType.Type, "T definition type is Type");

// 2. Assert getDeclaredVariables retrieves type variables defined by TSInterfaceDeclaration
const declaredVars = scopeManager.getDeclaredVariables(interfaceNode);
assert.strictEqual(declaredVars.length, 1, "interface declares exactly 1 variable");
assert.strictEqual(declaredVars[0].name, "Repository", "declared variable name is Repository");
assert.strictEqual(declaredVars[0].defs[0].type, DefinitionType.Type, "Repository definition type is Type");

// 3. Assert CatchClause creates CatchScope with CatchClauseDefinition for error parameter
const catchNode = ast.body[1].handler;
const catchScope = scopeManager.acquire(catchNode);
assert(catchScope instanceof CatchScope, "acquire returns CatchScope for CatchClause");
assert.strictEqual(catchScope.type, ScopeType.catch, "catchScope type is ScopeType.catch");
assert(catchScope.set.has("err"), "catchScope contains catch parameter err");
assert.strictEqual(catchScope.set.get("err").defs[0].type, DefinitionType.CatchClause, "err definition type is CatchClause");

// 4. Assert ForStatement with lexical declarations creates ForScope isolating loop variable
const forNode = ast.body[2];
const forScope = scopeManager.acquire(forNode);
assert(forScope instanceof ForScope, "acquire returns ForScope for ForStatement");
assert.strictEqual(forScope.type, ScopeType.for, "forScope type is ScopeType.for");
assert(forScope.set.has("i"), "forScope contains loop variable i");
assert.strictEqual(forScope.set.get("i").defs[0].type, DefinitionType.Variable, "i definition type is Variable");

オリジンシーダー

匿名