{"id":20007,"library":"eslint-type-tracer","title":"eslint-type-tracer","description":"A utility for inferring runtime types of expression nodes within ESLint rules, enabling type-aware linting without a full TypeScript type checker. Version 0.5.2 is the latest stable release with support for Temporal, Math.sumPrecise(), well-known symbols, and improved type definitions. It is published under MIT license and maintained by ota-meshi. Key differentiators: lightweight, no external runtime dependencies, limited to single-file analysis (no cross-module inference), and exports ESM via .mjs extension. Designed for ESLint v8.57+, Node.js >=18. Typical use cases include validating arrays, strings, numbers, and other built-in types inside ESLint rule implementations.","status":"active","version":"0.5.2","language":"javascript","source_language":"en","source_url":"https://github.com/ota-meshi/eslint-type-tracer","tags":["javascript","eslint","eslintplugin","eslint-plugin","math","number","lint"],"install":[{"cmd":"npm install eslint-type-tracer","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-type-tracer","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-type-tracer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: the package is designed to work as an ESLint plugin utility and requires ESLint v8.57+","package":"eslint","optional":false}],"imports":[{"note":"Since v0.5.1, package uses .mjs extension. CommonJS require() still works if the runtime supports it, but ESM import is preferred.","wrong":"const { buildTypeTracer } = require('eslint-type-tracer')","symbol":"buildTypeTracer","correct":"import { buildTypeTracer } from 'eslint-type-tracer'"},{"note":"Default import is not supported. Only named exports are available.","wrong":"import buildTypeChecker from 'eslint-type-tracer'","symbol":"buildTypeChecker","correct":"import { buildTypeChecker } from 'eslint-type-tracer'"},{"note":"TypeName is a type exported for TypeScript users; it is not a runtime value. Use type import.","wrong":"","symbol":"TypeName","correct":"import type { TypeName } from 'eslint-type-tracer'"}],"quickstart":{"code":"import { buildTypeTracer } from 'eslint-type-tracer';\nimport type { Rule } from 'eslint';\n\nconst myRule: Rule.RuleModule = {\n  create(context) {\n    const typeTrace = buildTypeTracer(context.sourceCode);\n    return {\n      CallExpression(node) {\n        const callee = node.callee;\n        if (callee.type === 'MemberExpression') {\n          const objectTypeNames = typeTrace(callee.object);\n          if (objectTypeNames.includes('Array')) {\n            context.report({ node, message: 'Array method called.' });\n          }\n        }\n      }\n    };\n  }\n};\n\nexport default myRule;","lang":"typescript","description":"Creates an ESLint rule that uses buildTypeTracer to infer the type of the object in a member expression and reports if it is an Array."},"warnings":[{"fix":"Update to v0.5.2 or later where Temporal definitions were improved.","message":"In v0.5.0, support for Temporal was added, which may cause breakage if your code expects previous behavior with Date-like types now being inferred as Temporal types.","severity":"breaking","affected_versions":">=0.5.0 <0.5.2"},{"fix":"Migrate to v0.2.0+ using buildTypeTracer and buildTypeChecker.","message":"In v0.2.0, the API was redesigned. The previous default export or function signatures are removed.","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Switch to ESM imports ('import { ... } from \"eslint-type-tracer\"') or use dynamic import.","message":"The package is ESM-first starting v0.5.1. CommonJS require may still work but is not officially supported and may break in future versions.","severity":"deprecated","affected_versions":">=0.5.1"},{"fix":"Do not rely on the tool for cross-module inference; consider using TypeScript's type checker if needed.","message":"Type inference is limited to the current file only. Cross-module types cannot be inferred.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use dynamic import: const { buildTypeTracer } = await import('eslint-type-tracer'); or use ESM in your project.","cause":"Since v0.5.1, the package exports ES modules (.mjs) and CommonJS require() is not natively supported in older Node versions.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported."},{"fix":"Ensure eslint-type-tracer is installed and that you are using the correct import: import { buildTypeTracer } from 'eslint-type-tracer'.","cause":"TypeScript cannot find types if the package is not installed or if the import path is wrong.","error":"Cannot find module 'eslint-type-tracer' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}