CodeSampleX

Sample

@typescript-eslint/types 8.69.0: TSESTree

Verified sample for npm @typescript-eslint/types 8.69.0: TSESTree. The contract ran on node 22 · linux debian/x64 · docker and passed.

sha256:1a471b23a9730c04f52305b286989dbe05cfbc2d61b661d7e07e02116a2709f0

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 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

Case

HOW
Goal
verify @typescript-eslint/types.TSESTree in pkg:npm/%40typescript-eslint/types@8.69.0
Packages
Symbols
  • @typescript-eslint/types.TSESTree
Created
2026-10-11T18:39:17Z

Contract

  1. TSESTree exports AST_NODE_TYPES and AST_TOKEN_TYPES enum namespaces for ESTree and TypeScript syntax trees
  2. TSESTree.AST_NODE_TYPES provides canonical node type identifiers for core JavaScript and TypeScript AST nodes
  3. TSESTree.AST_TOKEN_TYPES provides canonical token type identifiers for lexical tokens
  4. isTypeScriptNode identifies TypeScript-specific AST node structures from TSESTree.AST_NODE_TYPES
  5. isDeclarationNode identifies declaration statements and constructs defined in TSESTree.AST_NODE_TYPES
  6. isExpressionNode identifies expression constructs and leaf nodes defined in TSESTree.AST_NODE_TYPES
  7. classifyToken classifies comment and punctuation tokens using TSESTree.AST_TOKEN_TYPES

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • 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 @typescript-eslint/types.TSESTree in pkg:npm/%40typescript-eslint/types@8.69.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40typescript-eslint/types@8.69.0
Demonstrate these symbols/APIs:
  - @typescript-eslint/types.TSESTree

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:2ea7665d87dacdafffdba4ad6fe399e9cae2776a0e64c06dd48d0bda96356980","contract":["TSESTree exports AST_NODE_TYPES and AST_TOKEN_TYPES enum namespaces for ESTree and TypeScript syntax trees","TSESTree.AST_NODE_TYPES provides canonical node type identifiers for core JavaScript and TypeScript AST nodes","TSESTree.AST_TOKEN_TYPES provides canonical token type identifiers for lexical tokens","isTypeScriptNode identifies TypeScript-specific AST node structures from TSESTree.AST_NODE_TYPES","isDeclarationNode identifies declaration statements and constructs defined in TSESTree.AST_NODE_TYPES","isExpressionNode identifies expression constructs and leaf nodes defined in TSESTree.AST_NODE_TYPES","classifyToken classifies comment and punctuation tokens using TSESTree.AST_TOKEN_TYPES"],"goal":"verify @typescript-eslint/types.TSESTree in pkg:npm/%40typescript-eslint/types@8.69.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/types@8.69.0"],"schemaVersion":1,"symbols":["@typescript-eslint/types.TSESTree"]},"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/types@8.69.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/types@8.69.0","symbols":["@typescript-eslint/types.TSESTree"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-typescript-eslint-types",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-typescript-eslint-types",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@typescript-eslint/types": "8.69.0"
      }
    },
    "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"
      }
    }
  }
}
package.json
{
  "name": "sample-typescript-eslint-types",
  "version": "1.0.0",
  "private": true,
  "description": "verify @typescript-eslint/types.TSESTree in pkg:npm/%40typescript-eslint/types@8.69.0",
  "main": "src/index.js",
  "license": "MIT-0",
  "dependencies": {
    "@typescript-eslint/types": "8.69.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @typescript-eslint/types.TSESTree in pkg:npm/%40typescript-eslint/types@8.69.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40typescript-eslint/types@8.69.0"
  ],
  "symbols": [
    "@typescript-eslint/types.TSESTree"
  ]
}
src/index.js
const { TSESTree } = require('@typescript-eslint/types');

const { AST_NODE_TYPES, AST_TOKEN_TYPES } = TSESTree;

/**
 * Checks whether an AST node is a TypeScript-specific syntax or type node.
 *
 * @param {object} node - AST node object.
 * @returns {boolean} True if the node is a TypeScript syntax or type node.
 */
function isTypeScriptNode(node) {
  if (!node || typeof node.type !== 'string') {
    return false;
  }
  return (
    node.type.startsWith('TS') ||
    node.type === AST_NODE_TYPES.TSTypeAnnotation ||
    node.type === AST_NODE_TYPES.TSTypeReference ||
    node.type === AST_NODE_TYPES.TSInterfaceDeclaration ||
    node.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
    node.type === AST_NODE_TYPES.TSUnionType ||
    node.type === AST_NODE_TYPES.TSIntersectionType
  );
}

/**
 * Checks whether an AST node is a declaration statement or construct.
 *
 * @param {object} node - AST node object.
 * @returns {boolean} True if the node is a declaration.
 */
function isDeclarationNode(node) {
  if (!node || typeof node.type !== 'string') {
    return false;
  }
  const declarationTypes = new Set([
    AST_NODE_TYPES.FunctionDeclaration,
    AST_NODE_TYPES.VariableDeclaration,
    AST_NODE_TYPES.ClassDeclaration,
    AST_NODE_TYPES.TSInterfaceDeclaration,
    AST_NODE_TYPES.TSTypeAliasDeclaration,
    AST_NODE_TYPES.TSEnumDeclaration,
    AST_NODE_TYPES.TSModuleDeclaration,
    AST_NODE_TYPES.ExportNamedDeclaration,
    AST_NODE_TYPES.ExportDefaultDeclaration,
    AST_NODE_TYPES.ImportDeclaration,
  ]);
  return declarationTypes.has(node.type);
}

/**
 * Checks whether an AST node is an expression construct.
 *
 * @param {object} node - AST node object.
 * @returns {boolean} True if the node is an expression.
 */
function isExpressionNode(node) {
  if (!node || typeof node.type !== 'string') {
    return false;
  }
  const expressionTypes = new Set([
    AST_NODE_TYPES.Identifier,
    AST_NODE_TYPES.Literal,
    AST_NODE_TYPES.BinaryExpression,
    AST_NODE_TYPES.UnaryExpression,
    AST_NODE_TYPES.CallExpression,
    AST_NODE_TYPES.MemberExpression,
    AST_NODE_TYPES.ArrowFunctionExpression,
    AST_NODE_TYPES.FunctionExpression,
    AST_NODE_TYPES.ArrayExpression,
    AST_NODE_TYPES.ObjectExpression,
    AST_NODE_TYPES.TSAsExpression,
    AST_NODE_TYPES.TSNonNullExpression,
    AST_NODE_TYPES.TSSatisfiesExpression,
  ]);
  return expressionTypes.has(node.type) || node.type.endsWith('Expression') || node.type.endsWith('Literal');
}

/**
 * Classifies a token into category using AST_TOKEN_TYPES.
 *
 * @param {object} token - Lexical token object.
 * @returns {string|null} Category name or null if unclassified.
 */
function classifyToken(token) {
  if (!token || typeof token.type !== 'string') {
    return null;
  }
  if (token.type === AST_TOKEN_TYPES.Block || token.type === AST_TOKEN_TYPES.Line) {
    return 'comment';
  }
  if (token.type === AST_TOKEN_TYPES.Punctuator) {
    return 'punctuator';
  }
  if (token.type === AST_TOKEN_TYPES.Keyword) {
    return 'keyword';
  }
  if (token.type === AST_TOKEN_TYPES.Identifier) {
    return 'identifier';
  }
  return 'other';
}

module.exports = {
  TSESTree,
  AST_NODE_TYPES,
  AST_TOKEN_TYPES,
  isTypeScriptNode,
  isDeclarationNode,
  isExpressionNode,
  classifyToken,
};
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const {
  TSESTree,
  AST_NODE_TYPES,
  AST_TOKEN_TYPES,
  isTypeScriptNode,
  isDeclarationNode,
  isExpressionNode,
  classifyToken,
} = require('../src/index.js');

async function runContract() {
  // 1. TSESTree exports AST_NODE_TYPES and AST_TOKEN_TYPES enum namespaces for ESTree and TypeScript syntax trees
  assert.strictEqual(typeof TSESTree, 'object');
  assert.strictEqual(TSESTree.AST_NODE_TYPES, AST_NODE_TYPES);
  assert.strictEqual(TSESTree.AST_TOKEN_TYPES, AST_TOKEN_TYPES);
  assert.ok(Object.keys(TSESTree.AST_NODE_TYPES).length > 50);
  assert.ok(Object.keys(TSESTree.AST_TOKEN_TYPES).length > 5);

  // 2. TSESTree.AST_NODE_TYPES provides canonical node type identifiers for core JavaScript and TypeScript AST nodes
  assert.strictEqual(AST_NODE_TYPES.Identifier, 'Identifier');
  assert.strictEqual(AST_NODE_TYPES.Literal, 'Literal');
  assert.strictEqual(AST_NODE_TYPES.FunctionDeclaration, 'FunctionDeclaration');
  assert.strictEqual(AST_NODE_TYPES.VariableDeclaration, 'VariableDeclaration');
  assert.strictEqual(AST_NODE_TYPES.TSInterfaceDeclaration, 'TSInterfaceDeclaration');
  assert.strictEqual(AST_NODE_TYPES.TSTypeAnnotation, 'TSTypeAnnotation');
  assert.strictEqual(AST_NODE_TYPES.TSTypeReference, 'TSTypeReference');
  assert.strictEqual(AST_NODE_TYPES.TSUnionType, 'TSUnionType');

  // 3. TSESTree.AST_TOKEN_TYPES provides canonical token type identifiers for lexical tokens
  assert.strictEqual(AST_TOKEN_TYPES.Boolean, 'Boolean');
  assert.strictEqual(AST_TOKEN_TYPES.Identifier, 'Identifier');
  assert.strictEqual(AST_TOKEN_TYPES.Keyword, 'Keyword');
  assert.strictEqual(AST_TOKEN_TYPES.Punctuator, 'Punctuator');
  assert.strictEqual(AST_TOKEN_TYPES.String, 'String');
  assert.strictEqual(AST_TOKEN_TYPES.Block, 'Block');
  assert.strictEqual(AST_TOKEN_TYPES.Line, 'Line');

  // 4. isTypeScriptNode identifies TypeScript-specific AST node structures from TSESTree.AST_NODE_TYPES
  const tsInterface = { type: AST_NODE_TYPES.TSInterfaceDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'User' } };
  const tsTypeRef = { type: AST_NODE_TYPES.TSTypeReference, typeName: { type: AST_NODE_TYPES.Identifier, name: 'string' } };
  const tsTypeAnnotation = { type: AST_NODE_TYPES.TSTypeAnnotation, typeAnnotation: tsTypeRef };
  const jsFunction = { type: AST_NODE_TYPES.FunctionDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'run' } };

  assert.strictEqual(isTypeScriptNode(tsInterface), true);
  assert.strictEqual(isTypeScriptNode(tsTypeRef), true);
  assert.strictEqual(isTypeScriptNode(tsTypeAnnotation), true);
  assert.strictEqual(isTypeScriptNode(jsFunction), false);
  assert.strictEqual(isTypeScriptNode(null), false);
  assert.strictEqual(isTypeScriptNode({}), false);

  // 5. isDeclarationNode identifies declaration statements and constructs defined in TSESTree.AST_NODE_TYPES
  const varDecl = { type: AST_NODE_TYPES.VariableDeclaration, kind: 'const', declarations: [] };
  const funcDecl = { type: AST_NODE_TYPES.FunctionDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'fn' } };
  const binaryExpr = { type: AST_NODE_TYPES.BinaryExpression, operator: '+', left: null, right: null };

  assert.strictEqual(isDeclarationNode(varDecl), true);
  assert.strictEqual(isDeclarationNode(funcDecl), true);
  assert.strictEqual(isDeclarationNode(tsInterface), true);
  assert.strictEqual(isDeclarationNode(binaryExpr), false);
  assert.strictEqual(isDeclarationNode(null), false);

  // 6. isExpressionNode identifies expression constructs and leaf nodes defined in TSESTree.AST_NODE_TYPES
  const identExpr = { type: AST_NODE_TYPES.Identifier, name: 'x' };
  const satisfiesExpr = { type: AST_NODE_TYPES.TSSatisfiesExpression, expression: identExpr };
  const ifStmt = { type: AST_NODE_TYPES.IfStatement, test: identExpr };

  assert.strictEqual(isExpressionNode(binaryExpr), true);
  assert.strictEqual(isExpressionNode(identExpr), true);
  assert.strictEqual(isExpressionNode(satisfiesExpr), true);
  assert.strictEqual(isExpressionNode(ifStmt), false);
  assert.strictEqual(isExpressionNode(null), false);

  // 7. classifyToken classifies comment and punctuation tokens using TSESTree.AST_TOKEN_TYPES
  const blockToken = { type: AST_TOKEN_TYPES.Block, value: 'comment' };
  const lineToken = { type: AST_TOKEN_TYPES.Line, value: 'line' };
  const punctToken = { type: AST_TOKEN_TYPES.Punctuator, value: ';' };
  const kwToken = { type: AST_TOKEN_TYPES.Keyword, value: 'const' };
  const idToken = { type: AST_TOKEN_TYPES.Identifier, value: 'foo' };

  assert.strictEqual(classifyToken(blockToken), 'comment');
  assert.strictEqual(classifyToken(lineToken), 'comment');
  assert.strictEqual(classifyToken(punctToken), 'punctuator');
  assert.strictEqual(classifyToken(kwToken), 'keyword');
  assert.strictEqual(classifyToken(idToken), 'identifier');
  assert.strictEqual(classifyToken({ type: 'Unknown' }), 'other');
  assert.strictEqual(classifyToken(null), null);

  console.log('Contract assertions passed successfully.');
}

runContract().catch((err) => {
  console.error('Contract test failed:', err);
  process.exit(1);
});

Origin Seeder

anonymous