cspell 5.18.2 → 5.18.3

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.
@@ -66,9 +66,21 @@ function relativeUriFilename(uri, fsPathRoot) {
66
66
  return '.' + path.sep + rel;
67
67
  }
68
68
  function reportProgress(p) {
69
- if (p.type !== 'ProgressFileComplete') {
70
- return;
69
+ if (p.type === 'ProgressFileComplete') {
70
+ return reportProgressFileComplete(p);
71
71
  }
72
+ if (p.type === 'ProgressFileBegin') {
73
+ return reportProgressFileBegin(p);
74
+ }
75
+ }
76
+ function reportProgressFileBegin(p) {
77
+ const fc = '' + p.fileCount;
78
+ const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
79
+ const idx = fn + '/' + fc;
80
+ const filename = chalk.gray(relativeFilename(p.filename));
81
+ process.stderr.write(`\r${idx} ${filename} ...`);
82
+ }
83
+ function reportProgressFileComplete(p) {
72
84
  const fc = '' + p.fileCount;
73
85
  const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
74
86
  const idx = fn + '/' + fc;
@@ -76,7 +88,7 @@ function reportProgress(p) {
76
88
  const time = reportTime(p.elapsedTimeMs, !!p.cached);
77
89
  const skipped = p.processed === false ? ' skipped' : '';
78
90
  const hasErrors = p.numErrors ? chalk.red ` X` : '';
79
- console.error(`${idx} ${filename} ${time}${skipped}${hasErrors}`);
91
+ console.error(`\r${idx} ${filename} ${time}${skipped}${hasErrors}`);
80
92
  }
81
93
  function reportTime(elapsedTimeMs, cached) {
82
94
  if (cached)
@@ -124,6 +136,10 @@ function getReporter(options) {
124
136
  if (!fileGlobs.length && !result.files) {
125
137
  return;
126
138
  }
139
+ if (result.cachedFiles) {
140
+ console.error('CSpell: Files checked: %d (%d from cache), Issues found: %d in %d files', result.files, result.cachedFiles, result.issues, result.filesWithIssues.size);
141
+ return;
142
+ }
127
143
  console.error('CSpell: Files checked: %d, Issues found: %d in %d files', result.files, result.issues, result.filesWithIssues.size);
128
144
  };
129
145
  return {
package/dist/lint/lint.js CHANGED
@@ -114,10 +114,16 @@ async function runLint(cfg) {
114
114
  const status = runResult();
115
115
  const cache = (0, cache_1.createCache)(cacheSettings);
116
116
  const failFast = (_b = (_a = cfg.options.failFast) !== null && _a !== void 0 ? _a : configInfo.config.failFast) !== null && _b !== void 0 ? _b : false;
117
- const emitProgress = (filename, fileNum, result) => reporter.progress({
117
+ const emitProgressBegin = (filename, fileNum, fileCount) => reporter.progress({
118
+ type: 'ProgressFileBegin',
119
+ fileNum,
120
+ fileCount,
121
+ filename,
122
+ });
123
+ const emitProgressComplete = (filename, fileNum, fileCount, result) => reporter.progress({
118
124
  type: 'ProgressFileComplete',
119
125
  fileNum,
120
- fileCount: fileCount !== null && fileCount !== void 0 ? fileCount : fileNum,
126
+ fileCount,
121
127
  filename,
122
128
  elapsedTimeMs: result === null || result === void 0 ? void 0 : result.elapsedTimeMs,
123
129
  processed: result === null || result === void 0 ? void 0 : result.processed,
@@ -128,6 +134,7 @@ async function runLint(cfg) {
128
134
  let i = 0;
129
135
  for await (const filename of files) {
130
136
  ++i;
137
+ emitProgressBegin(filename, i, fileCount !== null && fileCount !== void 0 ? fileCount : i);
131
138
  const result = await processFile(filename, configInfo, cache);
132
139
  yield { filename, fileNum: i, result };
133
140
  }
@@ -136,7 +143,7 @@ async function runLint(cfg) {
136
143
  const { filename, fileNum, result } = await fileP;
137
144
  status.files += 1;
138
145
  status.cachedFiles = (status.cachedFiles || 0) + (result.cached ? 1 : 0);
139
- emitProgress(filename, fileNum, result);
146
+ emitProgressComplete(filename, fileNum, fileCount !== null && fileCount !== void 0 ? fileCount : fileNum, result);
140
147
  // Show the spelling errors after emitting the progress.
141
148
  result.issues.filter(cfg.uniqueFilter).forEach((issue) => reporter.issue(issue));
142
149
  if (result.issues.length || result.errors) {
@@ -1,4 +1,4 @@
1
- import type { CSpellReporter, Issue, ProgressFileComplete, RunResult } from '@cspell/cspell-types';
1
+ import type { CSpellReporter, Issue, ProgressItem, RunResult } from '@cspell/cspell-types';
2
2
  export interface InMemoryResult {
3
3
  log: string[];
4
4
  issues: Issue[];
@@ -21,7 +21,7 @@ export declare class InMemoryReporter implements CSpellReporter, InMemoryResult
21
21
  error: (message: string, error: Error) => void;
22
22
  info: (message: string) => void;
23
23
  debug: (message: string) => void;
24
- progress: (p: ProgressFileComplete) => void;
24
+ progress: (p: ProgressItem) => void;
25
25
  result: (r: RunResult) => void;
26
26
  dump: () => InMemoryResult;
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "5.18.2",
3
+ "version": "5.18.3",
4
4
  "description": "A Spelling Checker for Code!",
5
5
  "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
6
6
  "main": "dist/index.js",
@@ -70,13 +70,13 @@
70
70
  },
71
71
  "homepage": "https://streetsidesoftware.github.io/cspell/",
72
72
  "dependencies": {
73
- "@cspell/cspell-pipe": "^5.18.2",
73
+ "@cspell/cspell-pipe": "^5.18.3",
74
74
  "chalk": "^4.1.2",
75
75
  "commander": "^9.0.0",
76
- "comment-json": "^4.1.1",
77
- "cspell-gitignore": "^5.18.2",
78
- "cspell-glob": "^5.18.2",
79
- "cspell-lib": "^5.18.2",
76
+ "comment-json": "^4.2.2",
77
+ "cspell-gitignore": "^5.18.3",
78
+ "cspell-glob": "^5.18.3",
79
+ "cspell-lib": "^5.18.3",
80
80
  "fast-json-stable-stringify": "^2.1.0",
81
81
  "file-entry-cache": "^6.0.1",
82
82
  "fs-extra": "^10.0.0",
@@ -91,8 +91,8 @@
91
91
  "node": ">=12.13.0"
92
92
  },
93
93
  "devDependencies": {
94
- "@cspell/cspell-json-reporter": "^5.18.2",
95
- "@cspell/cspell-types": "^5.18.2",
94
+ "@cspell/cspell-json-reporter": "^5.18.3",
95
+ "@cspell/cspell-types": "^5.18.3",
96
96
  "@types/file-entry-cache": "^5.0.2",
97
97
  "@types/fs-extra": "^9.0.13",
98
98
  "@types/glob": "^7.2.0",
@@ -107,5 +107,5 @@
107
107
  "rollup": "^2.67.0",
108
108
  "rollup-plugin-dts": "^4.1.0"
109
109
  },
110
- "gitHead": "baa92d5154ccf0a3a27d00ed169dd79cc80ea6cc"
110
+ "gitHead": "c650c8d0d58fc0398a6f745a0ad48d46f982332f"
111
111
  }