Skip to content

Commit

Permalink
fix: custom dictionary support for roblox keywords (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Jun 21, 2024
1 parent 7a4eb9c commit 490e83a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/configs/spelling.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { createRequire } from "node:module";
import { pathToFileURL } from "node:url";
import { GLOB_SRC } from "src";
import { pluginCspell } from "src/plugins";

Expand All @@ -8,6 +10,8 @@ import type {
TypedFlatConfigItem,
} from "../types";

const require = createRequire(import.meta.url);

export async function spelling(
options: OptionsComponentExtensions & OptionsFiles & SpellCheckConfig = {},
): Promise<Array<TypedFlatConfigItem>> {
Expand All @@ -18,6 +22,10 @@ export async function spelling(
...componentExtensions.map(extension => `**/*.${extension}`),
];

const robloxPackage = require.resolve("@isentinel/dict-roblox");
const urlRobloxPackage = pathToFileURL(robloxPackage);
const urlRoblox = new URL("dict/roblox.txt", urlRobloxPackage);

return [
{
files,
Expand All @@ -32,10 +40,17 @@ export async function spelling(
autoFix: false,
checkComments: true,
cspell: {
import: ["@isentinel/dict-roblox"],
dictionaries: ["roblox"],
dictionaryDefinitions: [
{
name: "roblox",
path: urlRoblox.href,
},
],
language,
words: ["isentinel"],
},
// debugMode: true,
generateSuggestions: true,
numSuggestions: 8,
},
Expand Down

0 comments on commit 490e83a

Please sign in to comment.