eslint / eslint.org

ESLint website
Apache License 2.0
74 stars 62 forks source link

Suggestion: Add playground quick links to open a new issue #598

Open JoshuaKGoldberg opened 2 months ago

JoshuaKGoldberg commented 2 months ago

What problem do you want to solve?

Sometimes I open the playground to confirm a reproduction of a rule bug or feature request, then immediately want to file a new issue with the playground. But there's no one-click way to do that. We have to manually copy the environment, configuration, and Minimal Reproduction Example into templates like 🐞 Report a problem. That's inconvenient, and users don't always fill out the templates correctly.

What do you think is the correct solution?

Proposal: let's add a button to the playground with a name like "Report an issue" that links to a pre-filled issue template?

For example, given https://github.com/eslint/eslint/issues/18606's https://eslint.org/play/#eyJ0ZXh0IjoidHJ5IHtcbiAgdGhyb3cgbmV3IEVycm9yKCk7XG59IGNhdGNoIChfKSB7IFxufSIsIm9wdGlvbnMiOnsicnVsZXMiOnsibm8tdW51c2VkLXZhcnMiOlsid2FybiIseyJjYXVnaHRFcnJvcnNJZ25vcmVQYXR0ZXJuIjoiZm9vIn1dfSwibGFuZ3VhZ2VPcHRpb25zIjp7InNvdXJjZVR5cGUiOiJtb2R1bGUiLCJwYXJzZXJPcHRpb25zIjp7ImVjbWFGZWF0dXJlcyI6e319fX19, it would link to the equivalent of:

const url = new URL("https://github.com/eslint/eslint/issues/new?assignees=&labels=bug%2Crepro%3Aneeded&projects=&template=bug-report.yml");
url.searchParams.set("title", "Bug: [no-unused-vars] (fill in)");

// We'd need to add 'id's to the .github/bug-report.yml reproduction input
url.searchParams.set("reproduction", "https://eslint.org/play/#eyJ0ZXh0IjoidHJ5IHtcbiAgdGhyb3cgbmV3IEVycm9yKCk7XG59IGNhdGNoIChfKSB7IFxufSIsIm9wdGlvbnMiOnsicnVsZXMiOnsibm8tdW51c2VkLXZhcnMiOlsid2FybiIseyJjYXVnaHRFcnJvcnNJZ25vcmVQYXR0ZXJuIjoiZm9vIn1dfSwibGFuZ3VhZ2VPcHRpb25zIjp7InNvdXJjZVR5cGUiOiJtb2R1bGUiLCJwYXJzZXJPcHRpb25zIjp7ImVjbWFGZWF0dXJlcyI6e319fX19");
url.searchParams.set("what-actually-happened", "Error 3:10 '_' is defined but never used. Allowed unused caught errors must match /foo/u.  (no-unused-vars)");

Participation

Additional comments

We do this in typescript-eslint and it's quite useful: https://github.com/typescript-eslint/typescript-eslint/issues/4913 -> https://github.com/typescript-eslint/typescript-eslint/pull/4916

nzakas commented 2 months ago

I'd like to see a mockup of where you envision this button going before giving a :+1:. I like the idea, but as with everything, it's the implementation that matters most.

JoshuaKGoldberg commented 2 months ago

First thought: how about a Report issue on GitHub button under the existing sidebar UI?

Screenshot of the ESLint playground. A 75% sized 'Report issue on GitHub' outline button is under the existing 'Download this config file' primary button.

nzakas commented 2 months ago

Only concern with that is when people have multiple rules configured, it will scroll of the bottom of the page and be out of sight, which seems like it would be a problem. (We do already have this problem with "Download this config file", but at least that is related to what's above it.)

JoshuaKGoldberg commented 2 months ago

Hmm, I can see why that'd be irksome. I suppose we could put it below rule reports:

Screenshot of a 75%-sized outline button saying "Report issue on GitHub" below a rule report for this issue's sample cde

This would also have the drawback of being pushed down, too, just by the rule warnings...

nzakas commented 2 months ago

What about overlaying the button inside the upper-right corner of the editor? Maybe shorten to "Report issue" to minimize disruption?

JoshuaKGoldberg commented 2 months ago

😬 as a user, I really dislike things popping over a text editor. Even if it's just floating in a right-side corner.

harish-sethuraman commented 2 months ago

Shall we rather add the button inside the share URL config? we can re name it to something better? Its on top + it can be collpased as well? Doesn't mess with other interfaces?

nzakas commented 2 months ago

@harish-sethuraman That's not a bad idea, but maybe we should rename to just "Share" and have the two options under there? (I supposed reporting an issue is another form of sharing?)

harish-sethuraman commented 1 month ago

@JoshuaKGoldberg are you still working on this? Or I can help you with the change?

JoshuaKGoldberg commented 1 month ago

I was just waiting for a 👍 to implement. But I have a lot of ESLint work on my plate, go ahead - thanks for checking!

amareshsm commented 1 month ago

@harish-sethuraman That's not a bad idea, but maybe we should rename to just "Share" and have the two options under there? (I supposed reporting an issue is another form of sharing?)

I am 👍 for this change. Should we rename "Share" to "Share and Report" (similar to "Versioning and Config") and include a "Report an Issue" button within that section?

image

harish-sethuraman commented 1 month ago

As first part of the change, have raised an PR to add id's to template values. Should we also fill the What actually happened? section or should we not? because we are already getting the playground URL? that would suffice?

amareshsm commented 1 month ago

As first part of the change, have raised an PR to add id's to template values. Should we also fill the What actually happened? section or should we not? because we are already getting the playground URL? that would suffice?

In my opinion, we can pre-fill the "What actually happened?" field with the error details and allow the user to complete the "What did you expect to happen?" field.