Registry / testing / embed-eslint

embed-eslint

JSON →
library3.1.0jsnpmunverified

ESLint integration for embedded TypeScript compilation. Version 3.1.0 provides a runtime ESLint compiler that extends embed-typescript, allowing linting during TypeScript compilation within Node.js or browser applications. Released as part of the embed-typescript monorepo with periodic updates. Key differentiator: unified diagnostics where ESLint violations are reported as TypeScript diagnostics, with full support for type-aware @typescript-eslint rules. Requires peer dependencies: embed-typescript, typescript, eslint, @typescript-eslint/parser, and @typescript-eslint/eslint-plugin.

npm install embed-eslint
INSTALL
IMPORT
SIG · EMBED-ESLINT
E
embed-eslint
testingjavascriptv3.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EmbedEsLint
import { EmbedEsLint } from 'embed-eslint'
const EmbedEsLint = require('embed-eslint')
Package is ESM-only; default export not available, use named import.
IEmbedEsLintProps
import type { IEmbedEsLintProps } from 'embed-eslint'
import { IEmbedEsLintProps } from 'embed-eslint'
TypeScript type should be imported with 'type' modifier to avoid runtime import.
EmbedTypeScript
import { EmbedTypeScript } from 'embed-typescript'
import { EmbedTypeScript } from 'embed-eslint'
EmbedTypeScript is the base class exported from embed-typescript, not from embed-eslint.

Creates an EmbedEsLint compiler with custom rules, compiles a TypeScript file, and outputs ESLint diagnostics.

import { EmbedEsLint } from 'embed-eslint'; import ts from 'typescript'; const compiler = new EmbedEsLint({ compilerOptions: { target: ts.ScriptTarget.ES2015, module: ts.ModuleKind.CommonJS, strict: true, }, rules: { '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/no-unused-vars': 'warn', '@typescript-eslint/explicit-function-return-type': 'error', 'no-console': 'warn', 'no-debugger': 'error', }, }); const result = compiler.compile({ 'src/index.ts': ` async function fetchData() { console.log('Fetching data...'); return { data: 'test' }; } fetchData(); const unused = 42; `, }); if (!result.success) { for (const diagnostic of result.diagnostics) { console.log( diagnostic.severity + ': ' + diagnostic.message + ' at ' + diagnostic.file + ':' + diagnostic.start?.line + ':' + diagnostic.start?.column ); } }
embed-eslint --version
Debug
Known issues
breakingStarting from v2.0.0, embed-eslint was extracted into its own package from embed-typescript. If you were using embed-typescript's built-in ESLint support before v2, you must now install and import from embed-eslint separately.
fix
Install embed-eslint and change imports from 'embed-typescript' to 'embed-eslint' for ESLint functionality.
affects: >=2.0.0
deprecatedThe IEmbedTypeScriptDiagnostic.file property was incorrectly typed in v2.0.0; fixed in v2.0.1. Users relying on the broken property may have incorrect file references.
fix
Upgrade to v2.0.1 or higher.
affects: =2.0.0
gotchaAll peer dependencies (embed-typescript, typescript, eslint, @typescript-eslint/parser, @typescript-eslint/eslint-plugin) must be installed separately. Missing one will cause runtime errors.
fix
Run: npm install embed-typescript typescript eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
affects: >=1.0.0
gotchaESLint rules that require type information (e.g., @typescript-eslint/no-floating-promises) only work if the compiler options include type checking (e.g., 'noEmit: false' or 'declaration: true').
fix
Ensure your compilerOptions include 'strict: true' or set 'noEmit: false' to enable type-aware lint rules.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'embed-eslint' or its corresponding type declarations.
The package is not installed or is not in the project's node_modules.
fix
Install the package: npm install embed-eslint
Module 'embed-eslint' has no exported member 'EmbedEsLint'.
Importing from wrong path or using wrong import style (e.g., default import instead of named).
fix
Use correct named import: import { EmbedEsLint } from 'embed-eslint'
Error: ESLint configuration is invalid: Cannot find module '@typescript-eslint/parser'
Missing peer dependency @typescript-eslint/parser.
fix
Install the missing dependency: npm install @typescript-eslint/parser
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
embed-typescriptrequiredCore embedding TypeScript compiler; embed-eslint extends it
eslintrequiredPeer dependency for ESLint core functionality
@typescript-eslint/parserrequiredPeer dependency for parsing TypeScript code
@typescript-eslint/eslint-pluginrequiredPeer dependency for TypeScript-specific lint rules
typescriptrequiredPeer dependency for TypeScript compilation
Agent activity
2 hits · last 30 days
node
2
Resources
embed-eslint — npm install embed-eslint · libregistry