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
Add links to terminal output #5835
Conversation
This change outputs links of files or rule URLs on terminal via the `terminal-link` package. The `string` and `verbose` formatters are only supported. Note that it is needed to install `terminal-link@2` because `terminal-link@3` is pure ESM: ```shell npm i terminal-link@2 ``` See also <https://github.com/sindresorhus/terminal-link>
ac30ea2
to
3a77aee
Compare
// Plugin rules are unsupported. | ||
if (rule.includes('/')) { | ||
return rule; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note] It is a bit disappointing not to support plugin rules.
We may need to add a rule’s metadata (rule doc URL etc.) in the future. 🤔
(but out of the scope of this PR)
See https://eslint.org/docs/developer-guide/working-with-rules#rule-basics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened a new issue #5842 to discuss rule metadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use meta.url
if #5845 would be merged.
@@ -0,0 +1,8 @@ | |||
declare module 'supports-hyperlinks' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note] supports-hyperlinks
doesn't have type definitions (even on @types/
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, is this something that would be helpful to contribute upstream? Looking at the package, it doesn't seem too complicated - maybe I can give it a shot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattxwang That would be great! 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good - I can try to take a crack at it next weekend; probably shouldn't prevent this PR from being merged!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have created jamestalmage/supports-hyperlinks#15!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this may have been resolved with jamestalmage/supports-hyperlinks#21?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattxwang Thanks for sharing the news! We can delete our custom type definitions with supports-hyperlinks@3.0.0
.
Thanks for the feedback! Ready to review. 🙆🏼♂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good stuff!
I've requested a very minor formatting change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
|
Closes #3823
This change outputs links of files or rule URLs on terminal via the
terminal-link
package.The
string
andverbose
formatters are only supported.Note that it is needed to install
terminal-link@2
becauseterminal-link@3
is pure ESM:See also https://github.com/sindresorhus/terminal-link
Demo
On my local machine's terminal (macOS; iTerm2):
Screen.Recording.2022-01-15.at.3.43.39.mov