Пример
@typescript-eslint/scope-manager 8.65.0: ScopeType
Проверенный пример — npm @typescript-eslint/scope-manager 8.65.0: ScopeType. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден.
sha256:740b99404cc5f8f9582f65f1dba1033590962e43c205ed7b8f08b45c17cce355
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux 24 · ubuntu · glibc 2.39 x64 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-05 |
Кейс
HOW- Цель
- verify @typescript-eslint/scope-manager.ScopeType in pkg:npm/%40typescript-eslint/scope-manager@8.65.0
- Символы
-
- @typescript-eslint/scope-manager.ScopeType
- Создан
- 2026-09-05T18:00:48Z
Контракт
- assert ScopeType exports canonical string discriminators for lexical and TypeScript scopes
- assert analyze creates root global scope and nests module ScopeType when sourceType is module
- assert analyze identifies function and block ScopeType in function declarations with block bodies
- assert analyze assigns for, catch, and switch ScopeType to control flow and exception scopes
- assert analyze assigns class ScopeType and registers class member definitions
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Исходный код
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.ScopeType in 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
Demonstrate these symbols/APIs:
- @typescript-eslint/scope-manager.ScopeType
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.
{"case":{"caseId":"case:sha256:0fe83dd2c86e4e6e8fc7c414205e483b7f68c5cd8231e507ad67f4b1340aa021","contract":["assert ScopeType exports canonical string discriminators for lexical and TypeScript scopes","assert analyze creates root global scope and nests module ScopeType when sourceType is module","assert analyze identifies function and block ScopeType in function declarations with block bodies","assert analyze assigns for, catch, and switch ScopeType to control flow and exception scopes","assert analyze assigns class ScopeType and registers class member definitions"],"goal":"verify @typescript-eslint/scope-manager.ScopeType in pkg:npm/%40typescript-eslint/scope-manager@8.65.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/scope-manager@8.65.0"],"schemaVersion":1,"symbols":["@typescript-eslint/scope-manager.ScopeType"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","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","symbols":["@typescript-eslint/scope-manager.ScopeType"],"verifierAdapter":"node-typescript@1"}
{
"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"
}
}
}
}
{
"name": "sample-typescript-eslint-scope-manager",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/scope-manager": "8.65.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @typescript-eslint/scope-manager.ScopeType in pkg:npm/%40typescript-eslint/scope-manager@8.65.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40typescript-eslint/scope-manager@8.65.0"
],
"symbols": [
"@typescript-eslint/scope-manager.ScopeType"
]
}
import assert from "node:assert/strict";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const { ScopeType, analyze } = require("@typescript-eslint/scope-manager");
// 1. assert ScopeType exports canonical string discriminators for lexical and TypeScript scopes
assert.strictEqual(ScopeType.block, "block");
assert.strictEqual(ScopeType.catch, "catch");
assert.strictEqual(ScopeType.class, "class");
assert.strictEqual(ScopeType.classFieldInitializer, "class-field-initializer");
assert.strictEqual(ScopeType.classStaticBlock, "class-static-block");
assert.strictEqual(ScopeType.conditionalType, "conditionalType");
assert.strictEqual(ScopeType.for, "for");
assert.strictEqual(ScopeType.function, "function");
assert.strictEqual(ScopeType.functionExpressionName, "function-expression-name");
assert.strictEqual(ScopeType.functionType, "functionType");
assert.strictEqual(ScopeType.global, "global");
assert.strictEqual(ScopeType.mappedType, "mappedType");
assert.strictEqual(ScopeType.module, "module");
assert.strictEqual(ScopeType.switch, "switch");
assert.strictEqual(ScopeType.tsEnum, "tsEnum");
assert.strictEqual(ScopeType.tsModule, "tsModule");
assert.strictEqual(ScopeType.type, "type");
assert.strictEqual(ScopeType.with, "with");
// 2. assert analyze creates root global scope and nests module ScopeType when sourceType is module
const moduleAst = {
type: "Program",
sourceType: "module",
body: [],
range: [0, 0]
};
const moduleManager = analyze(moduleAst, { sourceType: "module" });
assert.strictEqual(moduleManager.scopes.length, 2);
assert.strictEqual(moduleManager.scopes[0].type, ScopeType.global);
assert.strictEqual(moduleManager.scopes[1].type, ScopeType.module);
const scriptAst = {
type: "Program",
sourceType: "script",
body: [],
range: [0, 0]
};
const scriptManager = analyze(scriptAst, { sourceType: "script" });
assert.strictEqual(scriptManager.scopes.length, 1);
assert.strictEqual(scriptManager.scopes[0].type, ScopeType.global);
// 3. assert analyze identifies function and block ScopeType in function declarations with block bodies
const fnAst = {
type: "Program",
sourceType: "module",
body: [
{
type: "FunctionDeclaration",
id: { type: "Identifier", name: "compute", range: [9, 16], decorators: [] },
params: [{ type: "Identifier", name: "x", range: [17, 18], decorators: [] }],
generator: false,
async: false,
decorators: [],
body: {
type: "BlockStatement",
body: [
{
type: "BlockStatement",
body: [
{
type: "VariableDeclaration",
kind: "let",
declarations: [
{
type: "VariableDeclarator",
id: { type: "Identifier", name: "y", range: [35, 36], decorators: [] },
init: { type: "Identifier", name: "x", range: [39, 40], decorators: [] }
}
]
}
],
range: [25, 45]
}
],
range: [20, 48]
},
range: [0, 48]
}
],
range: [0, 48]
};
const fnManager = analyze(fnAst, { sourceType: "module" });
const fnScope = fnManager.scopes.find(s => s.type === ScopeType.function);
assert.ok(fnScope, "function scope should be created with ScopeType.function");
assert.strictEqual(fnScope.block.type, "FunctionDeclaration");
const blockScope = fnManager.scopes.find(s => s.type === ScopeType.block);
assert.ok(blockScope, "block scope should be created with ScopeType.block");
assert.strictEqual(blockScope.upper, fnScope);
// 4. assert analyze assigns for, catch, and switch ScopeType to control flow and exception scopes
const controlAst = {
type: "Program",
sourceType: "module",
body: [
{
type: "ForStatement",
init: {
type: "VariableDeclaration",
kind: "let",
declarations: [
{
type: "VariableDeclarator",
id: { type: "Identifier", name: "i", range: [9, 10], decorators: [] },
init: { type: "Literal", value: 0, range: [13, 14] }
}
]
},
test: null,
update: null,
body: { type: "BlockStatement", body: [], range: [18, 20] },
range: [0, 20]
},
{
type: "TryStatement",
block: { type: "BlockStatement", body: [], range: [25, 27] },
handler: {
type: "CatchClause",
param: { type: "Identifier", name: "err", range: [35, 38], decorators: [] },
body: { type: "BlockStatement", body: [], range: [40, 42] },
range: [28, 42]
},
finalizer: null,
range: [21, 42]
},
{
type: "SwitchStatement",
discriminant: { type: "Identifier", name: "i", range: [51, 52], decorators: [] },
cases: [],
range: [44, 56]
}
],
range: [0, 56]
};
const controlManager = analyze(controlAst, { sourceType: "module" });
const forScope = controlManager.scopes.find(s => s.type === ScopeType.for);
assert.ok(forScope, "for scope created with ScopeType.for");
const catchScope = controlManager.scopes.find(s => s.type === ScopeType.catch);
assert.ok(catchScope, "catch scope created with ScopeType.catch");
const switchScope = controlManager.scopes.find(s => s.type === ScopeType.switch);
assert.ok(switchScope, "switch scope created with ScopeType.switch");
// 5. assert analyze assigns class ScopeType and registers class member definitions
const classAst = {
type: "Program",
sourceType: "module",
body: [
{
type: "ClassDeclaration",
id: { type: "Identifier", name: "Container", range: [6, 15], decorators: [] },
superClass: null,
implements: [],
decorators: [],
body: {
type: "ClassBody",
body: [],
range: [16, 18]
},
range: [0, 18]
}
],
range: [0, 18]
};
const classManager = analyze(classAst, { sourceType: "module" });
const classScope = classManager.scopes.find(s => s.type === ScopeType.class);
assert.ok(classScope, "class scope created with ScopeType.class");
assert.strictEqual(classScope.block.type, "ClassDeclaration");
Исходный сидер
аноним