Skip to content

docs: playground button for TypeScript code example #19671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
docs: add plyground button for ts code example
  • Loading branch information
Tanujkanti4441 committed Apr 29, 2025
commit 46b7616165598d692336568dcd137b8952ef4d16
6 changes: 1 addition & 5 deletions docs/.eleventy.js
Copy link
Member

@mdjermanovic mdjermanovic Jul 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be working well when an example is opened in the Playground. However, something strange happens when the example is then modified because parser encoded in the url becomes "parser":{"version":"8.28.0","meta":{"name":"typescript-eslint/parser","version":"8.28.0"}.

To reproduce:

  1. "Click Open in Playground" in this example: https://deploy-preview-19671--docs-eslint.netlify.app/rules/default-param-last#:~:text=Examples%20of%20incorrect%20TypeScript%20code%20for%20this%20rule
  2. Add and remove a space anywhere, just to change the URL.
  3. The URL becomes this: https://eslint.org/play/#eyJ0ZXh0IjoiLyogZXNsaW50IGRlZmF1bHQtcGFyYW0tbGFzdDogW1wiZXJyb3JcIl0gKi9cblxuZnVuY3Rpb24gaChhID0gMCwgYjogbnVtYmVyKSB7fSIsIm9wdGlvbnMiOnsicnVsZXMiOnt9LCJsYW5ndWFnZU9wdGlvbnMiOnsicGFyc2VyIjp7InZlcnNpb24iOiI4LjI4LjAiLCJtZXRhIjp7Im5hbWUiOiJ0eXBlc2NyaXB0LWVzbGludC9wYXJzZXIiLCJ2ZXJzaW9uIjoiOC4yOC4wIn19LCJwYXJzZXJPcHRpb25zIjp7ImVjbWFGZWF0dXJlcyI6eyJqc3giOnRydWV9LCJzb3VyY2VUeXBlIjoibW9kdWxlIn19fX0=
  4. Copy & paste the URL into another tab.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could reproduce this, have sent a fix in eslint/eslint.org#747.

Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,7 @@ module.exports = function (eleventyConfig) {

const isRuleRemoved = !Object.hasOwn(env.rules_meta, env.title);

/*
* TypeScript isn't yet supported on the playground:
* https://github.com/eslint/eslint.org/issues/709
*/
if (isRuleRemoved || isTypeScriptCode) {
if (isRuleRemoved) {
return `<div class="${type}">`;
}

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy