@kitschpatrol/cspell-config 4.7.12 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/readme.md CHANGED
@@ -21,9 +21,17 @@
21
21
 
22
22
  ## Overview
23
23
 
24
- It's a shared [CSpell](https://cspell.org) config.
24
+ It's a shared [CSpell](https://cspell.org) config, plus a command-line tool `kpi-cspell` to perform CSpell-related project initialization and linting. Note that automated fixes are handled via an ESLint integration provided in [@kitschpatrol/eslint-config](https://github.com/kitschpatrol/shared-config/tree/main/packages/eslint-config).
25
25
 
26
- **See [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) for the recommended single-package approach.**
26
+ <!-- recommendation -->
27
+
28
+ > [!Important]
29
+ >
30
+ > **You can use this package on its own, but it's recommended to use [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) instead for a single-dependency and single-package approach to linting and fixing your project.**
31
+ >
32
+ > This package is included as a dependency in [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config), which also automatically invokes the command line functionality in this package via its `kpi` command
33
+
34
+ <!-- /recommendation -->
27
35
 
28
36
  ## Setup
29
37
 
@@ -32,7 +40,7 @@ To use just this CSpell config in isolation:
32
40
  1. Install the `.npmrc` in your project root. This is required for correct PNPM behavior:
33
41
 
34
42
  ```sh
35
- pnpm dlx @kitschpatrol/repo-config --init
43
+ pnpm dlx @kitschpatrol/repo-config init
36
44
  ```
37
45
 
38
46
  2. Add the package:
@@ -44,7 +52,7 @@ To use just this CSpell config in isolation:
44
52
  3. Add the starter `.cspell.json` file to your project root, and add any customizations you'd like:
45
53
 
46
54
  ```sh
47
- pnpm exec cspell-config --init
55
+ pnpm exec kpi-cspell init
48
56
  ```
49
57
 
50
58
  ## Usage
@@ -56,38 +64,34 @@ You can call it directly, or use the script bundled with the config.
56
64
  Integrate with your `package.json` scripts as you see fit, for example:
57
65
 
58
66
  ```json
59
- "scripts": {
60
- "spellcheck": "cspell-config --check"
67
+ {
68
+ "scripts": {
69
+ "spellcheck": "kpi-cspell lint"
70
+ }
61
71
  }
62
72
  ```
63
73
 
64
- ### CLI
74
+ ### Configuration
65
75
 
66
- <!-- cli-help -->
76
+ To create a `cspell.config.js` in your project root:
67
77
 
68
- #### Command: `cspell-config`
78
+ ```sh
79
+ pnpm exec kpi-knip init
80
+ ```
69
81
 
70
- CSpell configuration for @kitschpatrol/shared-config.
82
+ (Note that this will delete the `cspell` property in your `package.json`!)
71
83
 
72
- Usage:
84
+ _Or_
73
85
 
74
- ```txt
75
- cspell-config [<file|glob> ...]
76
- ```
77
-
78
- | Option | Argument | Description |
79
- | ------------------------ | -------- | ---------------------------------------------------------------- |
80
- | `--check`<br>`-c` | | Check for and report issues. Same as `cspell-config`. |
81
- | `--init`<br>`-i` | | Initialize by copying starter config files to your project root. |
82
- | `--print-config`<br>`-p` | `<path>` | Print the effective configuration at a certain path. |
83
- | `--help`<br>`-h` | | Print this help info. |
84
- | `--version`<br>`-v` | | Print the package version. |
86
+ To create a `cspell` property in `package.json`:
85
87
 
86
- <!-- /cli-help -->
88
+ ```sh
89
+ pnpm exec kpi-cspell init --location package
90
+ ```
87
91
 
88
- ## Configuration
92
+ (Note that this will delete the `cspell.config.js` file in your project root!)
89
93
 
90
- ### Disabling bundled dictionaries
94
+ #### Disabling bundled dictionaries
91
95
 
92
96
  In additional to CSpell's default dictionary configuration, this shared configuration enables a number of dictionaries that ship with CSpell for all file types:
93
97
 
@@ -102,6 +106,7 @@ It also includes a number of _custom_ dictionaries distributed with this package
102
106
 
103
107
  - `kp-acronyms` Contains acronyms
104
108
  - `kp-brands` Contains proper nouns like brand names
109
+ - `kp-eslint` Names seen in eslint rules provided by `@kitschpatrol/eslint-config`
105
110
  - `kp-files` File extensions and types
106
111
  - `kp-misc` Contains general and miscellaneous words
107
112
  - `kp-names` Human names and usernames
@@ -111,40 +116,125 @@ In your project's root `.cspell.json`, you can disable any combination of these
111
116
 
112
117
  For example, do disable the `kp-acronyms` and `kp-brands` dictionaries:
113
118
 
114
- ```json
119
+ ```jsonc
115
120
  {
116
121
  "import": "@kitschpatrol/cspell-config",
117
122
  "dictionaries": [
118
123
  "!kp-acronyms",
119
- "!kp-brands"
124
+ "!kp-brands",
120
125
  // ...Addtional !-prefixed dicitonary names
121
- ]
126
+ ],
122
127
  }
123
128
  ```
124
129
 
125
- ### Adding project-scoped words
130
+ If you need a massive and permissive dictionary for large writing project, take a look at [@kitschpatrol/dict-en-wiktionary](https://github.com/kitschpatrol/dict-en-wiktionary).
131
+
132
+ #### Adding project-scoped words
126
133
 
127
134
  In your project's root `.cspell.json`:
128
135
 
129
- ```json
136
+ ```jsonc
130
137
  {
131
138
  "import": "@kitschpatrol/cspell-config",
132
139
  "words": [
133
140
  "mountweazel",
134
141
  "steinlaus",
135
142
  "jungftak",
136
- "esquivalience"
143
+ "esquivalience",
137
144
  // ...Additional words
138
- ]
145
+ ],
139
146
  }
140
147
  ```
141
148
 
149
+ ### CLI
150
+
151
+ <!-- cli-help -->
152
+
153
+ #### Command: `kpi-cspell`
154
+
155
+ Kitschpatrol's CSpell shared configuration tools. (Automated fixes are handled by ESLint.)
156
+
157
+ This section lists top-level commands for `kpi-cspell`.
158
+
159
+ Usage:
160
+
161
+ ```txt
162
+ kpi-cspell <command>
163
+ ```
164
+
165
+ | Command | Argument | Description |
166
+ | -------------- | ----------- | ------------------------------------------------------------------------------------------------------------ |
167
+ | `init` | | Initialize by copying starter config files to your project root or to your package.json file. |
168
+ | `lint` | `[files..]` | Check for spelling mistakes. Matches files below the current working directory by default. |
169
+ | `print-config` | | Print the resolved CSpell configuration. Package-scoped. Searches up to the root of a monorepo if necessary. |
170
+
171
+ | Option | Description | Type |
172
+ | ------------------- | ------------------- | --------- |
173
+ | `--help`<br>`-h` | Show help | `boolean` |
174
+ | `--version`<br>`-v` | Show version number | `boolean` |
175
+
176
+ _See the sections below for more information on each subcommand._
177
+
178
+ #### Subcommand: `kpi-cspell init`
179
+
180
+ Initialize by copying starter config files to your project root or to your package.json file.
181
+
182
+ Usage:
183
+
184
+ ```txt
185
+ kpi-cspell init
186
+ ```
187
+
188
+ | Option | Description | Type | Default |
189
+ | ------------------- | ------------------- | -------------------- | -------- |
190
+ | `--location` | TK | `"file"` `"package"` | `"file"` |
191
+ | `--help`<br>`-h` | Show help | `boolean` | |
192
+ | `--version`<br>`-v` | Show version number | `boolean` | |
193
+
194
+ #### Subcommand: `kpi-cspell lint`
195
+
196
+ Check for spelling mistakes. Matches files below the current working directory by default.
197
+
198
+ Usage:
199
+
200
+ ```txt
201
+ kpi-cspell lint [files..]
202
+ ```
203
+
204
+ | Positional Argument | Description | Type | Default |
205
+ | ------------------- | ------------------------------ | ------- | -------- |
206
+ | `files` | Files or glob pattern to lint. | `array` | `"**/*"` |
207
+
208
+ | Option | Description | Type |
209
+ | ------------------- | ------------------- | --------- |
210
+ | `--help`<br>`-h` | Show help | `boolean` |
211
+ | `--version`<br>`-v` | Show version number | `boolean` |
212
+
213
+ #### Subcommand: `kpi-cspell print-config`
214
+
215
+ Print the resolved CSpell configuration. Package-scoped. Searches up to the root of a monorepo if necessary.
216
+
217
+ Usage:
218
+
219
+ ```txt
220
+ kpi-cspell print-config
221
+ ```
222
+
223
+ | Option | Description | Type |
224
+ | ------------------- | ------------------- | --------- |
225
+ | `--help`<br>`-h` | Show help | `boolean` |
226
+ | `--version`<br>`-v` | Show version number | `boolean` |
227
+
228
+ <!-- /cli-help -->
229
+
142
230
  ## Notes
143
231
 
144
232
  This config includes a bunch of words I've happened to have needed to use. Your preferences will vary.
145
233
 
146
234
  CSpell is configured to automatically ignore files and paths in `.gitignore` (via `"useGitignore": true`), and to ignore words inside of ` ``` ` code fences in markdown and mdx files.
147
235
 
236
+ As part of the `lint` command process, `@kitschpatrol/cspell-config` also runs a check to identify any words in your config file's `"words"` array that are _do not_ actually appear anywhere else in your project. This was inspired by [Zamiell's](https://github.com/Zamiell) [cspell-check-unused-words](https://github.com/complete-ts/cspell-check-unused-words) project.
237
+
148
238
  <!-- license -->
149
239
 
150
240
  ## License
@@ -1,101 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3
- "enabled": true,
4
- "enableGlobDot": false,
5
- "enableFiletypes": ["astro", "md", "mdx", "patch", "svelte"],
6
- "dictionaryDefinitions": [
7
- {
8
- "name": "kp-acronyms",
9
- "path": "./dictionaries/kp-acronyms.txt",
10
- "addWords": true
11
- },
12
- {
13
- "name": "kp-brands",
14
- "path": "./dictionaries/kp-brands.txt",
15
- "addWords": true
16
- },
17
- {
18
- "name": "kp-files",
19
- "path": "./dictionaries/kp-files.txt",
20
- "addWords": true
21
- },
22
- {
23
- "name": "kp-misc",
24
- "path": "./dictionaries/kp-misc.txt",
25
- "addWords": true
26
- },
27
- {
28
- "name": "kp-names",
29
- "path": "./dictionaries/kp-names.txt",
30
- "addWords": true
31
- },
32
- {
33
- "name": "kp-tech",
34
- "path": "./dictionaries/kp-tech.txt",
35
- "addWords": true
36
- }
37
- ],
38
- "dictionaries": [
39
- "lorem-ipsum",
40
- "git",
41
- "gaming-terms",
42
- "npm",
43
- "data-science",
44
- "fullstack",
45
- "kp-acronyms",
46
- "kp-brands",
47
- "kp-files",
48
- "kp-misc",
49
- "kp-names",
50
- "kp-tech"
51
- ],
52
- "languageSettings": [
53
- {
54
- "languageId": "markdown,mdx,json",
55
- "ignoreRegExpList": [
56
- // TODO does regex really need to be global?
57
- "/^```(?:.|\\s)+?^```/mig", // Code fences
58
- "\\$\\$.*?\\$\\$", // Ignore display MathJax $$...$$
59
- "\\$[^$\\n]*\\$", // Ignore inline MathJax $...$
60
- "[A-Z\\d\\-]{8,}" // Probable IDs or model names, e.g. AK-68-S7KA-0004
61
- ]
62
- }
63
- ],
64
- "globRoot": "/",
65
- "ignorePaths": [
66
- "__snapshots__",
67
- "*.app",
68
- "*.avif",
69
- "*.m4a",
70
- "*.m4v",
71
- "*.mp3",
72
- "*.mp4",
73
- "*.patch",
74
- "*.scpt",
75
- "*.svg",
76
- "*.tif",
77
- "*.tldr",
78
- "*.3gp",
79
- "*.aac",
80
- "*.avi",
81
- "*.flac",
82
- "*.flv",
83
- "*.mkv",
84
- "*.mpeg",
85
- "*.oga",
86
- "*.ogg",
87
- "*.ogv",
88
- "*.ogx",
89
- "*.opus",
90
- "*.spx",
91
- "*.swf",
92
- "*.wav",
93
- "package.json",
94
- "patches/",
95
- "pnpm-lock.yaml"
96
- ],
97
- "ignoreRegExpList": ["tp-.+", "tweakpane-plugin-.+", "v2_c_\\w{21}"],
98
- "language": "en,en-US",
99
- "useGitignore": true,
100
- "version": "0.2"
101
- }
package/init/.cspell.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3
- "import": "@kitschpatrol/cspell-config",
4
- "ignorePaths": [],
5
- "words": []
6
- }