Skip to content

Commit e8495d9

Browse files
authored
feat: minimal cspell configuration (solana-foundation#3960)
* feat: add initial cspell support For running the spellchecker locally: make spellcheck Once you have fixed any typos and if you want to add some new words to the dictionary: make update-dictionary * chore: appease the cspell gods 🪄 Wrapping some of the code blocks with these magic comments ensures cspell isn't checking the spelling of things like on chain program addresses or other things that shouldn't be spellchecked. * docs: fix a few minor tyops cspell caught * chore: add github action for cspell bits * chore: spellcheck repo root markdown files
1 parent 7a40537 commit e8495d9

File tree

8 files changed

+161
-2
lines changed

8 files changed

+161
-2
lines changed

.cspell-anchor-dictionary.txt

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
aarch
2+
ahash
3+
ambigious
4+
anchorversion
5+
anza
6+
Anza
7+
arrayref
8+
autoload
9+
backpackapp
10+
behaviour
11+
blockhash
12+
Blockhash
13+
borsh
14+
Borsh
15+
bytemuck
16+
bytemuckunsafe
17+
cfgs
18+
clippy
19+
compinit
20+
composibility
21+
dedup
22+
deriveaccounts
23+
devex
24+
devnet
25+
Devnet
26+
duplicative
27+
footguns
28+
fumadocs
29+
Fumadocs
30+
getrandom
31+
Helius
32+
idls
33+
isinstance
34+
keypair
35+
Keypair
36+
keypairs
37+
Keypairs
38+
Kibibyte
39+
Lamport
40+
lamports
41+
Lamports
42+
LAMPORTS
43+
libclang
44+
libudev
45+
litesvm
46+
localnet
47+
Localnet
48+
localnetwork
49+
metas
50+
Metas
51+
millis
52+
MSRV
53+
msvc
54+
namespacing
55+
nonblocking
56+
openbook
57+
pathlib
58+
pdas
59+
pdksh
60+
permissioned
61+
programatically
62+
programdata
63+
projectserum
64+
pubkeys
65+
publickey
66+
reallocs
67+
repr
68+
reqwest
69+
rustc
70+
rustls
71+
rustup
72+
RUSTUP
73+
Sealevel
74+
serde
75+
shmem
76+
sighash
77+
sigverify
78+
solana
79+
Solana
80+
Solana's
81+
solanafoundation
82+
Solang
83+
solpg
84+
Solpg
85+
stdsimd
86+
syscall
87+
syscalls
88+
sysvar
89+
Sysvar
90+
sysvars
91+
underyling
92+
unsized
93+
Unsized
94+
unverify
95+
Zeroable
96+
Znext

.github/workflows/global-lint.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Linters that run on everything and don't exclude docs/**
2+
name: Global Linters
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
# Manually run cspell locally via:
8+
# make spellcheck
9+
jobs:
10+
spellcheck:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
# Pinned version of the v7.2.0 tag, which is a lightweight and hence mutable tag
15+
- uses: streetsidesoftware/cspell-action@dcd03dc3e8a59ec2e360d0c62db517baa0b4bb6d
16+
with:
17+
# For now, only lint markdown files
18+
files: |
19+
**/*.md
20+
**/*.mdx
21+
inline: warning
22+
23+
# Only check files in the PR or push
24+
incremental_files_only: true
25+
26+
# Do not error out on failures, only complain
27+
strict: false

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
DICTIONARY_FILE ?= .cspell-anchor-dictionary.txt
2+
13
.PHONY: build-cli
24
build-cli:
35
cargo build -p anchor-cli --release
@@ -39,3 +41,15 @@ publish:
3941
sleep 25
4042
cd cli/ && cargo publish && cd ../
4143
sleep 25
44+
45+
.PHONY: spellcheck
46+
spellcheck:
47+
cspell *.md **/*.md **/*.mdx --config cspell.config.yaml --no-progress
48+
49+
.PHONY: update-dictionary
50+
update-dictionary:
51+
echo $(DICTIONARY_FILE)
52+
cspell *.md **/*.md **/*.mdx --config cspell.config.yaml --words-only --unique --no-progress --quiet 2>/dev/null | sort --ignore-case > .new-dictionary-words
53+
cat .new-dictionary-words $(DICTIONARY_FILE) | sort --ignore-case > .new-$(DICTIONARY_FILE)
54+
mv .new-$(DICTIONARY_FILE) $(DICTIONARY_FILE)
55+
rm -f .new-dictionary-words

cspell.config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
3+
version: '0.2'
4+
dictionaryDefinitions:
5+
- name: anchor-dictionary
6+
path: './.cspell-anchor-dictionary.txt'
7+
addWords: true
8+
dictionaries:
9+
- anchor-dictionary
10+
ignorePaths: []

docs/content/docs/features/events.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ describe("event", () => {
118118
</Tab>
119119
</Tabs>
120120

121+
<!-- cspell:disable -->
122+
121123
The following is the output of the program logs. The event data is base64
122124
encoded as `Zb1eU3aiYdwOAAAASGVsbG8sIFNvbGFuYSE=`.
123125

@@ -130,6 +132,8 @@ Log Messages:
130132
Program 8T7MsCZyzxboviPJg5Rc7d8iqEcDReYR2pkQKrmbg7dy success
131133
```
132134

135+
<!-- cspell:enable -->
136+
133137
<Callout type="info">
134138
Ensure the RPC provider you use does not truncate the program logs from the
135139
transaction data.
@@ -273,6 +277,8 @@ In the example transaction below, the encoded event data is
273277
`"data": "6AJcBqZP8afBKheoif1oA6UAiLAcqYr2RaR33pFnEY1taQp"` in the
274278
`innerInstructions` array.
275279

280+
<!-- cspell:disable -->
281+
276282
```shell title="Transaction Data"
277283
{
278284
"blockTime": 1735854530,
@@ -359,6 +365,8 @@ In the example transaction below, the encoded event data is
359365
}
360366
```
361367

368+
<!-- cspell:enable -->
369+
362370
<Callout type="info">
363371
Currently, event data emitted through CPIs cannot be directly subscribed to.
364372
To access this data, you must fetch the complete transaction data and manually

docs/content/docs/installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ Generating a new keypair
614614
615615
For added security, enter a BIP39 passphrase
616616
617-
NOTE! This passphrase improves security of the recovery seed phrae NOT the
617+
NOTE! This passphrase improves security of the recovery seed phrase NOT the
618618
keypair file itself, which is stored as insecure plain text
619619
620620
BIP39 Passphrase (empty for none):

docs/content/docs/quickstart/local.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ new program.
344344

345345
Below is an overview of default file structure in an Anchor workspace:
346346

347+
<!-- cspell:disable -->
348+
347349
<Files>
348350
<Folder name=".anchor">
349351
<File name="program-logs" />
@@ -378,6 +380,8 @@ Below is an overview of default file structure in an Anchor workspace:
378380
<File name="package.json" />
379381
</Files>
380382

383+
<!-- cspell:enable -->
384+
381385
### Programs Folder
382386

383387
The `/programs` directory contains your project's Anchor programs. A single

docs/content/docs/updates/release-notes/0-31-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ The following issues with the IDL generation have been fixed:
457457
- A bug where using tuple parameters in instructions would result in an
458458
incorrect IDL ([#3294](https://github.com/coral-xyz/anchor/pull/3294))
459459
- A bug where doc comments could trigger false-positives during module paths
460-
convertion ([#3359](https://github.com/coral-xyz/anchor/pull/3359))
460+
conversion ([#3359](https://github.com/coral-xyz/anchor/pull/3359))
461461
- A bug where the generated IDL only has partial resolution information
462462
([#3474](https://github.com/coral-xyz/anchor/pull/3474))
463463
- Being unable to use constant identifiers as generic arguments

0 commit comments

Comments
 (0)