From 09c5549497c242839585c8e50fec7b72469abcca Mon Sep 17 00:00:00 2001 From: Soon Date: Mon, 24 Jun 2024 13:29:52 +0800 Subject: [PATCH] chore(infra): add cspell (#17) --- cspell.config.cjs | 30 +++++++++ package.json | 4 +- packages/core/src/config.ts | 4 +- pnpm-lock.yaml | 8 +++ scripts/dictionary.txt | 119 ++++++++++++++++++++++++++++++++++++ 5 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 cspell.config.cjs create mode 100644 scripts/dictionary.txt diff --git a/cspell.config.cjs b/cspell.config.cjs new file mode 100644 index 000000000..f7e434766 --- /dev/null +++ b/cspell.config.cjs @@ -0,0 +1,30 @@ +const { banWords } = require('cspell-ban-words'); + +module.exports = { + version: '0.2', + language: 'en', + files: ['**/*.{ts,tsx,js,jsx,md,mdx}'], + enableFiletypes: ['mdx'], + ignoreRegExpList: [ + // ignore markdown anchors such as [modifyRsbuildConfig](#modifyrsbuildconfig) + '#.*?\\)', + ], + ignorePaths: [ + 'dist', + 'dist-*', + 'compiled', + 'coverage', + 'doc_build', + 'node_modules', + 'pnpm-lock.yaml', + ], + flagWords: banWords, + dictionaries: ['dictionary'], + dictionaryDefinitions: [ + { + name: 'dictionary', + path: './scripts/dictionary.txt', + addWords: true, + }, + ], +}; diff --git a/package.json b/package.json index 398401e00..cf243d103 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @examples/* --parallel=10", "build:examples": "cross-env NX_DAEMON=false nx run-many -t build --projects @examples/* --parallel=10", "check-dependency-version": "check-dependency-version-consistency .", - "lint": "biome check . --diagnostic-level=warn", + "check-spell": "npx cspell", + "lint": "biome check . --diagnostic-level=warn && pnpm run check-spell", "prebundle": "nx run-many -t prebundle", "prepare": "pnpm run build && simple-git-hooks", "sort-package-json": "npx sort-package-json \"packages/*/package.json\"", @@ -29,6 +30,7 @@ "@modern-js/module-tools": "^2.53.0", "check-dependency-version-consistency": "^4.1.0", "cross-env": "^7.0.3", + "cspell-ban-words": "^0.0.3", "nano-staged": "^0.8.0", "nx": "^19.3.0", "prettier": "^3.3.2", diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 7cfab1aa1..35ac2bdc3 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -100,7 +100,7 @@ export async function createInternalRsbuildConfig(): Promise { }); } -export function convertLibConfigtoRsbuildConfig( +export function convertLibConfigToRsbuildConfig( libConfig: LibConfig, rsbuildConfig: RsbuildConfig, ): RsbuildConfig { @@ -157,7 +157,7 @@ export async function composeCreateRsbuildConfig( internalRsbuildConfig, ); - return convertLibConfigtoRsbuildConfig(libConfig, mergedRsbuildConfig); + return convertLibConfigToRsbuildConfig(libConfig, mergedRsbuildConfig); }); return composedRsbuildConfig; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4970b2409..0de95c2d4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: cross-env: specifier: ^7.0.3 version: 7.0.3 + cspell-ban-words: + specifier: ^0.0.3 + version: 0.0.3 nano-staged: specifier: ^0.8.0 version: 0.8.0 @@ -1459,6 +1462,9 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} + cspell-ban-words@0.0.3: + resolution: {integrity: sha512-Q7ZO16DFWEP8Vv5CJ63LG95/FomTuxB6WvKhvGUDE3L2hiYl7n2fH+0qoSXL5C3zH6NRPQT4rDS66t1Pi/fILA==} + cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} @@ -4385,6 +4391,8 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + cspell-ban-words@0.0.3: {} + cssesc@3.0.0: {} csv-generate@3.4.3: {} diff --git a/scripts/dictionary.txt b/scripts/dictionary.txt new file mode 100644 index 000000000..6a9d9706b --- /dev/null +++ b/scripts/dictionary.txt @@ -0,0 +1,119 @@ +# Custom Dictionary Words +antd +apng +applescript +atrules +biomejs +brotli +browserslistrc +bundleless +caniuse +chunkhash +Chunktmp +classname +codegen +codesandbox +compat +consolas +contentful +corejs +corepack +craco +crossorigin +datauri +deepmerge +docgen +envinfo +estree +facti +filenaming +flac +flexbox +flexbugs +fnames +frontends +fullhash +gzipped +icss +idents +iife +imagex +jfif +jiti +jscpuprofile +jsesc +koppers +lightningcss +liyincode +longpaths +manypkg +mattcompiles +menlo +microfrontend +microfrontends +modularly +napi +nolyfill +ntqry +onclosetag +onopentag +ontext +osascript +outro +pageerror +pathinfo +pcss +perfetto +picocolors +pjpeg +pluggable +pmmmwh +postcssrc +preact +prebundle +preflights +prefresh +preprocessors +pxtorem +rebranded +rolldown +rsbuild +rsdoctor +rsfamily +rslib +rslog +rspack +rspress +selfsign +selfsigned +sirv +sokra +speedscope +srcset +stacktracey +styl +stylex +subdir +subpage +subresource +subresources +svgr +swcrc +systemjs +tailwindcss +taze +templating +transpiling +treeshaking +tsbuildinfo +tsdoc +unocss +unpatch +unplugin +unshift +upath +vitest +vnode +watchpack +webm +webp