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

Print a link to package.json while displaying errors. #39

Closed
kwangure opened this issue May 2, 2023 · 4 comments
Closed

Print a link to package.json while displaying errors. #39

kwangure opened this issue May 2, 2023 · 4 comments

Comments

@kwangure
Copy link

kwangure commented May 2, 2023

publint prints errors in package.json in the format pkg.exports["./path/to/exports"].property has error X. A minor quality of life improvement would be printing the package.json path with line numbers such that you can Ctrl+Click to the error in VS Code and friends.

@bluwy
Copy link
Owner

bluwy commented May 3, 2023

Good idea. Displaying the line numbers is tricky though since we're parsing the JSON and it doesn't provide the line numbers. We could technically assume that it's properly indented so we can guess the line number, but that feels a bit complex.

In that case, I'm slightly leaning to keeping it simple so the output is cleaner too.

@kwangure
Copy link
Author

kwangure commented May 3, 2023

For unique substrings, try https://github.com/Rich-Harris/locate-character. Otherwise just link to the package.json without an exact location.

@bluwy
Copy link
Owner

bluwy commented May 4, 2023

Yeah I was thinking of just linking the package.json, but in most case you can easily find it yourself as it's in your own project. Trying to prevent printing it for each message/errors too as the path can get noisy.

@bluwy
Copy link
Owner

bluwy commented May 20, 2023

I think it's better to keep it simple for now. We can revisit again if there's more request for this.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants