cspell 10.3.1-alpha.0 → 10.3.1
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
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# cspell
|
|
2
2
|
|
|
3
|
-
[](https://github.com/streetsidesoftware/cspell/actions)
|
|
4
|
-
[](https://coveralls.io/github/streetsidesoftware/cspell?branch=main)
|
|
5
|
-
[](https://codecov.io/gh/streetsidesoftware/cspell)
|
|
6
|
-
|
|
7
3
|
A Spell Checker for Code!
|
|
8
4
|
|
|
9
5
|
`cspell` is a command line tool and library for spell checking code.
|
|
@@ -12,24 +8,22 @@ A Spell Checker for Code!
|
|
|
12
8
|
|
|
13
9
|
<!--- @@inject: ../../static/sponsor.md --->
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[](https://opencollective.com/cspell)
|
|
11
|
+
If our spell checkers save you time, please consider supporting their development.
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
<p align="left">
|
|
14
|
+
<a href="https://github.com/sponsors/streetsidesoftware" title="GitHub Sponsor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/github-sponsor-dark.png" /><img alt="GitHub Sponsor" src="https://cspell.org/img/sponsor/github-sponsor.png" width="180" /></picture></a> <a href="https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY" title="PayPal"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/paypal-dark.png" /><img alt="PayPal" src="https://cspell.org/img/sponsor/paypal.png" width="180" /></picture></a> <a href="https://opencollective.com/cspell" title="Open Collective"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/open-collective-dark.png" /><img alt="Open Collective" src="https://cspell.org/img/sponsor/open-collective.png" width="180" /></picture></a> <a href="https://streetsidesoftware.com/sponsor/" title="Street Side Software"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/cspell-dark.png" /><img alt="CSpell" src="https://cspell.org/img/sponsor/cspell.png" width="180" /></picture></a>
|
|
15
|
+
</p>
|
|
22
16
|
|
|
23
17
|
<!--- @@inject-end: ../../static/sponsor.md --->
|
|
24
18
|
|
|
25
19
|
## Features
|
|
26
20
|
|
|
27
|
-
- Spell Checks Code --
|
|
21
|
+
- Spell Checks Code -- Parses code into words before checking them against the dictionaries.
|
|
28
22
|
- Supports CamelCase, snake\_case, and compoundwords naming styles.
|
|
29
|
-
- Self contained -- does not depend upon OS libraries like Hunspell or
|
|
23
|
+
- Self contained -- does not depend upon OS libraries like Hunspell or Aspell. Nor does it depend upon online services.
|
|
30
24
|
- Fast -- checks 1000's of lines of code in seconds.
|
|
31
25
|
- Programming Language Specific Dictionaries -- Has dedicated support for:
|
|
32
|
-
- JavaScript, TypeScript, Python, PHP, C#, C++,
|
|
26
|
+
- JavaScript, TypeScript, Python, PHP, C#, C++, LaTeX, Go, HTML, CSS, etc.
|
|
33
27
|
- Customizable -- supports custom dictionaries and word lists.
|
|
34
28
|
- Continuous Integration Support -- Can easily be added as a linter to Travis-CI.
|
|
35
29
|
|
|
@@ -265,7 +259,7 @@ cspell check <filename> --color | less -r
|
|
|
265
259
|
|
|
266
260
|
## Command: `trace` - See which dictionaries contain a word
|
|
267
261
|
|
|
268
|
-
Trace shows
|
|
262
|
+
Trace shows the list of known dictionaries and a `*` next to the ones that contain the word.
|
|
269
263
|
|
|
270
264
|
A `!` will appear next to the ones where the word is forbidden.
|
|
271
265
|
|
|
@@ -310,18 +304,18 @@ Options:
|
|
|
310
304
|
|
|
311
305
|
<!--- @@inject-end: static/help-trace.txt --->
|
|
312
306
|
|
|
313
|
-
## CI/CD
|
|
307
|
+
## CI/CD Support
|
|
314
308
|
|
|
315
309
|
### Mega-Linter
|
|
316
310
|
|
|
317
|
-
[Mega-Linter](https://
|
|
311
|
+
[Mega-Linter](https://megalinter.io/latest/) aggregates 70 linters ready to use out of the box, including [cspell](https://megalinter.io/latest/descriptors/spell_cspell/)
|
|
318
312
|
|
|
319
313
|
- Can run as a GitHub Action, on other CI tools and locally
|
|
320
314
|
- Provides an updated `.cspell.json` file with new unknown words
|
|
321
315
|
|
|
322
316
|
**Setup**
|
|
323
317
|
|
|
324
|
-
Quick setup following installation guide in [Mega-Linter documentation](https://
|
|
318
|
+
Quick setup following installation guide in [Mega-Linter documentation](https://megalinter.io/latest/)
|
|
325
319
|
|
|
326
320
|
### Git commit-hooks
|
|
327
321
|
|
|
@@ -347,7 +341,7 @@ CSpell needs Node 22 and above.
|
|
|
347
341
|
|
|
348
342
|
## How it works
|
|
349
343
|
|
|
350
|
-
The concept is simple
|
|
344
|
+
The concept is simple: split camelCase and snake\_case words before checking them against a list of known words.
|
|
351
345
|
|
|
352
346
|
- `camelCase` -> `camel case`
|
|
353
347
|
- `HTMLInput` -> `html input`
|
|
@@ -358,14 +352,18 @@ The concept is simple, split camelCase and snake\_case words before checking the
|
|
|
358
352
|
|
|
359
353
|
### Special cases
|
|
360
354
|
|
|
361
|
-
- Escape
|
|
362
|
-
|
|
363
|
-
- `\
|
|
364
|
-
- `\
|
|
355
|
+
- Escape sequences like `\n` and `\t` are stripped from words one character at a time: the backslash is
|
|
356
|
+
always removed, and the letter (`n`, `t`, etc.) is kept only if doing so still produces a known word.
|
|
357
|
+
- `\narrow` -> `narrow` -- the `n` is kept because `narrow` is a word.
|
|
358
|
+
- `\ncode` -> `code` -- the `n` is dropped too, because `ncode` is not a word.
|
|
359
|
+
- `\network` -> `network` -- the `n` is kept because `network` is a word, but this might hide a real
|
|
360
|
+
typo if `\n` was actually meant as a newline followed by a misspelling.
|
|
365
361
|
|
|
366
362
|
### Things to note
|
|
367
363
|
|
|
368
|
-
-
|
|
364
|
+
- By default, case and accent checking is off for English, so it will not catch errors like `english` which should be `English`.
|
|
365
|
+
This is controlled by the `caseSensitive` setting -- see [Case and Accent Sensitivity](https://cspell.org/docs/case-sensitive).
|
|
366
|
+
Some language dictionaries (like German, French, and Spanish) turn on case sensitivity by default.
|
|
369
367
|
- The spellchecker uses dictionaries stored locally. It does not send anything outside your machine.
|
|
370
368
|
- The words in the dictionaries can and do contain errors.
|
|
371
369
|
- There are missing words.
|
|
@@ -375,9 +373,9 @@ The concept is simple, split camelCase and snake\_case words before checking the
|
|
|
375
373
|
## In Document Settings
|
|
376
374
|
|
|
377
375
|
It is possible to add spell check settings into your source code.
|
|
378
|
-
This is to help with file
|
|
376
|
+
This is to help with file-specific issues that may not be applicable to the entire project.
|
|
379
377
|
|
|
380
|
-
All settings are prefixed with `cspell
|
|
378
|
+
All settings are prefixed with `cspell:`, `spell-checker:`, or `spellchecker:` (the prefix is case insensitive, and the hyphen in `spell-checker:` is optional).
|
|
381
379
|
|
|
382
380
|
- `disable` -- turn off the spell checker for a section of code.
|
|
383
381
|
- `enable` -- turn the spell checker back on after it has been turned off.
|
|
@@ -513,7 +511,8 @@ var email1 = 'emailaddress@myfancynewcompany.com';
|
|
|
513
511
|
var email2 = '<emailaddress@myfancynewcompany.com>';
|
|
514
512
|
```
|
|
515
513
|
|
|
516
|
-
**Note:** ignoreRegExp and includeRegExp
|
|
514
|
+
**Note:** `ignoreRegExp` and `includeRegExp` apply to the entire file, unlike `cspell:disable`/`cspell:enable`,
|
|
515
|
+
which only affect the section of code between them.
|
|
517
516
|
|
|
518
517
|
#### Include Example
|
|
519
518
|
|
|
@@ -585,6 +584,26 @@ _cspell_'s behavior can be controlled through a config file. By default it looks
|
|
|
585
584
|
|
|
586
585
|
Or you can specify a path to a config file with the `--config <path>` argument on the command line.
|
|
587
586
|
|
|
587
|
+
### How Configuration Is Determined
|
|
588
|
+
|
|
589
|
+
Spell checking is a two step process:
|
|
590
|
+
|
|
591
|
+
1. **Determine which files to check** -- from command line globs (or the configuration's `files` setting if no
|
|
592
|
+
globs are given), or from `--file`/`--files`/`--file-list`, filtered against `ignorePaths`, `--exclude`, and
|
|
593
|
+
`.gitignore`.
|
|
594
|
+
1. **Determine the settings, and check the document** -- merge the built-in defaults, the configuration loaded
|
|
595
|
+
at start up (the project's configuration file, found searching upward from the current directory or given
|
|
596
|
+
with `--config`, plus a few CLI flags like `--dictionary`, `--disable-dictionary`, and `--report`), and the
|
|
597
|
+
configuration file nearest the document, which overrides all of the above. Then apply `overrides` and
|
|
598
|
+
`languageSettings` that match the document, then any in-document directives (`cspell:ignore`, `cspell:words`,
|
|
599
|
+
etc.), which always take precedence.
|
|
600
|
+
|
|
601
|
+
Most other CLI flags (`--no-progress`, `--show-suggestions`, `-v`/`--verbose`, `--color`, ...) only control what
|
|
602
|
+
the CLI reports and are not part of this process.
|
|
603
|
+
|
|
604
|
+
See [Configuration Resolution & Overrides](https://cspell.org/configuration/overrides/) and
|
|
605
|
+
[In-Document Settings](https://cspell.org/configuration/document-settings/) for details.
|
|
606
|
+
|
|
588
607
|
### `cspell.json`
|
|
589
608
|
|
|
590
609
|
#### Example `cspell.json` file
|
|
@@ -640,13 +659,13 @@ export default defineConfig({
|
|
|
640
659
|
|
|
641
660
|
will cause cspell to ignore anything in the `node_modules` directory.
|
|
642
661
|
|
|
643
|
-
- `maxNumberOfProblems` - defaults to **
|
|
662
|
+
- `maxNumberOfProblems` - defaults to **_10,000_** per file.
|
|
644
663
|
|
|
645
664
|
- `minWordLength` - defaults to **_4_** - the minimum length of a word before it is checked.
|
|
646
665
|
|
|
647
666
|
- `allowCompoundWords` - defaults to **_false_**; set to **true** to allow compound words by default.
|
|
648
667
|
|
|
649
|
-
- `dictionaries` - list of the names of the dictionaries to use. See [Dictionaries](#
|
|
668
|
+
- `dictionaries` - list of the names of the dictionaries to use. See [Dictionaries](#dictionaries) below.
|
|
650
669
|
|
|
651
670
|
- `dictionaryDefinitions` - this list defines any custom dictionaries to use. This is how you can include other languages like Spanish.
|
|
652
671
|
|
|
@@ -654,10 +673,10 @@ export default defineConfig({
|
|
|
654
673
|
|
|
655
674
|
```javascript
|
|
656
675
|
"language": "en",
|
|
657
|
-
// Dictionaries "spanish", "ruby", and "
|
|
676
|
+
// Dictionaries "spanish", "ruby", and "company-terms" will always be checked.
|
|
658
677
|
// Including "spanish" in the list of dictionaries means both Spanish and English
|
|
659
678
|
// words will be considered correct.
|
|
660
|
-
"dictionaries": ["spanish", "ruby", "
|
|
679
|
+
"dictionaries": ["spanish", "ruby", "company-terms", "fonts"],
|
|
661
680
|
// Define each dictionary. Relative paths are relative to the config file.
|
|
662
681
|
"dictionaryDefinitions": [
|
|
663
682
|
{ "name": "spanish", "path": "./spanish-words.txt"},
|
|
@@ -673,7 +692,7 @@ export default defineConfig({
|
|
|
673
692
|
- `patterns` - this allows you to define named patterns to be used with
|
|
674
693
|
`ignoreRegExpList` and `includeRegExpList`.
|
|
675
694
|
|
|
676
|
-
- `languageSettings` - this
|
|
695
|
+
- `languageSettings` - this allows for per programming language configuration settings. See [LanguageSettings](#languagesettings)
|
|
677
696
|
|
|
678
697
|
- `overrides` - this allows for settings to be based upon the file name or path. It is useful for setting the language for localization.
|
|
679
698
|
|
|
@@ -701,7 +720,7 @@ The spell checker includes a set of default dictionaries.
|
|
|
701
720
|
- **css** - _css_, _less_, and _scss_ related keywords
|
|
702
721
|
- **cpp** - _C++_ related keywords
|
|
703
722
|
- **csharp** - _C#_ related keywords
|
|
704
|
-
- **latex** -
|
|
723
|
+
- **latex** - LaTeX related words
|
|
705
724
|
- **bash** - Bash/shell script keywords
|
|
706
725
|
|
|
707
726
|
### Miscellaneous Dictionaries
|
|
@@ -716,13 +735,12 @@ The spell checker includes a set of default dictionaries.
|
|
|
716
735
|
- **description** - Optional description
|
|
717
736
|
- **path** - Path to the file, can be relative or absolute. Relative path is relative to the
|
|
718
737
|
current `cspell.json` file.
|
|
719
|
-
- **repMap** - Optional replacement map
|
|
738
|
+
- **repMap** - Optional replacement map used to replace characters prior to searching the dictionary.
|
|
720
739
|
Example:
|
|
721
740
|
```javascript
|
|
722
741
|
// Replace various tick marks with a single '
|
|
723
742
|
"repMap": [["'|`|’", "'"]]
|
|
724
743
|
```
|
|
725
|
-
// Use Compounds
|
|
726
744
|
- **useCompounds** - allow compound words
|
|
727
745
|
|
|
728
746
|
```javascript
|
|
@@ -767,7 +785,7 @@ There are two selector fields `locale` and `languageId`.
|
|
|
767
785
|
use `"*"`.
|
|
768
786
|
- `locale` defines which spoken languages to match against. A value of `"en-GB,nl"` will match against British English or Dutch.
|
|
769
787
|
A value of `"*"` will match all spoken languages.
|
|
770
|
-
- Most configuration values allowed in a `cspell.json` file can be
|
|
788
|
+
- Most configuration values allowed in a `cspell.json` file can be defined or redefined within the `languageSettings`.
|
|
771
789
|
|
|
772
790
|
```javascript
|
|
773
791
|
"languageSettings": [
|
package/dist/esm/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ApplicationError, S as width, T as console, _ as padLeft, a as parseApplicationFeatureFlags, b as pruneAnsiTextEnd, c as listDictionaries, d as validateUnitSize, f as unindent, g as tableToLines, i as lint, l as ReportChoicesAll, m as npmPackage, n as checkText, o as suggestions, p as DEFAULT_CACHE_LOCATION, r as createInit, s as trace, t as IncludeExcludeFlag, u as cvtLinterCliCommandOptionsToLinterCliOptions, v as padWidth, w as CheckFailed, x as pruneAnsiTextStart, y as ansiWidth } from "./application-
|
|
1
|
+
import { C as ApplicationError, S as width, T as console, _ as padLeft, a as parseApplicationFeatureFlags, b as pruneAnsiTextEnd, c as listDictionaries, d as validateUnitSize, f as unindent, g as tableToLines, i as lint, l as ReportChoicesAll, m as npmPackage, n as checkText, o as suggestions, p as DEFAULT_CACHE_LOCATION, r as createInit, s as trace, t as IncludeExcludeFlag, u as cvtLinterCliCommandOptionsToLinterCliOptions, v as padWidth, w as CheckFailed, x as pruneAnsiTextStart, y as ansiWidth } from "./application-Czt77ox8.js";
|
|
2
2
|
import { Link } from "cspell-lib";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import * as iPath from "node:path";
|
|
@@ -1213,7 +1213,7 @@ try {
|
|
|
1213
1213
|
const pkgDir = _dirname;
|
|
1214
1214
|
const npmPackage = {
|
|
1215
1215
|
name: "cspell",
|
|
1216
|
-
version: "10.3.1
|
|
1216
|
+
version: "10.3.1",
|
|
1217
1217
|
engines: { node: ">=22.18.0" }
|
|
1218
1218
|
};
|
|
1219
1219
|
//#endregion
|
|
@@ -3532,4 +3532,4 @@ function parseApplicationFeatureFlags(flags) {
|
|
|
3532
3532
|
//#endregion
|
|
3533
3533
|
export { ApplicationError as C, width as S, console as T, padLeft as _, parseApplicationFeatureFlags as a, pruneAnsiTextEnd as b, listDictionaries as c, validateUnitSize as d, unindent as f, tableToLines as g, getReporter as h, lint as i, ReportChoicesAll as l, npmPackage as m, checkText as n, suggestions as o, DEFAULT_CACHE_LOCATION as p, createInit as r, trace as s, IncludeExcludeFlag as t, cvtLinterCliCommandOptionsToLinterCliOptions as u, padWidth as v, CheckFailed as w, pruneAnsiTextStart as x, ansiWidth as y };
|
|
3534
3534
|
|
|
3535
|
-
//# sourceMappingURL=application-
|
|
3535
|
+
//# sourceMappingURL=application-Czt77ox8.js.map
|
package/dist/esm/application.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseApplicationFeatureFlags, c as listDictionaries, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-
|
|
1
|
+
import { a as parseApplicationFeatureFlags, c as listDictionaries, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-Czt77ox8.js";
|
|
2
2
|
export { IncludeExcludeFlag, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as parseApplicationFeatureFlags, c as listDictionaries, h as getReporter, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-
|
|
1
|
+
import { a as parseApplicationFeatureFlags, c as listDictionaries, h as getReporter, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-Czt77ox8.js";
|
|
2
2
|
export * from "@cspell/cspell-types";
|
|
3
3
|
export { IncludeExcludeFlag, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "10.3.1
|
|
3
|
+
"version": "10.3.1",
|
|
4
4
|
"description": "A Spelling Checker for Code!",
|
|
5
5
|
"funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
|
|
6
6
|
"bin": {
|
|
@@ -90,23 +90,23 @@
|
|
|
90
90
|
},
|
|
91
91
|
"homepage": "https://cspell.org/",
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@cspell/cspell-json-reporter": "10.3.1
|
|
94
|
-
"@cspell/cspell-performance-monitor": "10.3.1
|
|
95
|
-
"@cspell/cspell-pipe": "10.3.1
|
|
96
|
-
"@cspell/cspell-types": "10.3.1
|
|
97
|
-
"@cspell/cspell-worker": "10.3.1
|
|
98
|
-
"@cspell/dynamic-import": "10.3.1
|
|
99
|
-
"@cspell/url": "10.3.1
|
|
93
|
+
"@cspell/cspell-json-reporter": "10.3.1",
|
|
94
|
+
"@cspell/cspell-performance-monitor": "10.3.1",
|
|
95
|
+
"@cspell/cspell-pipe": "10.3.1",
|
|
96
|
+
"@cspell/cspell-types": "10.3.1",
|
|
97
|
+
"@cspell/cspell-worker": "10.3.1",
|
|
98
|
+
"@cspell/dynamic-import": "10.3.1",
|
|
99
|
+
"@cspell/url": "10.3.1",
|
|
100
100
|
"ansi-regex": "^6.3.0",
|
|
101
101
|
"chalk": "^6.0.0",
|
|
102
102
|
"chalk-template": "^1.1.2",
|
|
103
103
|
"commander": "^15.0.0",
|
|
104
|
-
"cspell-config-lib": "10.3.1
|
|
105
|
-
"cspell-dictionary": "10.3.1
|
|
106
|
-
"cspell-gitignore": "10.3.1
|
|
107
|
-
"cspell-glob": "10.3.1
|
|
108
|
-
"cspell-io": "10.3.1
|
|
109
|
-
"cspell-lib": "10.3.1
|
|
104
|
+
"cspell-config-lib": "10.3.1",
|
|
105
|
+
"cspell-dictionary": "10.3.1",
|
|
106
|
+
"cspell-gitignore": "10.3.1",
|
|
107
|
+
"cspell-glob": "10.3.1",
|
|
108
|
+
"cspell-io": "10.3.1",
|
|
109
|
+
"cspell-lib": "10.3.1",
|
|
110
110
|
"fast-json-stable-stringify": "^2.1.0",
|
|
111
111
|
"flatted": "^3.4.4",
|
|
112
112
|
"semver": "^7.8.5",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"micromatch": "^4.0.8",
|
|
122
122
|
"minimatch": "^9.0.9"
|
|
123
123
|
},
|
|
124
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "793953d1c2b4f1cab257389ff6ecb3ae2dd40230"
|
|
125
125
|
}
|