Skip to content
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

Design documentation for CodeEditor linting #2752

Conversation

LilithJames-HDS
Copy link
Contributor

📌 Summary

If merged, this PR will add a section at the end of the Guidelines page for CodeEditor that describes the linting feature available to users only in the JSON language variant of the CodeEditor.

🛠️ Detailed description

Brief description added. Questions for the team:

  1. Should there be images to allow designers to preview what the linting feature looks like?
  2. Is this the appropriate location for this information given its niche application in the component?

🔗 External links

Jira ticket: HDS4629
Figma file: Preview of linting

@LilithJames-HDS LilithJames-HDS requested review from a team as code owners March 6, 2025 19:32
Copy link

vercel bot commented Mar 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
hds-showcase ✅ Ready (Inspect) Visit Preview Mar 7, 2025 8:00pm
hds-website ✅ Ready (Inspect) Visit Preview Mar 7, 2025 8:00pm

@hashibot-hds hashibot-hds added packages/components docs-website Content updates to the documentation website showcase labels Mar 6, 2025
@LilithJames-HDS LilithJames-HDS requested a review from zamoore March 6, 2025 19:32
Copy link
Contributor

@majedelass majedelass left a comment

Choose a reason for hiding this comment

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

I left two bits of feedback, one non-blocking and not really necessary, while the other I think could benefit consumers (specifically designers) with how linting looks like.

Copy link
Contributor

@andgen404 andgen404 left a comment

Choose a reason for hiding this comment

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

I left some comments, but looking good!

@@ -104,3 +105,6 @@ In **Figma** we provide a handful of example languages intended as visual exampl

If you wish to create custom examples using the Code Editor, we publish all of the relevant syntax highlighting variables in the [HDS Components v2.0](https://www.figma.com/design/iweq3r2Pi8xiJfD9e6lOhF/HDS-Components-v2.0?node-id=67166-37020&t=gWdKy44MzTP4cTRo-1) library. However, due to the number of languages supported by the component, the color variables use a generic naming schema (e.g., cyan, red, purple) to remain as agnostic as possible when being applied to different languages.
For more details around syntax, visit the [specifications](/components/code-editor?tab=specifications).

## Linting (JSON language only)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Linting (JSON language only)
### Linting (JSON language only)

I think it makes sense to have the content in this section. Maybe bump it down to an h3?

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 don't think this should live under Language, it's its own feature like line-highlight and it happens to only be applicable to JSON. Open to moving it around if everyone disagrees with me though

Copy link
Contributor

Choose a reason for hiding this comment

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

This follows the setup in the showcase. It is it's own feature, but it technically won't work without language. I'm indifferent I think.

Copy link
Contributor

@jorytindall jorytindall left a comment

Choose a reason for hiding this comment

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

Couple of comments around the structure here, but I do think that an image would go a long way for this feature. I also might suggest including something about this not being supported in Figma.

Copy link
Contributor

@heatherlarsen heatherlarsen left a comment

Choose a reason for hiding this comment

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

Nice work! I left a couple of minor suggestions.

The Code Editor supports "linting" (currently only of JSON code) a user's code. This feature will highlight an error with an underline and display an icon next to the line number, each of which will show a tooltip on hover. To view all alerts in the editor, users can open a dialog using Ctrl-Shift-m (Cmd-Shift-m on macOS).

!!! Info
Linting within the Code Editor is only supported for JSON. If you require linting for addition languages [contact](/about/support) the HDS team.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have strong feelings about this, but I don't feel like these details need to go in the info banner. The first sentence is also above; the second could live as a standalone below the previous paragraph.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the notes! I updated all the suggestions and for this info banner I kept the callout that this is not supported in Figma (which we have in info banners on other components) to make it clear at a glance that this is in code only. I moved the contact support info to the end of the section as well. Let me know what you think!

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like maybe something got reverted because I still see the first two sentences.

Copy link
Contributor

Choose a reason for hiding this comment

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

This example is a little jarring in the flow of the content because the main element is on the right, while in the others, it's on the left. The left is most common in our documentation and is preferred. Could you orient this so the code editor itself is on the left?

Copy link
Contributor

@shleewhite shleewhite left a comment

Choose a reason for hiding this comment

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

Looks good to me, once the spelling error in the target branch gets fixed you can just re-run the failing test and it should be good to go.

@zamoore zamoore force-pushed the zamoore/HDS-4361/CodeEditor-linting-website branch from c1811e4 to 0f49b5b Compare March 7, 2025 19:54
Copy link
Contributor

@heatherlarsen heatherlarsen left a comment

Choose a reason for hiding this comment

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

Two minor updates, then I think this is good to go.

The Code Editor supports "linting" (currently only of JSON code) a user's code. This feature will highlight an error with an underline and display an icon next to the line number, each of which will show a tooltip on hover. To view all alerts in the editor, users can open a dialog using Ctrl-Shift-m (Cmd-Shift-m on macOS).

!!! Info
Linting within the Code Editor is only supported for JSON. If you require linting for addition languages [contact](/about/support) the HDS team.
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like maybe something got reverted because I still see the first two sentences.

@@ -104,3 +104,24 @@ In **Figma** we provide a handful of example languages intended as visual exampl

If you wish to create custom examples using the Code Editor, we publish all of the relevant syntax highlighting variables in the [HDS Components v2.0](https://www.figma.com/design/iweq3r2Pi8xiJfD9e6lOhF/HDS-Components-v2.0?node-id=67166-37020&t=gWdKy44MzTP4cTRo-1) library. However, due to the number of languages supported by the component, the color variables use a generic naming schema (e.g., cyan, red, purple) to remain as agnostic as possible when being applied to different languages.
For more details around syntax, visit the [specifications](/components/code-editor?tab=specifications).

## Linting
The Code Editor supports linting for JSON using [CodeMirror6](https://codemirror.net/examples/lint/). This feature highlights all errors with an underline and an icon next to the line number. Each icon has a tooltip explaining the error on the associated line. To view all alerts in the editor, users can open a dialog using Ctrl-Shift-m (Cmd-Shift-m on macOS).
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing the duplicative sentence.

Suggested change
The Code Editor supports linting for JSON using [CodeMirror6](https://codemirror.net/examples/lint/). This feature highlights all errors with an underline and an icon next to the line number. Each icon has a tooltip explaining the error on the associated line. To view all alerts in the editor, users can open a dialog using Ctrl-Shift-m (Cmd-Shift-m on macOS).
The Code Editor supports linting for JSON using [CodeMirror6](https://codemirror.net/examples/lint/). This feature highlights all errors with an underline and an icon next to the line number. Each icon has a tooltip explaining the error on the associated line.

@zamoore zamoore merged commit 6aa5247 into zamoore/HDS-4361/CodeEditor-linting-website Mar 7, 2025
14 of 16 checks passed
@zamoore zamoore deleted the Lilith-Design-Documentation-CodeEditor-Linting branch March 7, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-website Content updates to the documentation website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants