Skip to content

refactor: Adds support for Twoslash-Eslint and makes Twoslasher selection more dynamic#80

Merged
Adammatthiesen merged 19 commits into
mainfrom
adam/rework
Feb 21, 2026
Merged

refactor: Adds support for Twoslash-Eslint and makes Twoslasher selection more dynamic#80
Adammatthiesen merged 19 commits into
mainfrom
adam/rework

Conversation

@Adammatthiesen

Copy link
Copy Markdown
Member

This pull request introduces support for ESLint code blocks in Expressive Code Twoslash, enabling Twoslash transformations and ESLint error annotations directly in markdown code blocks. It also refactors configuration options to allow for multiple Twoslash instances (such as twoslash and eslint), updates documentation to reflect these changes, and adds default ESLint configurations for improved usability.

ESLint Integration and Configuration Enhancements

  • Added support for ESLint code blocks in Expressive Code Twoslash, allowing ESLint errors to be shown as annotations in TypeScript and TSX code blocks by using the eslint trigger in markdown. [1] [2]
  • Refactored plugin configuration to use the new instanceConfigs option, enabling per-instance customization for both twoslash and eslint triggers, including language selection and explicit trigger control. [1] [2]

Documentation Updates

  • Updated the configuration reference documentation to explain the new instanceConfigs structure and provide examples for both twoslash and eslint instances. Added detailed descriptions for ESLint-specific options and their usage. [1] [2] [3]
  • Added a new documentation page describing Twoslash ESLint integration, with examples of both output and markdown usage.

Dependency and Defaults Management

  • Added twoslash-eslint and @typescript-eslint/parser as dependencies for ESLint support. Also updated documentation dependencies to include eslint and @types/eslint. [1] [2] [3]
  • Introduced default instance configurations and ESLint rule sets in consts.ts to ensure sensible defaults for ESLint code block processing.

Internal Refactoring

  • Refactored utility functions to support multiple Twoslash instances, including a map for built-in instances (twoslash, eslint) and a generic function for retrieving and applying the correct transformer based on language and trigger.

These changes collectively make Expressive Code Twoslash more flexible and powerful, especially for documentation sites that want to display ESLint errors inline with code samples.

- Introduced support for Twoslash ESLint in the expressive-code-twoslash package.
- Added a new ESLint option for defining types of code blocks.
- Created documentation for Twoslash ESLint integration with usage examples.
- Updated pnpm workspace configuration to include twoslash-eslint dependency.
@htg-1-studiocms-cloud

htg-1-studiocms-cloud Bot commented Feb 21, 2026

Copy link
Copy Markdown

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
Expressive-Code-Twoslash Docs ✅ Done Preview URL 2026-02-21T11:45:31.718Z

@changeset-bot

changeset-bot Bot commented Feb 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a7a632d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
expressive-code-twoslash Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added twoslash expressive-code-twoslash docs labels Feb 21, 2026
@apollo-git-bot

apollo-git-bot Bot commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

Allure Report Summary

Name Duration Stats New Flaky Retry Report
css-js-gen Tests 10ms Passed tests 37 37 0 0

@pkg-pr-new

pkg-pr-new Bot commented Feb 21, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/withstudiocms/expressive-code-twoslash/css-js-gen@80
npm i https://pkg.pr.new/withstudiocms/expressive-code-twoslash@80

commit: a7a632d

@Adammatthiesen Adammatthiesen marked this pull request as ready for review February 21, 2026 11:34
@Adammatthiesen Adammatthiesen requested a review from a team as a code owner February 21, 2026 11:34
@Adammatthiesen Adammatthiesen merged commit 00f9cad into main Feb 21, 2026
12 checks passed
@Adammatthiesen Adammatthiesen deleted the adam/rework branch February 21, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs twoslash expressive-code-twoslash

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants