샘플
@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
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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);
});
오리진 시더
익명