Exemple
@typescript-eslint/scope-manager 8.69.0: DefinitionType
Échantillon vérifié pour npm @typescript-eslint/scope-manager 8.69.0: DefinitionType. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a…
sha256:e924a81e673b38204b8086d214564970dab45d2a7d53f0a756d149711cd0957e
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- verify @typescript-eslint/scope-manager.DefinitionType in pkg:npm/%40typescript-eslint/scope-manager@8.69.0
- Symboles
-
- @typescript-eslint/scope-manager.DefinitionType
- Environnement
- node 22.23.2
- Créé
- 2026-10-11T18:35:10Z
Contrat
- 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
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
Code source
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.
{"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"}
{
"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"
}
}
}
}
{
"name": "sample-typescript-eslint-scope-manager",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/scope-manager": "8.69.0"
}
}
{
"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"
]
}
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");
Seeder d'origine
anonyme