示例
eslint-scope 8.4.0: eslint-scope
已验证示例 — npm eslint-scope 8.4.0: eslint-scope. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: analyze creates ImportBinding definition for module…
sha256:e99fe92a45435ee65cf59863b0a13b01d51f90aea21ccde9c47155fb2cb707d2
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
linux 24 · ubuntu · glibc 2.39 x64 npm
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| 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 eslint-scope in pkg:npm/eslint-scope@8.4.0
- 符号
-
- eslint-scope
- 创建时间
- 2026-08-27T09:53:58Z
契约
- analyze creates ImportBinding definition for module imports referenced across scopes
- ClassDeclaration creates ClassScope and binds class name in both outer and class scopes
- MethodDefinition FunctionExpression creates function scope with arguments and parameter definitions
- ArrowFunctionExpression creates function scope without arguments binding
- ArrowFunctionExpression resolves lexical references to outer method parameters
文件
- 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 eslint-scope in pkg:npm/eslint-scope@8.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/eslint-scope@8.4.0
Demonstrate these symbols/APIs:
- eslint-scope
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:373d8ad3c1b1fc24c8e14186902c2eca4b61b31391e06c1c1acc85ec2c022efa","contract":["analyze creates ImportBinding definition for module imports referenced across scopes","ClassDeclaration creates ClassScope and binds class name in both outer and class scopes","MethodDefinition FunctionExpression creates function scope with arguments and parameter definitions","ArrowFunctionExpression creates function scope without arguments binding","ArrowFunctionExpression resolves lexical references to outer method parameters"],"goal":"verify eslint-scope in pkg:npm/eslint-scope@8.4.0","kind":"HOW","packages":["pkg:npm/eslint-scope@8.4.0"],"schemaVersion":1,"symbols":["eslint-scope"]},"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/eslint-scope@8.4.0"],"schemaVersion":1,"subject":"pkg:npm/eslint-scope@8.4.0","symbols":["eslint-scope"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-eslint-scope",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-eslint-scope",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"eslint-scope": "8.4.0"
}
},
"node_modules/eslint-scope": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
"integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
"license": "BSD-2-Clause",
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^5.2.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/esrecurse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
"license": "BSD-2-Clause",
"dependencies": {
"estraverse": "^5.2.0"
},
"engines": {
"node": ">=4.0"
}
},
"node_modules/estraverse": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=4.0"
}
}
}
}
{
"name": "sample-eslint-scope",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"eslint-scope": "8.4.0"
}
}
{
"schemaVersion": 1,
"goal": "verify eslint-scope in pkg:npm/eslint-scope@8.4.0",
"kind": "HOW",
"packages": [
"pkg:npm/eslint-scope@8.4.0"
],
"symbols": [
"eslint-scope"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { analyze } = require('eslint-scope');
// Build an ESTree AST representing import declarations, class hierarchy, method definition, and nested arrow function
const importDecl = {
type: 'ImportDeclaration',
range: [0, 35],
specifiers: [
{
type: 'ImportSpecifier',
range: [9, 17],
imported: { type: 'Identifier', name: 'helper', range: [9, 15] },
local: { type: 'Identifier', name: 'myHelper', range: [9, 17] }
}
],
source: { type: 'Literal', value: './helper.js', raw: "'./helper.js'", range: [24, 35] }
};
const arrowFunc = {
type: 'ArrowFunctionExpression',
range: [105, 179],
id: null,
params: [
{ type: 'Identifier', name: 'delta', range: [106, 111] }
],
body: {
type: 'BinaryExpression',
range: [116, 179],
operator: '+',
left: { type: 'Identifier', name: 'item', range: [116, 120] },
right: { type: 'Identifier', name: 'delta', range: [123, 128] }
},
expression: true
};
const methodFunc = {
type: 'FunctionExpression',
range: [81, 186],
id: null,
params: [
{ type: 'Identifier', name: 'item', range: [82, 86] }
],
body: {
type: 'BlockStatement',
range: [88, 186],
body: [
{
type: 'ReturnStatement',
range: [98, 180],
argument: arrowFunc
}
]
}
};
const classDecl = {
type: 'ClassDeclaration',
range: [37, 190],
id: { type: 'Identifier', name: 'Service', range: [43, 50] },
superClass: { type: 'Identifier', name: 'myHelper', range: [59, 67] },
body: {
type: 'ClassBody',
range: [68, 190],
body: [
{
type: 'MethodDefinition',
range: [74, 186],
key: { type: 'Identifier', name: 'process', range: [74, 81] },
computed: false,
kind: 'method',
static: false,
value: methodFunc
}
]
}
};
const ast = {
type: 'Program',
range: [0, 190],
sourceType: 'module',
body: [importDecl, classDecl]
};
const scopeManager = analyze(ast, {
ecmaVersion: 2022,
sourceType: 'module'
});
assert.strictEqual(scopeManager.scopes.length, 5);
const [, moduleScope, classScope, methodScope, arrowScope] = scopeManager.scopes;
// 1. analyze creates ImportBinding definition for module imports referenced across scopes
const helperVar = moduleScope.set.get('myHelper');
assert.ok(helperVar, 'myHelper variable should exist in module scope');
assert.strictEqual(helperVar.defs[0].type, 'ImportBinding');
assert.strictEqual(helperVar.references.length, 1);
assert.strictEqual(helperVar.references[0].from, classScope);
// 2. ClassDeclaration creates ClassScope and binds class name in both outer and class scopes
assert.strictEqual(classScope.type, 'class');
assert.strictEqual(classScope.block, classDecl);
const outerClassVar = moduleScope.set.get('Service');
const innerClassVar = classScope.set.get('Service');
assert.ok(outerClassVar, 'Service should be bound in module scope');
assert.ok(innerClassVar, 'Service should be bound in class scope');
assert.strictEqual(outerClassVar.defs[0].type, 'ClassName');
// 3. MethodDefinition FunctionExpression creates function scope with arguments and parameter definitions
assert.strictEqual(methodScope.type, 'function');
assert.strictEqual(methodScope.block, methodFunc);
assert.ok(methodScope.set.has('arguments'), 'method scope should define arguments');
const itemVar = methodScope.set.get('item');
assert.ok(itemVar, 'item parameter should be defined in method scope');
assert.strictEqual(itemVar.defs[0].type, 'Parameter');
// 4. ArrowFunctionExpression creates function scope without arguments binding
assert.strictEqual(arrowScope.type, 'function');
assert.strictEqual(arrowScope.block, arrowFunc);
assert.strictEqual(arrowScope.set.has('arguments'), false, 'arrow function scope should not define arguments');
const deltaVar = arrowScope.set.get('delta');
assert.ok(deltaVar, 'delta parameter should be defined in arrow function scope');
// 5. ArrowFunctionExpression resolves lexical references to outer method parameters
assert.strictEqual(itemVar.references.length, 1);
const itemRef = itemVar.references[0];
assert.strictEqual(itemRef.from, arrowScope);
assert.strictEqual(itemRef.resolved, itemVar);
assert.strictEqual(itemRef.isRead(), true);
原始种子者
匿名