Exemple
@typescript-eslint/types 8.69.0
Échantillon vérifié pour npm @typescript-eslint/types 8.69.0. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:df1412fb8ac7276069de37c90bfddd603d6e2e3e337038858860b39d59ec14f6
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-09-19 |
Cas
HOW- Objectif
- verify pkg:npm/%40typescript-eslint/types@8.69.0
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-09-17T21:54:10Z
Contrat
- AST_NODE_TYPES provides canonical string enum mappings for ESTree and TypeScript AST node types including Identifier, FunctionDeclaration, TSInterfaceDeclaration, and TSTypeAnnotation
- AST_TOKEN_TYPES provides canonical string enum mappings for tokenizer token types including Identifier, Keyword, Punctuator, Block, and Line
- TSESTree namespace exports AST_NODE_TYPES and AST_TOKEN_TYPES for AST manipulation and TypeScript ESTree visitor implementations
- isTypeNode utility distinguishes TypeScript AST nodes from standard JavaScript ESTree nodes using AST_NODE_TYPES
- isDeclaration and isStatement utilities classify AST node structures according to AST_NODE_TYPES enum definitions
- isCommentToken utility identifies comment tokens using AST_TOKEN_TYPES Block and Line definitions
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
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 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
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:415e10ae2db826bf6d36519b9ac3126042c663bab8b9de2ea6a698fcc1443be7","constraints":{"executionContext":"node"},"contract":["AST_NODE_TYPES provides canonical string enum mappings for ESTree and TypeScript AST node types including Identifier, FunctionDeclaration, TSInterfaceDeclaration, and TSTypeAnnotation","AST_TOKEN_TYPES provides canonical string enum mappings for tokenizer token types including Identifier, Keyword, Punctuator, Block, and Line","TSESTree namespace exports AST_NODE_TYPES and AST_TOKEN_TYPES for AST manipulation and TypeScript ESTree visitor implementations","isTypeNode utility distinguishes TypeScript AST nodes from standard JavaScript ESTree nodes using AST_NODE_TYPES","isDeclaration and isStatement utilities classify AST node structures according to AST_NODE_TYPES enum definitions","isCommentToken utility identifies comment tokens using AST_TOKEN_TYPES Block and Line definitions"],"goal":"verify pkg:npm/%40typescript-eslint/types@8.69.0","kind":"HOW","packages":["pkg:npm/%40typescript-eslint/types@8.69.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"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/types@8.69.0"],"schemaVersion":1,"subject":"pkg:npm/%40typescript-eslint/types@8.69.0","verifierAdapter":"node-typescript@1"}
{
"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"
}
}
}
}
{
"name": "sample-typescript-eslint-types",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of @typescript-eslint/types",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/types": "8.69.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40typescript-eslint/types@8.69.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40typescript-eslint/types@8.69.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } = require('@typescript-eslint/types');
/**
* Checks if a given AST node is a TypeScript-specific syntax or type node.
*
* @param {object} node - The AST node to check.
* @returns {boolean} True if the node is a TypeScript type or syntax node.
*/
function isTypeNode(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 if a given AST node is a declaration.
*
* @param {object} node - The AST node to check.
* @returns {boolean} True if the node is a declaration.
*/
function isDeclaration(node) {
if (!node || typeof node.type !== 'string') {
return false;
}
const declTypes = 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 declTypes.has(node.type);
}
/**
* Checks if a given AST node is an expression.
*
* @param {object} node - The AST node to check.
* @returns {boolean} True if the node is an expression.
*/
function isExpression(node) {
if (!node || typeof node.type !== 'string') {
return false;
}
const exprTypes = 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,
]);
return exprTypes.has(node.type) || node.type.endsWith('Expression') || node.type.endsWith('Literal');
}
/**
* Checks if a given AST node is a statement.
*
* @param {object} node - The AST node to check.
* @returns {boolean} True if the node is a statement.
*/
function isStatement(node) {
if (!node || typeof node.type !== 'string') {
return false;
}
const stmtTypes = new Set([
AST_NODE_TYPES.BlockStatement,
AST_NODE_TYPES.BreakStatement,
AST_NODE_TYPES.ContinueStatement,
AST_NODE_TYPES.DoWhileStatement,
AST_NODE_TYPES.ExpressionStatement,
AST_NODE_TYPES.ForInStatement,
AST_NODE_TYPES.ForOfStatement,
AST_NODE_TYPES.ForStatement,
AST_NODE_TYPES.IfStatement,
AST_NODE_TYPES.ReturnStatement,
AST_NODE_TYPES.SwitchStatement,
AST_NODE_TYPES.ThrowStatement,
AST_NODE_TYPES.TryStatement,
AST_NODE_TYPES.WhileStatement,
AST_NODE_TYPES.WithStatement,
AST_NODE_TYPES.VariableDeclaration,
AST_NODE_TYPES.FunctionDeclaration,
AST_NODE_TYPES.ClassDeclaration,
]);
return stmtTypes.has(node.type) || node.type.endsWith('Statement');
}
/**
* Checks if a token is a comment token (Block or Line comment).
*
* @param {object} token - The token to check.
* @returns {boolean} True if the token is a Block or Line comment.
*/
function isCommentToken(token) {
if (!token || typeof token.type !== 'string') {
return false;
}
return token.type === AST_TOKEN_TYPES.Block || token.type === AST_TOKEN_TYPES.Line;
}
/**
* Validates and retrieves the canonical AST node type string.
*
* @param {string} typeName - Name of the node type to validate.
* @returns {string|null} The canonical type string or null if invalid.
*/
function getNodeTypeName(typeName) {
if (typeof typeName === 'string' && Object.prototype.hasOwnProperty.call(AST_NODE_TYPES, typeName)) {
return AST_NODE_TYPES[typeName];
}
return null;
}
/**
* Validates and retrieves the canonical token type string.
*
* @param {string} tokenType - Name of the token type to validate.
* @returns {string|null} The canonical token type string or null if invalid.
*/
function getTokenTypeName(tokenType) {
if (typeof tokenType === 'string' && Object.prototype.hasOwnProperty.call(AST_TOKEN_TYPES, tokenType)) {
return AST_TOKEN_TYPES[tokenType];
}
return null;
}
module.exports = {
AST_NODE_TYPES,
AST_TOKEN_TYPES,
TSESTree,
isTypeNode,
isDeclaration,
isExpression,
isStatement,
isCommentToken,
getNodeTypeName,
getTokenTypeName,
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
AST_NODE_TYPES,
AST_TOKEN_TYPES,
TSESTree,
isTypeNode,
isDeclaration,
isExpression,
isStatement,
isCommentToken,
getNodeTypeName,
getTokenTypeName,
} = require('../src/index.js');
async function runContract() {
// 1. AST_NODE_TYPES provides canonical string enum mappings for ESTree and TypeScript AST node types including Identifier, FunctionDeclaration, TSInterfaceDeclaration, and TSTypeAnnotation
assert.strictEqual(typeof AST_NODE_TYPES, 'object');
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.BinaryExpression, 'BinaryExpression');
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');
assert.strictEqual(AST_NODE_TYPES.JSXElement, 'JSXElement');
assert.strictEqual(getNodeTypeName('Identifier'), 'Identifier');
assert.strictEqual(getNodeTypeName('TSInterfaceDeclaration'), 'TSInterfaceDeclaration');
assert.strictEqual(getNodeTypeName('NonExistentNodeType'), null);
// 2. AST_TOKEN_TYPES provides canonical string enum mappings for tokenizer token types including Identifier, Keyword, Punctuator, Block, and Line
assert.strictEqual(typeof AST_TOKEN_TYPES, 'object');
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.Null, 'Null');
assert.strictEqual(AST_TOKEN_TYPES.Numeric, 'Numeric');
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');
assert.strictEqual(getTokenTypeName('Keyword'), 'Keyword');
assert.strictEqual(getTokenTypeName('Punctuator'), 'Punctuator');
assert.strictEqual(getTokenTypeName('InvalidToken'), null);
// 3. TSESTree namespace exports AST_NODE_TYPES and AST_TOKEN_TYPES for AST manipulation and TypeScript ESTree visitor implementations
assert.strictEqual(typeof TSESTree, 'object');
assert.strictEqual(TSESTree.AST_NODE_TYPES, AST_NODE_TYPES);
assert.strictEqual(TSESTree.AST_TOKEN_TYPES, AST_TOKEN_TYPES);
assert.strictEqual(TSESTree.AST_NODE_TYPES.ReturnStatement, 'ReturnStatement');
assert.strictEqual(TSESTree.AST_TOKEN_TYPES.RegularExpression, 'RegularExpression');
// 4. isTypeNode utility distinguishes TypeScript AST nodes from standard JavaScript ESTree nodes using AST_NODE_TYPES
const tsInterfaceNode = { type: AST_NODE_TYPES.TSInterfaceDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'UserData' } };
const tsTypeRefNode = { type: AST_NODE_TYPES.TSTypeReference, typeName: { type: AST_NODE_TYPES.Identifier, name: 'string' } };
const tsTypeAnnotationNode = { type: AST_NODE_TYPES.TSTypeAnnotation, typeAnnotation: tsTypeRefNode };
const jsFunctionNode = { type: AST_NODE_TYPES.FunctionDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'sum' } };
const jsIdentifierNode = { type: AST_NODE_TYPES.Identifier, name: 'count' };
assert.strictEqual(isTypeNode(tsInterfaceNode), true);
assert.strictEqual(isTypeNode(tsTypeRefNode), true);
assert.strictEqual(isTypeNode(tsTypeAnnotationNode), true);
assert.strictEqual(isTypeNode(jsFunctionNode), false);
assert.strictEqual(isTypeNode(jsIdentifierNode), false);
assert.strictEqual(isTypeNode(null), false);
assert.strictEqual(isTypeNode({}), false);
// 5. isDeclaration and isStatement utilities classify AST node structures according to AST_NODE_TYPES enum definitions
const varDeclNode = { type: AST_NODE_TYPES.VariableDeclaration, kind: 'const', declarations: [] };
const funcDeclNode = { type: AST_NODE_TYPES.FunctionDeclaration, id: jsIdentifierNode };
const ifStmtNode = { type: AST_NODE_TYPES.IfStatement, test: jsIdentifierNode };
const returnStmtNode = { type: AST_NODE_TYPES.ReturnStatement, argument: null };
const binExprNode = { type: AST_NODE_TYPES.BinaryExpression, operator: '+', left: jsIdentifierNode, right: jsIdentifierNode };
assert.strictEqual(isDeclaration(varDeclNode), true);
assert.strictEqual(isDeclaration(funcDeclNode), true);
assert.strictEqual(isDeclaration(tsInterfaceNode), true);
assert.strictEqual(isDeclaration(binExprNode), false);
assert.strictEqual(isDeclaration(returnStmtNode), false);
assert.strictEqual(isStatement(ifStmtNode), true);
assert.strictEqual(isStatement(returnStmtNode), true);
assert.strictEqual(isStatement(varDeclNode), true);
assert.strictEqual(isStatement(funcDeclNode), true);
assert.strictEqual(isStatement(binExprNode), false);
assert.strictEqual(isExpression(binExprNode), true);
assert.strictEqual(isExpression(jsIdentifierNode), true);
assert.strictEqual(isExpression(returnStmtNode), false);
// 6. isCommentToken utility identifies comment tokens using AST_TOKEN_TYPES Block and Line definitions
const blockComment = { type: AST_TOKEN_TYPES.Block, value: ' inline comment ' };
const lineComment = { type: AST_TOKEN_TYPES.Line, value: ' single line ' };
const keywordToken = { type: AST_TOKEN_TYPES.Keyword, value: 'const' };
const punctuatorToken = { type: AST_TOKEN_TYPES.Punctuator, value: ';' };
assert.strictEqual(isCommentToken(blockComment), true);
assert.strictEqual(isCommentToken(lineComment), true);
assert.strictEqual(isCommentToken(keywordToken), false);
assert.strictEqual(isCommentToken(punctuatorToken), false);
assert.strictEqual(isCommentToken(null), false);
console.log('Contract assertions passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Seeder d'origine
anonyme