サンプル
@typescript-eslint/types 8.69.0: AST_NODE_TYPES
検証済みサンプル — npm @typescript-eslint/types 8.69.0: AST_NODE_TYPES. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: AST_NODE_TYPES provides canonical…
sha256:d0b5c726488b53f9ff56203c6fd886fcd0ecf9aa7e90dec45e2e263858ad4227
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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.AST_NODE_TYPES in pkg:npm/%40typescript-eslint/types@8.69.0
- シンボル
-
- @typescript-eslint/types.AST_NODE_TYPES
- 環境
- node 22.23.2
- 作成日
- 2026-10-11T16:46:08Z
コントラクト
- AST_NODE_TYPES provides canonical string enum mappings for standard ECMAScript AST node types including Identifier, Literal, Program, FunctionDeclaration, and ReturnStatement
- AST_NODE_TYPES provides canonical string enum mappings for TypeScript-specific AST node types including TSInterfaceDeclaration, TSTypeAliasDeclaration, TSTypeAnnotation, and TSTypeReference
- AST_NODE_TYPES provides canonical string enum mappings for JSX AST node types including JSXElement, JSXAttribute, and JSXOpeningElement
- isValidNodeType validates arbitrary strings against known AST_NODE_TYPES enum members
- getNodeTypeCategory categorizes AST_NODE_TYPES members into typescript, jsx, declaration, statement, and expression categories
- isTypeDeclarationNode identifies TypeScript type and interface declarations using AST_NODE_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.AST_NODE_TYPES 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.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:beb474d04eb92f545d461c7f1d7d3c6b4afceaabb99397b1003fea241d540378","contract":["AST_NODE_TYPES provides canonical string enum mappings for standard ECMAScript AST node types including Identifier, Literal, Program, FunctionDeclaration, and ReturnStatement","AST_NODE_TYPES provides canonical string enum mappings for TypeScript-specific AST node types including TSInterfaceDeclaration, TSTypeAliasDeclaration, TSTypeAnnotation, and TSTypeReference","AST_NODE_TYPES provides canonical string enum mappings for JSX AST node types including JSXElement, JSXAttribute, and JSXOpeningElement","isValidNodeType validates arbitrary strings against known AST_NODE_TYPES enum members","getNodeTypeCategory categorizes AST_NODE_TYPES members into typescript, jsx, declaration, statement, and expression categories","isTypeDeclarationNode identifies TypeScript type and interface declarations using AST_NODE_TYPES"],"goal":"verify @typescript-eslint/types.AST_NODE_TYPES 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.AST_NODE_TYPES"]},"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","symbols":["@typescript-eslint/types.AST_NODE_TYPES"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-typescript-eslint-types-ast-node-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-typescript-eslint-types-ast-node-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-ast-node-types",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of @typescript-eslint/types AST_NODE_TYPES",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"@typescript-eslint/types": "8.69.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @typescript-eslint/types.AST_NODE_TYPES in pkg:npm/%40typescript-eslint/types@8.69.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40typescript-eslint/types@8.69.0"
],
"symbols": [
"@typescript-eslint/types.AST_NODE_TYPES"
]
}
const { AST_NODE_TYPES } = require('@typescript-eslint/types');
/**
* Validates whether the given string is a known member of AST_NODE_TYPES.
*
* @param {string} typeName - The candidate node type name.
* @returns {boolean} True if typeName exists in AST_NODE_TYPES.
*/
function isValidNodeType(typeName) {
if (typeof typeName !== 'string') {
return false;
}
return Object.prototype.hasOwnProperty.call(AST_NODE_TYPES, typeName);
}
/**
* Categorizes an AST node type into a major syntactic group.
*
* @param {string} nodeType - The AST node type string to categorize.
* @returns {string} One of 'statement', 'expression', 'declaration', 'typescript', 'jsx', 'other', or 'unknown'.
*/
function getNodeTypeCategory(nodeType) {
if (typeof nodeType !== 'string' || !isValidNodeType(nodeType)) {
return 'unknown';
}
if (nodeType.startsWith('TS')) {
return 'typescript';
}
if (nodeType.startsWith('JSX')) {
return 'jsx';
}
if (nodeType.endsWith('Declaration')) {
return 'declaration';
}
if (nodeType.endsWith('Statement')) {
return 'statement';
}
if (nodeType.endsWith('Expression') || nodeType.endsWith('Literal') || nodeType === AST_NODE_TYPES.Identifier) {
return 'expression';
}
return 'other';
}
/**
* Checks if a given AST node is a TypeScript type declaration node.
*
* @param {object} node - The AST node to check.
* @returns {boolean} True if the node represents a TypeScript interface or type alias declaration.
*/
function isTypeDeclarationNode(node) {
if (!node || typeof node.type !== 'string') {
return false;
}
return (
node.type === AST_NODE_TYPES.TSInterfaceDeclaration ||
node.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
node.type === AST_NODE_TYPES.TSEnumDeclaration ||
node.type === AST_NODE_TYPES.TSModuleDeclaration
);
}
module.exports = {
AST_NODE_TYPES,
getNodeTypeCategory,
isTypeDeclarationNode,
isValidNodeType,
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
AST_NODE_TYPES,
getNodeTypeCategory,
isTypeDeclarationNode,
isValidNodeType,
} = require('../src/index.js');
async function runContract() {
// 1. AST_NODE_TYPES provides canonical string enum mappings for standard ECMAScript AST node types
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.Program, 'Program');
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.ReturnStatement, 'ReturnStatement');
// 2. AST_NODE_TYPES provides canonical string enum mappings for TypeScript-specific AST node types
assert.strictEqual(AST_NODE_TYPES.TSInterfaceDeclaration, 'TSInterfaceDeclaration');
assert.strictEqual(AST_NODE_TYPES.TSTypeAliasDeclaration, 'TSTypeAliasDeclaration');
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.TSIntersectionType, 'TSIntersectionType');
assert.strictEqual(AST_NODE_TYPES.TSAsExpression, 'TSAsExpression');
// 3. AST_NODE_TYPES provides canonical string enum mappings for JSX AST node types
assert.strictEqual(AST_NODE_TYPES.JSXElement, 'JSXElement');
assert.strictEqual(AST_NODE_TYPES.JSXAttribute, 'JSXAttribute');
assert.strictEqual(AST_NODE_TYPES.JSXOpeningElement, 'JSXOpeningElement');
assert.strictEqual(AST_NODE_TYPES.JSXClosingElement, 'JSXClosingElement');
assert.strictEqual(AST_NODE_TYPES.JSXIdentifier, 'JSXIdentifier');
// 4. isValidNodeType validates arbitrary strings against known AST_NODE_TYPES enum members
assert.strictEqual(isValidNodeType('Identifier'), true);
assert.strictEqual(isValidNodeType('TSInterfaceDeclaration'), true);
assert.strictEqual(isValidNodeType('JSXElement'), true);
assert.strictEqual(isValidNodeType('NonExistentNodeType'), false);
assert.strictEqual(isValidNodeType(''), false);
assert.strictEqual(isValidNodeType(null), false);
assert.strictEqual(isValidNodeType(undefined), false);
// 5. getNodeTypeCategory categorizes AST_NODE_TYPES into typescript, jsx, declaration, statement, expression, and other
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.TSInterfaceDeclaration), 'typescript');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.TSTypeReference), 'typescript');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.JSXElement), 'jsx');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.JSXAttribute), 'jsx');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.FunctionDeclaration), 'declaration');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.VariableDeclaration), 'declaration');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.ReturnStatement), 'statement');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.IfStatement), 'statement');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.BinaryExpression), 'expression');
assert.strictEqual(getNodeTypeCategory(AST_NODE_TYPES.Identifier), 'expression');
assert.strictEqual(getNodeTypeCategory('UnknownNode'), 'unknown');
// 6. isTypeDeclarationNode identifies TypeScript type and interface declarations using AST_NODE_TYPES
const interfaceNode = { type: AST_NODE_TYPES.TSInterfaceDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'Config' } };
const typeAliasNode = { type: AST_NODE_TYPES.TSTypeAliasDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'Id' } };
const enumNode = { type: AST_NODE_TYPES.TSEnumDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'Direction' } };
const functionNode = { type: AST_NODE_TYPES.FunctionDeclaration, id: { type: AST_NODE_TYPES.Identifier, name: 'run' } };
const varNode = { type: AST_NODE_TYPES.VariableDeclaration, kind: 'const', declarations: [] };
assert.strictEqual(isTypeDeclarationNode(interfaceNode), true);
assert.strictEqual(isTypeDeclarationNode(typeAliasNode), true);
assert.strictEqual(isTypeDeclarationNode(enumNode), true);
assert.strictEqual(isTypeDeclarationNode(functionNode), false);
assert.strictEqual(isTypeDeclarationNode(varNode), false);
assert.strictEqual(isTypeDeclarationNode(null), false);
assert.strictEqual(isTypeDeclarationNode({}), false);
console.log('Contract assertions passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
オリジンシーダー
匿名