Ejemplo
@typescript-eslint/typescript-estree 8.69.0: AST_NODE_TYPES
Muestra verificada para npm @typescript-eslint/typescript-estree 8.69.0: AST_NODE_TYPES. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:81bed87fec1d89063385e8be6177cf758be10208a083026a66600ecd885a65ac
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify @typescript-eslint/typescript-estree.AST_NODE_TYPES in pkg:npm/%40typescript-eslint/typescript-estree@8.69.0
- Símbolos
-
- @typescript-eslint/typescript-estree.AST_NODE_TYPES
- Entorno
- node 22.23.2
- Creado
- 2026-10-11T16:53:24Z
Contrato
- assert AST_NODE_TYPES exports standard ESTree and TypeScript AST node type constants
- assert AST_NODE_TYPES matches node types produced by typescript-estree parser
- assert isNodeType and classifyNode validate AST node kinds using AST_NODE_TYPES
- assert findTopLevelNodesByType filters statements matching specific AST_NODE_TYPES
- assert isTypeScriptNode identifies TypeScript syntax nodes using AST_NODE_TYPES
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Código fuente
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/typescript-estree.AST_NODE_TYPES in pkg:npm/%40typescript-eslint/typescript-estree@8.69.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40typescript-eslint/typescript-estree@8.69.0
Demonstrate these symbols/APIs:
- @typescript-eslint/typescript-estree.AST_NODE_TYPES
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:b1ea91e4bfa20cce11d7e35df5a1bde09f1df2b2741b345e1fa0bfc0c425ae5b","constraints":{"executionContext":"node"},"contract":["assert AST_NODE_TYPES exports standard ESTree and TypeScript AST node type constants","assert AST_NODE_TYPES matches node types produced by typescript-estree parser","assert isNodeType and classifyNode validate AST node kinds using AST_NODE_TYPES","assert findTopLevelNodesByType filters statements matching specific AST_NODE_TYPES","assert isTypeScriptNode identifies TypeScript syntax nodes using AST_NODE_TYPES"],"goal":"verify @typescript-eslint/typescript-estree.AST_NODE_TYPES in pkg:npm/%40typescript-eslint/typescript-estree@8.69.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/typescript-estree@8.69.0"],"schemaVersion":1,"symbols":["@typescript-eslint/typescript-estree.AST_NODE_TYPES"]},"contractCommand":["node","test/contract.js"],"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/typescript-estree@8.69.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/typescript-estree@8.69.0","symbols":["@typescript-eslint/typescript-estree.AST_NODE_TYPES"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-typescript-estree-ast-node-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-typescript-estree-ast-node-types",
"version": "1.0.0",
"dependencies": {
"@typescript-eslint/typescript-estree": "8.69.0"
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.69.0.tgz",
"integrity": "sha512-yi4obFrHMmnsesWehHbkg9zMA7Jt8cXT+mKM08G999pH1yT6nqgsHx7MYm0uY1wAj8CqiBXYRJ7WAT0QdQHQXg==",
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.69.0",
"@typescript-eslint/types": "^8.69.0",
"debug": "^4.4.3"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.69.0.tgz",
"integrity": "sha512-xNqK7YTDZsLniQMV/4rpFR8Z5JlqeRvVjuG1YgF/mdPVH84HSD19L8CczMA0qg2RfwEV231GHH3VnToJDo4MfQ==",
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.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"
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.69.0.tgz",
"integrity": "sha512-AdFkgqck3Vudb/kWnxlyafU/4aBhHrbQ9locP2N4psXTy5mOBg0SHJumnLvx7r6g1gV4DKvUFwV2nJZBoqOD8w==",
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.69.0",
"@typescript-eslint/tsconfig-utils": "8.69.0",
"@typescript-eslint/types": "8.69.0",
"@typescript-eslint/visitor-keys": "8.69.0",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"semver": "^7.7.3",
"tinyglobby": "^0.2.15",
"ts-api-utils": "^2.5.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"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/balanced-match": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
"integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
"license": "MIT",
"engines": {
"node": "18 || 20 || >=22"
}
},
"node_modules/brace-expansion": {
"version": "5.0.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
"integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
},
"engines": {
"node": "20 || >=22"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"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"
}
},
"node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"license": "MIT",
"engines": {
"node": ">=12.0.0"
},
"peerDependencies": {
"picomatch": "^3 || ^4"
},
"peerDependenciesMeta": {
"picomatch": {
"optional": true
}
}
},
"node_modules/minimatch": {
"version": "10.2.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
"integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.8"
},
"engines": {
"node": "18 || 20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/picomatch": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/semver": {
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/tinyglobby": {
"version": "0.2.17",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
"license": "MIT",
"dependencies": {
"fdir": "^6.5.0",
"picomatch": "^4.0.4"
},
"engines": {
"node": ">=12.0.0"
},
"funding": {
"url": "https://github.com/sponsors/SuperchupuDev"
}
},
"node_modules/ts-api-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
"integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==",
"license": "MIT",
"engines": {
"node": ">=18.12"
},
"peerDependencies": {
"typescript": ">=4.8.4"
}
},
"node_modules/typescript": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}
{
"name": "sample-typescript-estree-ast-node-types",
"version": "1.0.0",
"private": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "8.69.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @typescript-eslint/typescript-estree.AST_NODE_TYPES in pkg:npm/%40typescript-eslint/typescript-estree@8.69.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40typescript-eslint/typescript-estree@8.69.0"
],
"symbols": [
"@typescript-eslint/typescript-estree.AST_NODE_TYPES"
]
}
const { AST_NODE_TYPES, parse } = require("@typescript-eslint/typescript-estree");
/**
* Returns the AST_NODE_TYPES constant map from typescript-estree.
* @returns {typeof AST_NODE_TYPES}
*/
function getNodeTypes() {
return AST_NODE_TYPES;
}
/**
* Checks whether an AST node matches a specific AST_NODE_TYPES type.
* @param {object} node - AST node to check
* @param {string} type - AST_NODE_TYPES value to compare against
* @returns {boolean}
*/
function isNodeType(node, type) {
if (!node || typeof node !== "object") {
return false;
}
return node.type === type;
}
/**
* Classifies a node kind using AST_NODE_TYPES enum.
* @param {object} node - AST node
* @returns {string} node type or "Unknown"
*/
function classifyNode(node) {
if (!node || typeof node !== "object" || !node.type) {
return "Unknown";
}
return node.type;
}
/**
* Parses code and filters top-level statements matching the given AST node type.
* @param {string} code - TypeScript / JavaScript source code
* @param {string} targetType - Member of AST_NODE_TYPES
* @returns {Array<object>} matching top-level AST nodes
*/
function findTopLevelNodesByType(code, targetType) {
const ast = parse(code);
if (!ast || !Array.isArray(ast.body)) {
return [];
}
return ast.body.filter((statement) => isNodeType(statement, targetType));
}
/**
* Identifies whether a given AST node is a TypeScript-specific syntax node.
* @param {object} node - AST node
* @returns {boolean}
*/
function isTypeScriptNode(node) {
if (!node || typeof node !== "object" || typeof node.type !== "string") {
return false;
}
const tsNodeTypes = new Set([
AST_NODE_TYPES.TSInterfaceDeclaration,
AST_NODE_TYPES.TSTypeAliasDeclaration,
AST_NODE_TYPES.TSTypeAnnotation,
AST_NODE_TYPES.TSTypeReference,
AST_NODE_TYPES.TSEnumDeclaration,
AST_NODE_TYPES.TSModuleDeclaration,
]);
return tsNodeTypes.has(node.type);
}
module.exports = {
getNodeTypes,
isNodeType,
classifyNode,
findTopLevelNodesByType,
isTypeScriptNode,
};
const assert = require("node:assert");
const { AST_NODE_TYPES, parse } = require("@typescript-eslint/typescript-estree");
const {
getNodeTypes,
isNodeType,
classifyNode,
findTopLevelNodesByType,
isTypeScriptNode,
} = require("../src/index.js");
// 1. assert AST_NODE_TYPES exports standard ESTree and TypeScript AST node type constants
const nodeTypes = getNodeTypes();
assert(typeof nodeTypes === "object" && nodeTypes !== null, "AST_NODE_TYPES should be an object");
assert.strictEqual(nodeTypes.Program, "Program");
assert.strictEqual(nodeTypes.Identifier, "Identifier");
assert.strictEqual(nodeTypes.VariableDeclaration, "VariableDeclaration");
assert.strictEqual(nodeTypes.FunctionDeclaration, "FunctionDeclaration");
assert.strictEqual(nodeTypes.TSInterfaceDeclaration, "TSInterfaceDeclaration");
assert.strictEqual(nodeTypes.TSTypeAliasDeclaration, "TSTypeAliasDeclaration");
assert.strictEqual(nodeTypes.TSTypeAnnotation, "TSTypeAnnotation");
assert.strictEqual(nodeTypes.TSTypeReference, "TSTypeReference");
// 2. assert AST_NODE_TYPES matches node types produced by typescript-estree parser
const tsCode = `
interface ItemConfig {
id: number;
name: string;
}
function createItem(config: ItemConfig): string {
return config.name;
}
const active: boolean = true;
`;
const ast = parse(tsCode);
assert.strictEqual(ast.type, AST_NODE_TYPES.Program);
assert.strictEqual(ast.body.length, 3);
assert.strictEqual(ast.body[0].type, AST_NODE_TYPES.TSInterfaceDeclaration);
assert.strictEqual(ast.body[1].type, AST_NODE_TYPES.FunctionDeclaration);
assert.strictEqual(ast.body[2].type, AST_NODE_TYPES.VariableDeclaration);
// 3. assert isNodeType and classifyNode validate AST node kinds using AST_NODE_TYPES
const interfaceNode = ast.body[0];
const functionNode = ast.body[1];
const variableNode = ast.body[2];
assert.strictEqual(isNodeType(interfaceNode, AST_NODE_TYPES.TSInterfaceDeclaration), true);
assert.strictEqual(isNodeType(interfaceNode, AST_NODE_TYPES.FunctionDeclaration), false);
assert.strictEqual(isNodeType(null, AST_NODE_TYPES.Program), false);
assert.strictEqual(classifyNode(interfaceNode), AST_NODE_TYPES.TSInterfaceDeclaration);
assert.strictEqual(classifyNode(functionNode), AST_NODE_TYPES.FunctionDeclaration);
assert.strictEqual(classifyNode(variableNode), AST_NODE_TYPES.VariableDeclaration);
assert.strictEqual(classifyNode(null), "Unknown");
// 4. assert findTopLevelNodesByType filters statements matching specific AST_NODE_TYPES
const interfaces = findTopLevelNodesByType(tsCode, AST_NODE_TYPES.TSInterfaceDeclaration);
assert.strictEqual(interfaces.length, 1);
assert.strictEqual(interfaces[0].type, AST_NODE_TYPES.TSInterfaceDeclaration);
assert.strictEqual(interfaces[0].id.name, "ItemConfig");
const variables = findTopLevelNodesByType(tsCode, AST_NODE_TYPES.VariableDeclaration);
assert.strictEqual(variables.length, 1);
assert.strictEqual(variables[0].type, AST_NODE_TYPES.VariableDeclaration);
const classes = findTopLevelNodesByType(tsCode, AST_NODE_TYPES.ClassDeclaration);
assert.strictEqual(classes.length, 0);
// 5. assert isTypeScriptNode identifies TypeScript syntax nodes using AST_NODE_TYPES
assert.strictEqual(isTypeScriptNode(interfaceNode), true);
assert.strictEqual(isTypeScriptNode(functionNode), false);
assert.strictEqual(isTypeScriptNode(variableNode), false);
console.log("PASS: @typescript-eslint/typescript-estree AST_NODE_TYPES contract verified");
Seeder de origen
anónimo