jq -> node

This commit is contained in:
Sidharth Vinod
2022-11-04 02:05:50 +05:30
parent 3ad17b79a6
commit e7369acaea
5 changed files with 23 additions and 33 deletions

17
bin/checkCSpell.ts Normal file
View File

@@ -0,0 +1,17 @@
import { readFileSync, writeFileSync } from 'node:fs';
import prettier from 'prettier';
const filepath = './cSpell.json';
const cSpell: { words: string[] } = JSON.parse(readFileSync(filepath, 'utf8'));
cSpell.words = [...new Set(cSpell.words.map((word) => word.toLowerCase()))];
cSpell.words.sort((a, b) => a.localeCompare(b));
const prettierConfig = prettier.resolveConfig.sync(filepath) ?? {};
writeFileSync(
filepath,
prettier.format(JSON.stringify(cSpell), {
...prettierConfig,
filepath,
})
);