cspell 10.3.1-alpha.1 → 10.3.2-alpha.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
@@ -1,9 +1,5 @@
1
1
  # cspell
2
2
 
3
- [![](https://github.com/streetsidesoftware/cspell/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/streetsidesoftware/cspell/actions)
4
- [![Coverage Status](https://coveralls.io/repos/github/streetsidesoftware/cspell/badge.svg?branch=main)](https://coveralls.io/github/streetsidesoftware/cspell?branch=main)
5
- [![codecov](https://codecov.io/gh/streetsidesoftware/cspell/branch/main/graph/badge.svg?token=Dr4fi2Sy08)](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
- [![GitHub Sponsors](https://img.shields.io/badge/-Street_Side_Software-black?style=for-the-badge&logo=githubsponsors&label=GitHub%20Sponsor%3A)](https://github.com/sponsors/streetsidesoftware)
16
-
17
- [![Open Collective](https://img.shields.io/badge/-CSpell-black?style=for-the-badge&logo=opencollective&label=Open%20Collective%3A)](https://opencollective.com/cspell)
11
+ If our spell checkers save you time, please consider supporting their development.
18
12
 
19
- [![Street Side Software](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fstreetsidesoftware%2Fcspell%2Frefs%2Fheads%2Fmain%2Fstatic%2Fcspell-badge.json)](https://streetsidesoftware.com/sponsor/)
20
-
21
- [![PayPal](https://img.shields.io/badge/-Street_Side_Software-black?style=for-the-badge&logo=paypal&label=PayPal%20Donate%3A)](https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY)
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> &nbsp; <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> &nbsp; <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> &nbsp; <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 -- Able to spell check code by parsing it into words before checking against the dictionaries.
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 aspell. Nor does it depend upon online services.
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++, LaTex, Go, HTML, CSS, etc.
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 a the list of known dictionaries and a `*` next to the ones that contain the word.
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,23 +304,21 @@ Options:
310
304
 
311
305
  <!--- @@inject-end: static/help-trace.txt --->
312
306
 
313
- ## CI/CD Continuous Integration support
307
+ ## CI/CD Support
314
308
 
315
309
  ### Mega-Linter
316
310
 
317
- [Mega-Linter](https://nvuillam.github.io/mega-linter/) aggregates 70 linters ready to use out of the box, including [cspell](https://nvuillam.github.io/mega-linter/descriptors/spell_cspell/)
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://nvuillam.github.io/mega-linter/)
318
+ Quick setup following installation guide in [Mega-Linter documentation](https://megalinter.io/latest/)
325
319
 
326
320
  ### Git commit-hooks
327
321
 
328
- #### pre-commit
329
-
330
322
  **Setup**
331
323
 
332
324
  ```
@@ -335,19 +327,23 @@ npm install -SD cspell
335
327
 
336
328
  **`.git/hooks/pre-commit`**
337
329
 
338
- ```
330
+ ```sh
339
331
  #!/bin/sh
340
332
 
341
333
  exec git diff --cached --name-only | npx cspell --no-summary --no-progress --no-must-find-files --file-list stdin
342
334
  ```
343
335
 
336
+ ### Using [pre-commit.com](https://pre-commit.com) Hook
337
+
338
+ Use: [`cspell-cli`](https://github.com/streetsidesoftware/cspell-cli#setup-pre-commit-hook)
339
+
344
340
  ## Requirements
345
341
 
346
342
  CSpell needs Node 22 and above.
347
343
 
348
344
  ## How it works
349
345
 
350
- The concept is simple, split camelCase and snake\_case words before checking them against a list of known words.
346
+ The concept is simple: split camelCase and snake\_case words before checking them against a list of known words.
351
347
 
352
348
  - `camelCase` -> `camel case`
353
349
  - `HTMLInput` -> `html input`
@@ -358,14 +354,18 @@ The concept is simple, split camelCase and snake\_case words before checking the
358
354
 
359
355
  ### Special cases
360
356
 
361
- - Escape characters like `\n`, `\t` are removed if the word does not match:
362
- - `\narrow` -> `narrow` - because `narrow` is a word
363
- - `\ncode` -> `code` - because `ncode` is not a word.
364
- - `\network` -> `network` - but it might be hiding a spelling error, if `\n` was an escape character.
357
+ - Escape sequences like `\n` and `\t` are stripped from words one character at a time: the backslash is
358
+ always removed, and the letter (`n`, `t`, etc.) is kept only if doing so still produces a known word.
359
+ - `\narrow` -> `narrow` -- the `n` is kept because `narrow` is a word.
360
+ - `\ncode` -> `code` -- the `n` is dropped too, because `ncode` is not a word.
361
+ - `\network` -> `network` -- the `n` is kept because `network` is a word, but this might hide a real
362
+ typo if `\n` was actually meant as a newline followed by a misspelling.
365
363
 
366
364
  ### Things to note
367
365
 
368
- - This spellchecker is case insensitive. It will not catch errors like `english` which should be `English`.
366
+ - By default, case and accent checking is off for English, so it will not catch errors like `english` which should be `English`.
367
+ This is controlled by the `caseSensitive` setting -- see [Case and Accent Sensitivity](https://cspell.org/docs/case-sensitive).
368
+ Some language dictionaries (like German, French, and Spanish) turn on case sensitivity by default.
369
369
  - The spellchecker uses dictionaries stored locally. It does not send anything outside your machine.
370
370
  - The words in the dictionaries can and do contain errors.
371
371
  - There are missing words.
@@ -375,9 +375,9 @@ The concept is simple, split camelCase and snake\_case words before checking the
375
375
  ## In Document Settings
376
376
 
377
377
  It is possible to add spell check settings into your source code.
378
- This is to help with file specific issues that may not be applicable to the entire project.
378
+ This is to help with file-specific issues that may not be applicable to the entire project.
379
379
 
380
- All settings are prefixed with `cspell:` or `spell-checker:`.
380
+ All settings are prefixed with `cspell:`, `spell-checker:`, or `spellchecker:` (the prefix is case insensitive, and the hyphen in `spell-checker:` is optional).
381
381
 
382
382
  - `disable` -- turn off the spell checker for a section of code.
383
383
  - `enable` -- turn the spell checker back on after it has been turned off.
@@ -513,7 +513,8 @@ var email1 = 'emailaddress@myfancynewcompany.com';
513
513
  var email2 = '<emailaddress@myfancynewcompany.com>';
514
514
  ```
515
515
 
516
- **Note:** ignoreRegExp and includeRegExp are applied to the entire file. They do not start and stop.
516
+ **Note:** `ignoreRegExp` and `includeRegExp` apply to the entire file, unlike `cspell:disable`/`cspell:enable`,
517
+ which only affect the section of code between them.
517
518
 
518
519
  #### Include Example
519
520
 
@@ -585,6 +586,26 @@ _cspell_'s behavior can be controlled through a config file. By default it looks
585
586
 
586
587
  Or you can specify a path to a config file with the `--config <path>` argument on the command line.
587
588
 
589
+ ### How Configuration Is Determined
590
+
591
+ Spell checking is a two step process:
592
+
593
+ 1. **Determine which files to check** -- from command line globs (or the configuration's `files` setting if no
594
+ globs are given), or from `--file`/`--files`/`--file-list`, filtered against `ignorePaths`, `--exclude`, and
595
+ `.gitignore`.
596
+ 1. **Determine the settings, and check the document** -- merge the built-in defaults, the configuration loaded
597
+ at start up (the project's configuration file, found searching upward from the current directory or given
598
+ with `--config`, plus a few CLI flags like `--dictionary`, `--disable-dictionary`, and `--report`), and the
599
+ configuration file nearest the document, which overrides all of the above. Then apply `overrides` and
600
+ `languageSettings` that match the document, then any in-document directives (`cspell:ignore`, `cspell:words`,
601
+ etc.), which always take precedence.
602
+
603
+ Most other CLI flags (`--no-progress`, `--show-suggestions`, `-v`/`--verbose`, `--color`, ...) only control what
604
+ the CLI reports and are not part of this process.
605
+
606
+ See [Configuration Resolution & Overrides](https://cspell.org/configuration/overrides/) and
607
+ [In-Document Settings](https://cspell.org/configuration/document-settings/) for details.
608
+
588
609
  ### `cspell.json`
589
610
 
590
611
  #### Example `cspell.json` file
@@ -640,13 +661,13 @@ export default defineConfig({
640
661
 
641
662
  will cause cspell to ignore anything in the `node_modules` directory.
642
663
 
643
- - `maxNumberOfProblems` - defaults to **_100_** per file.
664
+ - `maxNumberOfProblems` - defaults to **_10,000_** per file.
644
665
 
645
666
  - `minWordLength` - defaults to **_4_** - the minimum length of a word before it is checked.
646
667
 
647
668
  - `allowCompoundWords` - defaults to **_false_**; set to **true** to allow compound words by default.
648
669
 
649
- - `dictionaries` - list of the names of the dictionaries to use. See [Dictionaries](#Dictionaries) below.
670
+ - `dictionaries` - list of the names of the dictionaries to use. See [Dictionaries](#dictionaries) below.
650
671
 
651
672
  - `dictionaryDefinitions` - this list defines any custom dictionaries to use. This is how you can include other languages like Spanish.
652
673
 
@@ -654,10 +675,10 @@ export default defineConfig({
654
675
 
655
676
  ```javascript
656
677
  "language": "en",
657
- // Dictionaries "spanish", "ruby", and "corp-term" will always be checked.
678
+ // Dictionaries "spanish", "ruby", and "company-terms" will always be checked.
658
679
  // Including "spanish" in the list of dictionaries means both Spanish and English
659
680
  // words will be considered correct.
660
- "dictionaries": ["spanish", "ruby", "corp-terms", "fonts"],
681
+ "dictionaries": ["spanish", "ruby", "company-terms", "fonts"],
661
682
  // Define each dictionary. Relative paths are relative to the config file.
662
683
  "dictionaryDefinitions": [
663
684
  { "name": "spanish", "path": "./spanish-words.txt"},
@@ -673,7 +694,7 @@ export default defineConfig({
673
694
  - `patterns` - this allows you to define named patterns to be used with
674
695
  `ignoreRegExpList` and `includeRegExpList`.
675
696
 
676
- - `languageSettings` - this allow for per programming language configuration settings. See [LanguageSettings](#LanguageSettings)
697
+ - `languageSettings` - this allows for per programming language configuration settings. See [LanguageSettings](#languagesettings)
677
698
 
678
699
  - `overrides` - this allows for settings to be based upon the file name or path. It is useful for setting the language for localization.
679
700
 
@@ -701,7 +722,7 @@ The spell checker includes a set of default dictionaries.
701
722
  - **css** - _css_, _less_, and _scss_ related keywords
702
723
  - **cpp** - _C++_ related keywords
703
724
  - **csharp** - _C#_ related keywords
704
- - **latex** - LaTex related words
725
+ - **latex** - LaTeX related words
705
726
  - **bash** - Bash/shell script keywords
706
727
 
707
728
  ### Miscellaneous Dictionaries
@@ -716,13 +737,12 @@ The spell checker includes a set of default dictionaries.
716
737
  - **description** - Optional description
717
738
  - **path** - Path to the file, can be relative or absolute. Relative path is relative to the
718
739
  current `cspell.json` file.
719
- - **repMap** - Optional replacement map use to replace character prior to searching the dictionary.
740
+ - **repMap** - Optional replacement map used to replace characters prior to searching the dictionary.
720
741
  Example:
721
742
  ```javascript
722
743
  // Replace various tick marks with a single '
723
744
  "repMap": [["'|`|’", "'"]]
724
745
  ```
725
- // Use Compounds
726
746
  - **useCompounds** - allow compound words
727
747
 
728
748
  ```javascript
@@ -767,7 +787,7 @@ There are two selector fields `locale` and `languageId`.
767
787
  use `"*"`.
768
788
  - `locale` defines which spoken languages to match against. A value of `"en-GB,nl"` will match against British English or Dutch.
769
789
  A value of `"*"` will match all spoken languages.
770
- - Most configuration values allowed in a `cspell.json` file can be define or redefine within the `languageSettings`.
790
+ - Most configuration values allowed in a `cspell.json` file can be defined or redefined within the `languageSettings`.
771
791
 
772
792
  ```javascript
773
793
  "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-BWKRmSlw.js";
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-CyAnKMRe.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-alpha.1",
1216
+ version: "10.3.2-alpha.0",
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-BWKRmSlw.js.map
3535
+ //# sourceMappingURL=application-CyAnKMRe.js.map
@@ -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-BWKRmSlw.js";
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-CyAnKMRe.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-BWKRmSlw.js";
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-CyAnKMRe.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-alpha.1",
3
+ "version": "10.3.2-alpha.0",
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-alpha.1",
94
- "@cspell/cspell-performance-monitor": "10.3.1-alpha.1",
95
- "@cspell/cspell-pipe": "10.3.1-alpha.1",
96
- "@cspell/cspell-types": "10.3.1-alpha.1",
97
- "@cspell/cspell-worker": "10.3.1-alpha.1",
98
- "@cspell/dynamic-import": "10.3.1-alpha.1",
99
- "@cspell/url": "10.3.1-alpha.1",
93
+ "@cspell/cspell-json-reporter": "10.3.2-alpha.0",
94
+ "@cspell/cspell-performance-monitor": "10.3.2-alpha.0",
95
+ "@cspell/cspell-pipe": "10.3.2-alpha.0",
96
+ "@cspell/cspell-types": "10.3.2-alpha.0",
97
+ "@cspell/cspell-worker": "10.3.2-alpha.0",
98
+ "@cspell/dynamic-import": "10.3.2-alpha.0",
99
+ "@cspell/url": "10.3.2-alpha.0",
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-alpha.1",
105
- "cspell-dictionary": "10.3.1-alpha.1",
106
- "cspell-gitignore": "10.3.1-alpha.1",
107
- "cspell-glob": "10.3.1-alpha.1",
108
- "cspell-io": "10.3.1-alpha.1",
109
- "cspell-lib": "10.3.1-alpha.1",
104
+ "cspell-config-lib": "10.3.2-alpha.0",
105
+ "cspell-dictionary": "10.3.2-alpha.0",
106
+ "cspell-gitignore": "10.3.2-alpha.0",
107
+ "cspell-glob": "10.3.2-alpha.0",
108
+ "cspell-io": "10.3.2-alpha.0",
109
+ "cspell-lib": "10.3.2-alpha.0",
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": "aa0576e5b7e666a7e8645939871bcfe4fa2a7eb5"
124
+ "gitHead": "c7193065b82df0646e24ab6f6d370c12148f0efc"
125
125
  }