サンプル
@typescript-eslint/types 8.69.0: TSESTree
検証済みサンプル — npm @typescript-eslint/types 8.69.0: TSESTree. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: TSESTree exports AST_NODE_TYPES and…
sha256:1a471b23a9730c04f52305b286989dbe05cfbc2d61b661d7e07e02116a2709f0
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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 |
ケース
HOW- ゴール
- verify @typescript-eslint/types.TSESTree in pkg:npm/%40typescript-eslint/types@8.69.0
- シンボル
-
- @typescript-eslint/types.TSESTree
- 作成日
- 2026-10-11T18:39:17Z
コントラクト
- 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
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 @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.
{"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"}
{
"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": "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"
}
}
{
"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"
]
}
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,
};
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);
});
オリジンシーダー
匿名