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

💡: problems invoking cspell from api #6262

Open
1 task done
Zamiell opened this issue Sep 19, 2024 · 0 comments
Open
1 task done

💡: problems invoking cspell from api #6262

Zamiell opened this issue Sep 19, 2024 · 0 comments

Comments

@Zamiell
Copy link
Contributor

Zamiell commented Sep 19, 2024

Problem

I am the author of cspell-check-unused-words.
In the script, it runs the following command:

cspell --no-progress --no-summary --unique --words-only --config cspell.temp.config.jsonc

However, this ends up being buggy because I have to physically create a "cspell.temp.config.jsonc" file on disk, which causes the Git tree to become dirty and screws up other lint tasks that are running parallel. I also can't move the temporary config to a temporary directory, since this will mess up all the no-longer-relative paths in the "ignorePaths" part of the config.

Thus, I would just like to use the CSpell API to invoke this command through JavaScript/TypeScript.

  • First, I tried using cspell-lib, but that looks to be too low level, as I can't feed it a CSpell configuration file.
  • Second, I tried using the lint export from cspell, but that does not work either, as LinterCliOptions does not seem to include "words-only" and "unique" (although it does include "progress" and "summary", which is helpful). Furthermore, it only seems to take "config" as a path instead of "config" as an JavaScript object.

Solution

Proposal:

Add the following fields to LinterCliOptions:

  • configObject
  • wordsOnly
  • unique

Alternate Solutions

Ultimately, I would love for unused word checking to become a feature of CSpell itself. Then I wouldn't need to invoke the CSpell API at all and I could archive this repository.

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant