Skip to content

Commit

Permalink
Switch to cspell binary as the library is not cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaoumov committed Sep 10, 2024
1 parent ab47a98 commit ffec378
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions src/scripts/spellcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
* It reports any spelling issues found in the code and returns a `TaskResult` indicating whether the spellcheck was successful.
*/

import { lint } from 'cspell';

import { CliTaskResult } from './CliUtils.ts';
import { fileURLToPath } from './NodeModules.ts';
import { toRelativeFromRoot } from './Root.ts';
import { execFromRoot } from './Root.ts';

/**
* Runs a spellcheck on the entire codebase using `cspell`.
Expand All @@ -18,21 +14,6 @@ import { toRelativeFromRoot } from './Root.ts';
*
* @returns A `Promise` that resolves to a `TaskResult`, indicating the success or failure of the spellcheck.
*/
export async function spellcheck(): Promise<CliTaskResult> {
let isSuccess = true;

await lint(['.'], {}, {
issue: (issue) => {
if (!issue.uri) {
return;
}

const path = fileURLToPath(issue.uri);
const relativePath = toRelativeFromRoot(path);
console.log(`${relativePath}:${issue.row.toString()}:${issue.col.toString()} - ${issue.text}`);
isSuccess = false;
}
});

return CliTaskResult.Success(isSuccess);
export async function spellcheck(): Promise<void> {
await execFromRoot('npx cspell . --no-progress');
}

0 comments on commit ffec378

Please sign in to comment.