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

Report package.json line number in output #872

Open
jdeniau opened this issue Jan 5, 2024 · 2 comments · May be fixed by #874
Open

Report package.json line number in output #872

jdeniau opened this issue Jan 5, 2024 · 2 comments · May be fixed by #874
Labels

Comments

@jdeniau
Copy link
Contributor

jdeniau commented Jan 5, 2024

Feature request description

Actually, the reported output is something like

Unused devDependencies
* prettier

In the JSON output, we have

{
  "devDependencies": [
    "prettier"
  ]
}

It would be nice to have more detail on how to find "where" is defined this configuration:

For example, the vscode console allow us to click on lines "that looks like a filename with a line number" (ie. package.json:15)

Furthermore, some tools like reviewdog does parse the output to report checks on github, but actually it's really complicated to target a file.
Making reviewdog work with depcheck would be really usefull as they are complementary when working with a CI.

A possible nice output would be

Unused devDependencies
* prettier (package.json:15)

I think that it's not as easy as said regarding the JSON output, if that's the data structure that you use internally, as we have an array of string here.

The options I see here:

  • Do not touch the JSON output, just "improve" the standard output
  • Add the package line in the array of string ("devDependencies": ["prettier (package.json:15)"]), not pretty, but non-breaking
  • change the data format : "devDependencies": [ { package: "prettier", "dependencyFile": "package.json", "dependencyLine": 15 } ]

I do not know if the json output is for debbuging purpose or if it is part of public API.

Any extra info

I can give a hand on this if you are OK with this feature.

@jdeniau jdeniau added the feature label Jan 5, 2024
@jdeniau jdeniau changed the title Report package.json line in output Report package.json line number in output Jan 5, 2024
@rumpl
Copy link
Member

rumpl commented Jan 5, 2024

This would indeed be a great feature!

@jdeniau
Copy link
Contributor Author

jdeniau commented Jan 5, 2024

Thanks @rumpl .
What would be your prefered implementation ?

@jdeniau jdeniau linked a pull request Jan 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants