{"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,"search_vec":"'0.3.8':22 'annot':10 'back':6 'block':38 'break':52 'cadenc':27 'chang':53 'code':11,37 'current':18 'diagnost':32 'differenti':29 'direct':34 'error':15 'eslint':3,5,14,31 'eslint-back':4 'exampl':12 'experiment':51 'follow':56 'integr':30 'javascript':61 'key':28 'may':54 'monorepo':50 'month':26 'part':46 'releas':23 'result':33 'runner':8 'semver':57 'shiki':64 'ship':58 'sinc':42 'stabl':19 'support':39 'twoslash':2,7,36,49,62 'twoslash-eslint':1 'type':60 'typescript':40,59,65 'v0.3.7':43 'v6':41 'version':20 'vue':63 'warn':17","created_at":"2026-04-25T11:24:09.304889+00:00","updated_at":"2026-04-25T11:24:09.304889+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/twoslashes/twoslash","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/twoslash-eslint","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}