cspell 6.21.0 → 6.22.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
@@ -29,12 +29,16 @@ A Spell Checker for Code!
29
29
  cspell was initially built as the spell checking service for the [spell checker extension](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) for
30
30
  [Visual Studio Code](https://code.visualstudio.com/).
31
31
 
32
- ## cspell for enterprise
32
+ ## CSpell for Enterprise
33
+
34
+ <!--- @@inject: ../../static/tidelift.md --->
33
35
 
34
36
  Available as part of the Tidelift Subscription.
35
37
 
36
38
  The maintainers of cspell and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-cspell?utm_source=npm-cspell&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
37
39
 
40
+ <!--- @@inject-end: ../../static/tidelift.md --->
41
+
38
42
  ## Installation
39
43
 
40
44
  ```sh
@@ -45,9 +49,19 @@ npm install -g cspell
45
49
 
46
50
  There is a docker image at [Packages for cspell](https://github.com/streetsidesoftware/cspell-cli/pkgs/container/cspell).
47
51
 
48
- `cspell` commands below can be run by replacing `cspell` with: `docker run -v -i -t $PWD:/workdir ghcr.io/streetsidesoftware/cspell:latest`
52
+ `cspell` commands below can be run by replacing
49
53
 
50
- Example:
54
+ ```
55
+ cspell
56
+ ```
57
+
58
+ with:
59
+
60
+ ```
61
+ docker run -v -i -t $PWD:/workdir ghcr.io/streetsidesoftware/cspell:latest
62
+ ```
63
+
64
+ **Example:**
51
65
 
52
66
  ```sh
53
67
  docker run -v -i -t $PWD:/workdir ghcr.io/streetsidesoftware/cspell:latest lint --help
@@ -310,7 +324,7 @@ The concept is simple, split camelCase and snake_case words before checking them
310
324
  It is possible to add spell check settings into your source code.
311
325
  This is to help with file specific issues that may not be applicable to the entire project.
312
326
 
313
- All settings are prefixed with `cSpell:` or `spell-checker:`.
327
+ All settings are prefixed with `cspell:` or `spell-checker:`.
314
328
 
315
329
  - `disable` -- turn off the spell checker for a section of code.
316
330
  - `enable` -- turn the spell checker back on after it has been turned off.
@@ -327,26 +341,26 @@ It is possible to disable / enable the spell checker by adding comments to your
327
341
 
328
342
  #### Disable Checking
329
343
 
330
- - `/* cSpell:disable */`
344
+ - `/* cspell:disable */`
331
345
  - `/* spell-checker: disable */`
332
346
  - `/* spellchecker: disable */`
333
347
  - `// cspell:disable-line` -- disables checking for the current line.
334
348
  - `/* cspell:disable-next-line */` -- disables checking till the end of the next line.
335
349
 
336
- <!--- cSpell:enable -->
350
+ <!--- cspell:enable -->
337
351
 
338
352
  #### Enable Checking
339
353
 
340
- - `/* cSpell:enable */`
354
+ - `/* cspell:enable */`
341
355
  - `/* spell-checker: enable */`
342
356
  - `/* spellchecker: enable */`
343
357
 
344
358
  #### Example
345
359
 
346
360
  ```javascript
347
- // cSpell:disable
361
+ // cspell:disable
348
362
  const wackyWord = ['zaallano', 'wooorrdd', 'zzooommmmmmmm'];
349
- /* cSpell:enable */
363
+ /* cspell:enable */
350
364
 
351
365
  const words = ['zaallano', 'wooorrdd', 'zzooommmmmmmm']; // cspell:disable-line disables this entire line
352
366
 
@@ -363,7 +377,7 @@ var liep = 1;
363
377
  /* cspell:disable */
364
378
  // It is still disabled
365
379
 
366
- // cSpell:enable
380
+ // cspell:enable
367
381
  // It is now enabled
368
382
 
369
383
  const str = 'goededag'; // <- will be flagged as an error.
@@ -376,15 +390,15 @@ const str = 'goededag'; // <- will be flagged as an error.
376
390
  const str = 'goedemorgen'; // <- will NOT be flagged as an error.
377
391
  ```
378
392
 
379
- <!--- cSpell:enable -->
393
+ <!--- cspell:enable -->
380
394
 
381
395
  ### Ignore
382
396
 
383
397
  _Ignore_ allows you the specify a list of words you want to ignore within the document.
384
398
 
385
399
  ```javascript
386
- // cSpell:ignore zaallano, wooorrdd
387
- // cSpell:ignore zzooommmmmmmm
400
+ // cspell:ignore zaallano, wooorrdd
401
+ // cspell:ignore zzooommmmmmmm
388
402
  const wackyWord = ['zaallano', 'wooorrdd', 'zzooommmmmmmm'];
389
403
  ```
390
404
 
@@ -395,7 +409,7 @@ const wackyWord = ['zaallano', 'wooorrdd', 'zzooommmmmmmm'];
395
409
  The _words_ list allows you to add words that will be considered correct and will be used as suggestions.
396
410
 
397
411
  ```javascript
398
- // cSpell:words woorxs sweeetbeat
412
+ // cspell:words woorxs sweeetbeat
399
413
  const companyName = 'woorxs sweeetbeat';
400
414
  ```
401
415
 
@@ -406,8 +420,8 @@ const companyName = 'woorxs sweeetbeat';
406
420
  In some programing language it is common to glue words together.
407
421
 
408
422
  ```c
409
- // cSpell:enableCompoundWords
410
- char * errormessage; // Is ok with cSpell:enableCompoundWords
423
+ // cspell:enableCompoundWords
424
+ char * errormessage; // Is ok with cspell:enableCompoundWords
411
425
  int errornumber; // Is also ok.
412
426
  ```
413
427
 
@@ -417,7 +431,7 @@ The last setting in the file determines the value for the entire file.
417
431
  ### Excluding and Including Text to be checked.
418
432
 
419
433
  By default, the entire document is checked for spelling.
420
- `cSpell:disable`/`cSpell:enable` above allows you to block off sections of the document.
434
+ `cspell:disable`/`cspell:enable` above allows you to block off sections of the document.
421
435
  `ignoreRegExp` and `includeRegExp` give you the ability to ignore or include patterns of text.
422
436
  By default the flags `gim` are added if no flags are given.
423
437
 
@@ -430,17 +444,17 @@ The spell checker works in the following way:
430
444
  #### Exclude Example
431
445
 
432
446
  ```javascript
433
- // cSpell:ignoreRegExp 0x[0-9a-f]+ -- will ignore c style hex numbers
434
- // cSpell:ignoreRegExp /0x[0-9A-F]+/g -- will ignore upper case c style hex numbers.
435
- // cSpell:ignoreRegExp g{5} h{5} -- will only match ggggg, but not hhhhh or 'ggggg hhhhh'
436
- // cSpell:ignoreRegExp g{5}|h{5} -- will match both ggggg and hhhhh
437
- // cSpell:ignoreRegExp /g{5} h{5}/ -- will match 'ggggg hhhhh'
438
- /* cSpell:ignoreRegExp /n{5}/ -- will NOT work as expected because of the ending comment -> */
447
+ // cspell:ignoreRegExp 0x[0-9a-f]+ -- will ignore c style hex numbers
448
+ // cspell:ignoreRegExp /0x[0-9A-F]+/g -- will ignore upper case c style hex numbers.
449
+ // cspell:ignoreRegExp g{5} h{5} -- will only match ggggg, but not hhhhh or 'ggggg hhhhh'
450
+ // cspell:ignoreRegExp g{5}|h{5} -- will match both ggggg and hhhhh
451
+ // cspell:ignoreRegExp /g{5} h{5}/ -- will match 'ggggg hhhhh'
452
+ /* cspell:ignoreRegExp /n{5}/ -- will NOT work as expected because of the ending comment -> */
439
453
  /*
440
- cSpell:ignoreRegExp /q{5}/ -- will match qqqqq just fine but NOT QQQQQ
454
+ cspell:ignoreRegExp /q{5}/ -- will match qqqqq just fine but NOT QQQQQ
441
455
  */
442
- // cSpell:ignoreRegExp /[^\s]{40,}/ -- will ignore long strings with no spaces.
443
- // cSpell:ignoreRegExp Email -- this will ignore email like patterns -- see Predefined RegExp expressions
456
+ // cspell:ignoreRegExp /[^\s]{40,}/ -- will ignore long strings with no spaces.
457
+ // cspell:ignoreRegExp Email -- this will ignore email like patterns -- see Predefined RegExp expressions
444
458
  var encodedImage = 'HR+cPzr7XGAOJNurPL0G8I2kU0UhKcqFssoKvFTR7z0T3VJfK37vS025uKroHfJ9nA6WWbHZ/ASn...';
445
459
  var email1 = 'emailaddress@myfancynewcompany.com';
446
460
  var email2 = '<emailaddress@myfancynewcompany.com>';
@@ -453,8 +467,8 @@ var email2 = '<emailaddress@myfancynewcompany.com>';
453
467
  In general you should not need to use `includeRegExp`. But if you are mixing languages then it could come in helpful.
454
468
 
455
469
  ```Python
456
- # cSpell:includeRegExp #.*
457
- # cSpell:includeRegExp ("""|''')[^\1]*\1
470
+ # cspell:includeRegExp #.*
471
+ # cspell:includeRegExp ("""|''')[^\1]*\1
458
472
  # only comments and block strings will be checked for spelling.
459
473
  def sum_it(self, seq):
460
474
  """This is checked for spelling"""
@@ -471,7 +485,7 @@ def sum_it(self, seq):
471
485
  The _dictionaries_ list allows you to specify dictionaries to use for the file.
472
486
 
473
487
  ```javascript
474
- // cSpell:dictionaries lorem-ipsum
488
+ // cspell:dictionaries lorem-ipsum
475
489
  const companyName = 'Lorem ipsum dolor sit amet';
476
490
  ```
477
491
 
@@ -682,7 +696,7 @@ The number of `!`s is important.
682
696
 
683
697
  ## LanguageSettings
684
698
 
685
- The Language Settings allow configuration to be based upon the programming language and/or the e.
699
+ The Language Settings allow configuration to be based upon the programming language and/or the locale.
686
700
  There are two selector fields `locale` and `languageId`.
687
701
 
688
702
  - `languageId` defines which programming languages to match against.
@@ -749,13 +763,13 @@ Brought to you by <a href="https://streetsidesoftware.com" title="Street Side So
749
763
  <!--- @@inject-end: ../../static/footer.md --->
750
764
 
751
765
  <!---
752
- cSpell:disableCompoundWords
753
- cSpell:ignore compoundwords stringlength errornumber
754
- cSpell:ignore jsja goededag alek wheerd behaviour tsmerge QQQQQ ncode
755
- cSpell:includeRegExp Everything
756
- cSpell:ignore hte variabele alinea
757
- cSpell:ignore mkdirp githubusercontent streetsidesoftware vsmarketplacebadge visualstudio
758
- cSpell:words Verdana
759
- cSpell:ignore ieeees beees treeees
760
- cSpell:ignore amet
766
+ cspell:disableCompoundWords
767
+ cspell:ignore compoundwords stringlength errornumber
768
+ cspell:ignore jsja goededag alek wheerd behaviour tsmerge QQQQQ ncode
769
+ cspell:includeRegExp Everything
770
+ cspell:ignore hte variabele alinea
771
+ cspell:ignore mkdirp githubusercontent streetsidesoftware vsmarketplacebadge visualstudio
772
+ cspell:words Verdana
773
+ cspell:ignore ieeees beees treeees
774
+ cspell:ignore amet
761
775
  -->
package/dist/lint/lint.js CHANGED
@@ -229,7 +229,7 @@ async function runLint(cfg) {
229
229
  ...cfg.options,
230
230
  };
231
231
  const reporters = cfg.options.reporter ?? configInfo.config.reporters;
232
- reporter = (0, reporters_1.mergeReporters)(...(0, reporters_1.loadReporters)(reporters, cfg.reporter, reporterConfig));
232
+ reporter = (0, reporters_1.mergeReporters)(...(await (0, reporters_1.loadReporters)(reporters, cfg.reporter, reporterConfig)));
233
233
  cspell.setLogger(getLoggerFromReporter(reporter));
234
234
  const globInfo = await determineGlobs(configInfo, cfg);
235
235
  const { fileGlobs, excludeGlobs } = globInfo;
@@ -27,6 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.normalizePath = exports.createFromFile = void 0;
30
+ const node_worker_threads_1 = require("node:worker_threads");
30
31
  const file_entry_cache = __importStar(require("file-entry-cache"));
31
32
  const fs_1 = require("fs");
32
33
  const path = __importStar(require("path"));
@@ -87,11 +88,11 @@ function createFromFile(pathToCache, useCheckSum, useRelative) {
87
88
  return (...params) => {
88
89
  const cwd = process.cwd();
89
90
  try {
90
- process.chdir(relDir);
91
+ node_worker_threads_1.isMainThread && process.chdir(relDir);
91
92
  return fn(cwd, ...params);
92
93
  }
93
94
  finally {
94
- process.chdir(cwd);
95
+ node_worker_threads_1.isMainThread && process.chdir(cwd);
95
96
  }
96
97
  };
97
98
  }
@@ -7,7 +7,7 @@ export declare function mergeReporters(...reporters: ReadonlyArray<CSpellReporte
7
7
  /**
8
8
  * Loads reporter modules configured in cspell config file
9
9
  */
10
- export declare function loadReporters(reporters: FileSettings['reporters'], defaultReporter: CSpellReporter, config: ReporterConfiguration): ReadonlyArray<CSpellReporter>;
10
+ export declare function loadReporters(reporters: FileSettings['reporters'], defaultReporter: CSpellReporter, config: ReporterConfiguration): Promise<ReadonlyArray<CSpellReporter>>;
11
11
  export declare function finalizeReporter(reporter: undefined): undefined;
12
12
  export declare function finalizeReporter(reporter: CSpellReporter): FinalizedReporter;
13
13
  export declare function finalizeReporter(reporter: CSpellReporter | undefined): FinalizedReporter | undefined;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.finalizeReporter = exports.loadReporters = exports.mergeReporters = void 0;
4
+ const dynamic_import_1 = require("@cspell/dynamic-import");
4
5
  const errors_1 = require("./errors");
5
6
  function callAll(methods) {
6
7
  return (...p) => {
@@ -38,8 +39,8 @@ exports.mergeReporters = mergeReporters;
38
39
  /**
39
40
  * Loads reporter modules configured in cspell config file
40
41
  */
41
- function loadReporters(reporters, defaultReporter, config) {
42
- function loadReporter(reporterSettings) {
42
+ async function loadReporters(reporters, defaultReporter, config) {
43
+ async function loadReporter(reporterSettings) {
43
44
  if (reporterSettings === 'default')
44
45
  return defaultReporter;
45
46
  if (!Array.isArray(reporterSettings)) {
@@ -47,8 +48,7 @@ function loadReporters(reporters, defaultReporter, config) {
47
48
  }
48
49
  const [moduleName, settings] = reporterSettings;
49
50
  try {
50
- // eslint-disable-next-line @typescript-eslint/no-var-requires
51
- const { getReporter } = require(moduleName);
51
+ const { getReporter } = await (0, dynamic_import_1.dynamicImport)(moduleName, [process.cwd(), __dirname]);
52
52
  return getReporter(settings, config);
53
53
  }
54
54
  catch (e) {
@@ -56,7 +56,8 @@ function loadReporters(reporters, defaultReporter, config) {
56
56
  }
57
57
  }
58
58
  reporters = !reporters || !reporters.length ? ['default'] : [...reporters];
59
- return reporters.map(loadReporter).filter((v) => v !== undefined);
59
+ const loadedReporters = await Promise.all(reporters.map(loadReporter));
60
+ return loadedReporters.filter((v) => v !== undefined);
60
61
  }
61
62
  exports.loadReporters = loadReporters;
62
63
  function finalizeReporter(reporter) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "6.21.0",
3
+ "version": "6.22.0",
4
4
  "description": "A Spelling Checker for Code!",
5
5
  "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
6
6
  "main": "dist/index.js",
@@ -46,11 +46,13 @@
46
46
  "clean-build": "pnpm run clean && pnpm run build",
47
47
  "compile": "tsc -p .",
48
48
  "watch": "tsc --watch -p .",
49
- "coverage": "jest --coverage",
50
- "test-watch": "jest --watch",
49
+ "coverage": "pnpm coverage:vitest && pnpm coverage:fix",
50
+ "coverage:vitest": "vitest run --coverage",
51
+ "coverage:fix": "nyc report --temp-dir \"$(pwd)/coverage\" --reporter lcov --report-dir \"$(pwd)/coverage\" --cwd ../..",
52
+ "test-watch": "vitest",
51
53
  "prepublishOnly": "pnpm run clean-build",
52
- "test": "jest --maxWorkers=1",
53
- "test:update-snapshot": "jest --updateSnapshot"
54
+ "test": "vitest run",
55
+ "test:update-snapshot": "vitest run --updateSnapshot"
54
56
  },
55
57
  "repository": {
56
58
  "type": "git",
@@ -74,12 +76,13 @@
74
76
  },
75
77
  "homepage": "https://streetsidesoftware.github.io/cspell/",
76
78
  "dependencies": {
77
- "@cspell/cspell-pipe": "6.21.0",
79
+ "@cspell/cspell-pipe": "6.22.0",
80
+ "@cspell/dynamic-import": "6.22.0",
78
81
  "chalk": "^4.1.2",
79
82
  "commander": "^10.0.0",
80
- "cspell-gitignore": "6.21.0",
81
- "cspell-glob": "6.21.0",
82
- "cspell-lib": "6.21.0",
83
+ "cspell-gitignore": "6.22.0",
84
+ "cspell-glob": "6.22.0",
85
+ "cspell-lib": "6.22.0",
83
86
  "fast-glob": "^3.2.12",
84
87
  "fast-json-stable-stringify": "^2.1.0",
85
88
  "file-entry-cache": "^6.0.1",
@@ -93,18 +96,18 @@
93
96
  "node": ">=14"
94
97
  },
95
98
  "devDependencies": {
96
- "@cspell/cspell-json-reporter": "6.21.0",
97
- "@cspell/cspell-types": "6.21.0",
99
+ "@cspell/cspell-json-reporter": "6.22.0",
100
+ "@cspell/cspell-types": "6.22.0",
98
101
  "@types/file-entry-cache": "^5.0.2",
99
102
  "@types/glob": "^8.0.1",
100
103
  "@types/imurmurhash": "^0.1.1",
101
104
  "@types/micromatch": "^4.0.2",
102
105
  "@types/semver": "^7.3.13",
103
- "jest": "^29.4.1",
104
106
  "micromatch": "^4.0.5",
105
107
  "minimatch": "^6.1.6",
106
- "rollup": "^3.12.1",
107
- "rollup-plugin-dts": "^5.1.1"
108
+ "rollup": "^3.14.0",
109
+ "rollup-plugin-dts": "^5.1.1",
110
+ "vitest": "^0.28.4"
108
111
  },
109
- "gitHead": "67b37de0cbcbe62feb8fb6ec95adad1275c14caa"
112
+ "gitHead": "a133874ed7590cbe140f5067cfa80db84b644a5d"
110
113
  }