Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ jobs:
- name: Install Dependencies
run: npm ci

- name: Run Linting
run: npm run lint

- name: Run Spell Check (Source)
run: npm run spellcheck

- name: Build Site
run: npm run build

- name: Run Spell Check (HTML)
run: npm run spellcheck:html

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ pnpm-debug.log*

# macOS-specific files
.DS_Store

# CSpell cache
.cspellcache
78 changes: 78 additions & 0 deletions SPELLCHECK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Spell Checking Setup

This project uses CSpell for spell checking both source files and generated HTML output.

## Features

✅ **Smart Technical Recognition**: CSpell understands camelCase, PascalCase, and snake_case naming conventions, making it ideal for technical content.

✅ **Custom Dictionary**: Project-specific terms are maintained in `cspell.json` for easy management.

✅ **Dual-Phase Checking**:
- Source files (markdown, TypeScript, Astro) are checked pre-build
- HTML output is checked post-build to catch rendering issues

✅ **CI/CD Integration**: Automated spell checking in GitHub Actions prevents typos from reaching production.

## Usage

### Check Source Files
```bash
npm run spellcheck
```

### Check Generated HTML
```bash
npm run build
npm run spellcheck:html
```

### Check Everything
```bash
npm run spellcheck:all
```

### Add New Terms

Edit the `words` array in `cspell.json`:

```json
{
"words": [
"yourNewTerm",
// ... other terms
]
}
```

## Configuration

The spell checker is configured in `cspell.json` with:

- **Multiple Dictionaries**: TypeScript, npm packages, HTML, CSS, and software terms
- **Smart Ignoring**: Excludes code blocks, import statements, and HTML attributes
- **File-Specific Rules**: Different rules for markdown vs code files
- **Path Exclusions**: Ignores node_modules, dist, and other generated files

## Example Output

When a typo is found:
```
src/content/projects/personal-website/index.md:24:53 - Unknown word (sytem) fix: (system)
```

## Alternatives Considered

We evaluated several spell-checking solutions:

- **Hunspell/Aspell**: Traditional spell checkers, but poor at handling technical terms and camelCase
- **LanguageTool**: Excellent for grammar but overkill for basic spell checking
- **textlint**: Good but requires more configuration for technical content
- **Vale**: Great for style guides but complex setup for simple spell checking

CSpell was chosen because it:
- Has built-in understanding of code conventions
- Includes extensive technical dictionaries
- Integrates easily with npm scripts and CI/CD
- Provides fast performance
- Offers smart suggestions for technical terms
102 changes: 102 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"version": "0.2",
"language": "en",
"words": [
"agentic",
"allwork",
"Anthropics",
"Astro",
"astrojs",
"autoclosure",
"Bandung",
"BGRA",
"briefs",
"Claude",
"Codegen",
"cplusplus",
"devcontainer",
"expressibility",
"frontmatter",
"justfile",
"linter",
"MDX",
"meso",
"Meso",
"metrids",
"mutatis",
"plx",
"Playwright",
"prb",
"ripgrep",
"sitemap",
"speedbump",
"subclassing",
"Tailwindcss",
"todolist",
"Typesafe",
"uncategorized",
"Uncategorized",
"webfetch",
"WWDC"
],
"ignorePaths": [
"node_modules",
"dist",
".git",
"*.min.js",
"*.min.css",
"package-lock.json",
"pnpm-lock.yaml",
".astro",
"public/fonts/**"
],
"dictionaries": [
"en-us",
"typescript",
"node",
"npm",
"html",
"css",
"software-terms",
"companies",
"misc"
],
"import": [
"@cspell/dict-typescript/cspell-ext.json",
"@cspell/dict-npm/cspell-ext.json",
"@cspell/dict-html/cspell-ext.json",
"@cspell/dict-css/cspell-ext.json"
],
"enableFiletypes": [
"astro",
"mdx"
],
"overrides": [
{
"filename": "**/*.{ts,tsx,js,jsx,astro}",
"dictionaries": ["typescript", "node", "npm"],
"ignoreRegExpList": [
"/import .* from ['\"].*/g",
"/\\b[A-Z][a-z]+(?:[A-Z][a-z]+)+\\b/g"
]
},
{
"filename": "**/*.{md,mdx}",
"dictionaries": ["en-us", "software-terms"],
"ignoreRegExpList": [
"/```[\\s\\S]*?```/gm",
"/`[^`]+`/g"
]
},
{
"filename": "dist/**/*.html",
"dictionaries": ["en-us", "html"],
"ignoreRegExpList": [
"/<script[\\s\\S]*?<\\/script>/gm",
"/<style[\\s\\S]*?<\\/style>/gm",
"/class=\"[^\"]*\"/g",
"/id=\"[^\"]*\"/g"
]
}
]
}
26 changes: 25 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,28 @@ clean:

# Install: installs dependencies
install:
npm install
npm install

# Spellcheck: checks spelling in source files
spellcheck:
npm run spellcheck

# Spellcheck-html: checks spelling in built HTML output
spellcheck-html:
npm run spellcheck:html

# Spellcheck-all: full spellcheck workflow (source + build + html)
spellcheck-all:
npm run spellcheck:all

# Lint: runs ESLint on all files
lint:
npm run lint

# Lint-fix: auto-fixes ESLint issues where possible
lint-fix:
npm run lint:fix

# Validate: runs all validation checks (lint + spellcheck + build + links)
validate:
npm run validate:all
Loading