CodeSampleX

Sample

eslint-scope 8.4.0: eslint-scope

Verified sample for npm eslint-scope 8.4.0: eslint-scope. The contract ran on node 22 · linux alpine/x64 · docker and passed: analyze creates ImportBinding…

sha256:e99fe92a45435ee65cf59863b0a13b01d51f90aea21ccde9c47155fb2cb707d2

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux 24 · ubuntu · glibc 2.39 x64 npm

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
verify eslint-scope in pkg:npm/eslint-scope@8.4.0
Packages
Symbols
  • eslint-scope
Created
2026-08-27T09:53:58Z

Contract

  1. analyze creates ImportBinding definition for module imports referenced across scopes
  2. ClassDeclaration creates ClassScope and binds class name in both outer and class scopes
  3. MethodDefinition FunctionExpression creates function scope with arguments and parameter definitions
  4. ArrowFunctionExpression creates function scope without arguments binding
  5. ArrowFunctionExpression resolves lexical references to outer method parameters

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

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 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.
csx.json
{"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"}
package-lock.json
{
  "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"
      }
    }
  }
}
package.json
{
  "name": "sample-eslint-scope",
  "version": "1.0.0",
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "eslint-scope": "8.4.0"
  }
}
spec.json
{
  "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"
  ]
}
test/contract.mjs
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);

Origin Seeder

anonymous