{"id":20632,"library":"twoslash-eslint","title":"twoslash-eslint","description":"ESLint-backed twoslash runner for annotating code examples with ESLint errors and warnings. Current stable version is 0.3.8, released on a monthly cadence. Key differentiators: integrates ESLint diagnostic results directly into twoslash code blocks, supports TypeScript v6 since v0.3.7, and is part of the twoslash monorepo. Experimental — breaking changes may not follow semver. Ships TypeScript types.","status":"active","version":"0.3.8","language":"javascript","source_language":"en","source_url":"https://github.com/twoslashes/twoslash","tags":["javascript","twoslash","vue","shiki","typescript"],"install":[{"cmd":"npm install twoslash-eslint","lang":"bash","label":"npm"},{"cmd":"yarn add twoslash-eslint","lang":"bash","label":"yarn"},{"cmd":"pnpm add twoslash-eslint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency required for ESLint integration","package":"eslint","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require() will fail. Use dynamic import or ESM context.","wrong":"const createTwoslashESLint = require('twoslash-eslint')","symbol":"createTwoslashESLint","correct":"import { createTwoslashESLint } from 'twoslash-eslint'"},{"note":"Default export is an alias for createTwoslashESLint. Available since v0.2.0.","symbol":"default","correct":"import twoslashESLint from 'twoslash-eslint'"},{"note":"TypeScriptESLintRunner is a custom runner class exported from twoslash-eslint, not from core twoslash.","wrong":"import { TypeScriptESLintRunner } from 'twoslash'","symbol":"TypeScriptESLintRunner","correct":"import { TypeScriptESLintRunner } from 'twoslash-eslint'"}],"quickstart":{"code":"import { createTwoslashESLint } from 'twoslash-eslint'\nimport { createTwoslash } from 'twoslash'\n\nconst twoslashESLint = createTwoslashESLint({\n  eslint: {\n    // ESLint options\n    overrideConfig: {\n      rules: { 'no-unused-vars': 'warn' }\n    }\n  }\n})\n\nconst result = createTwoslash({\n  code: 'let x = 1',\n  defaultCompilerOptions: { strict: true },\n  customRunners: [twoslashESLint]\n})","lang":"typescript","description":"Creates an ESLint-backed twoslash runner and applies it to a code example with a custom ESLint rule."},"warnings":[{"fix":"Upgrade TypeScript to >=5.5.0 or stay on v0.2.x if you need older TS support.","message":"Since v0.3.0, TypeScript ^5.5.0 is explicitly required. Older TypeScript versions are unsupported.","severity":"breaking","affected_versions":"<0.3.0"},{"fix":"Pin to a specific version and test upgrades carefully.","message":"The package is experimental and breaking changes may not follow semver.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Remove `writeGlobalTypes` from configuration. Use other Vue type handling mechanisms if needed.","message":"The `writeGlobalTypes` option was removed in v0.3.5 for Vue integration.","severity":"deprecated","affected_versions":">=0.3.5"}],"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 m = await import('twoslash-eslint') or set your project to type: module.","cause":"Using CommonJS require() to import an ESM-only package.","error":"ERR_REQUIRE_ESM: require() of ES Module not supported"},{"fix":"Run npm install twoslash-eslint (peer dep eslint must also be installed).","cause":"Package not installed or missing from package.json dependencies.","error":"Cannot find module 'twoslash-eslint'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}