cspell 5.12.1 → 5.12.5

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
@@ -74,44 +74,59 @@ Usage: cspell lint [options] [files...]
74
74
  Check spelling
75
75
 
76
76
  Options:
77
- -c, --config <cspell.json> Configuration file to use. By default cspell
78
- looks for cspell.json in the current directory.
79
-
80
- -v, --verbose display more information about the files being
81
- checked and the configuration
82
-
83
- --locale <locale> Set language locales. i.e. "en,fr" for English
84
- and French, or "en-GB" for British English.
85
-
86
- --language-id <language> Force programming language for unknown
87
- extensions. i.e. "php" or "scala"
88
-
89
- --wordsOnly Only output the words not found in the
90
- dictionaries.
91
-
92
- -u, --unique Only output the first instance of a word not
93
- found in the dictionaries.
94
-
95
- --debug Output information useful for debugging
96
- cspell.json files.
97
-
98
- -e, --exclude <glob> Exclude files matching the glob pattern. This
99
- option can be used multiple times to add multiple
100
- globs.
101
-
102
- --no-issues Do not show the spelling errors.
103
- --no-progress Turn off progress messages
104
- --no-summary Turn off summary message in console
105
- -s, --silent Silent mode, suppress error messages
106
- -r, --root <root folder> Root directory, defaults to current directory.
107
- --relative Issues are displayed relative to root.
108
- --show-context Show the surrounding text around an issue.
109
- --show-suggestions Show spelling suggestions.
110
- --must-find-files Error if no files are found (default: true)
111
- --no-must-find-files Do not error is no files are found
112
- --no-color Turn off color.
113
- --color Force color
114
- -h, --help display help for command
77
+ -c, --config <cspell.json> Configuration file to use. By default cspell
78
+ looks for cspell.json in the current directory.
79
+
80
+ -v, --verbose display more information about the files being
81
+ checked and the configuration
82
+
83
+ --locale <locale> Set language locales. i.e. "en,fr" for English
84
+ and French, or "en-GB" for British English.
85
+
86
+ --language-id <language> Force programming language for unknown
87
+ extensions. i.e. "php" or "scala"
88
+
89
+ --wordsOnly Only output the words not found in the
90
+ dictionaries.
91
+
92
+ -u, --unique Only output the first instance of a word not
93
+ found in the dictionaries.
94
+
95
+ --debug Output information useful for debugging
96
+ cspell.json files.
97
+
98
+ -e, --exclude <glob> Exclude files matching the glob pattern. This
99
+ option can be used multiple times to add
100
+ multiple globs.
101
+
102
+ --no-issues Do not show the spelling errors.
103
+ --no-progress Turn off progress messages
104
+ --no-summary Turn off summary message in console
105
+ -s, --silent Silent mode, suppress error messages
106
+ -r, --root <root folder> Root directory, defaults to current directory.
107
+ --relative Issues are displayed relative to root.
108
+ --show-context Show the surrounding text around an issue.
109
+ --show-suggestions Show spelling suggestions.
110
+ --no-must-find-files Do not error if no files are found
111
+
112
+ --cache Only check changed files (default: false)
113
+ --cache-strategy <strategy> Strategy to use for detecting changed files
114
+ (choices: "metadata", "content")
115
+
116
+ --cache-location <path> Path to the cache file or directory (default:
117
+ ".cspellcache")
118
+
119
+ --gitignore Ignore files matching glob patterns found in
120
+ .gitignore files.
121
+
122
+ --no-gitignore Do NOT use .gitignore files.
123
+
124
+ --gitignore-root <path> Prevent searching for .gitignore files past
125
+ root.
126
+
127
+ --no-color Turn off color.
128
+ --color Force color
129
+ -h, --help display help for command
115
130
 
116
131
 
117
132
  Examples:
package/bin.js CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  'use strict';
4
3
 
5
4
  const app = require('./dist/app');
@@ -36,10 +36,10 @@ function lint(files, options, emitters) {
36
36
  exports.lint = lint;
37
37
  async function trace(words, options) {
38
38
  const { local } = options;
39
- const { languageId, locale = local } = options;
39
+ const { languageId, locale = local, allowCompoundWords, ignoreCase } = options;
40
40
  const configFile = await (0, fileHelper_1.readConfig)(options.config, undefined);
41
41
  const config = cspell.mergeSettings(cspell.getDefaultSettings(), cspell.getGlobalSettings(), configFile.config);
42
- const results = await (0, cspell_lib_1.traceWords)(words, config, { languageId, locale });
42
+ const results = await (0, cspell_lib_1.traceWords)(words, config, { languageId, locale, ignoreCase, allowCompoundWords });
43
43
  return results;
44
44
  }
45
45
  exports.trace = trace;
@@ -51,7 +51,8 @@ function commandLint(prog) {
51
51
  .option('--locale <locale>', 'Set language locales. i.e. "en,fr" for English and French, or "en-GB" for British English.')
52
52
  .option('--language-id <language>', 'Force programming language for unknown extensions. i.e. "php" or "scala"')
53
53
  .addOption(new commander_1.Option('--languageId <language>', 'Force programming language for unknown extensions. i.e. "php" or "scala"').hideHelp())
54
- .option('--wordsOnly', 'Only output the words not found in the dictionaries.')
54
+ .option('--words-only', 'Only output the words not found in the dictionaries.')
55
+ .addOption(new commander_1.Option('--wordsOnly', 'Only output the words not found in the dictionaries.').hideHelp())
55
56
  .option('-u, --unique', 'Only output the first instance of a word not found in the dictionaries.')
56
57
  .option('--debug', 'Output information useful for debugging cspell.json files.')
57
58
  .option('-e, --exclude <glob>', 'Exclude files matching the glob pattern. This option can be used multiple times to add multiple globs. ', collect)
@@ -20,6 +20,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.commandTrace = void 0;
23
+ const commander_1 = require("commander");
23
24
  const App = __importStar(require("./application"));
24
25
  const traceEmitter_1 = require("./traceEmitter");
25
26
  const errors_1 = require("./util/errors");
@@ -30,7 +31,12 @@ function commandTrace(prog) {
30
31
  Search for words in the configuration and dictionaries.`)
31
32
  .option('-c, --config <cspell.json>', 'Configuration file to use. By default cspell looks for cspell.json in the current directory.')
32
33
  .option('--locale <locale>', 'Set language locales. i.e. "en,fr" for English and French, or "en-GB" for British English.')
33
- .option('--languageId <language>', 'Force programming language for unknown extensions. i.e. "php" or "scala"')
34
+ .option('--language-id <language>', 'Use programming language. i.e. "php" or "scala"')
35
+ .addOption(new commander_1.Option('--languageId <language>', 'Use programming language. i.e. "php" or "scala"').hideHelp())
36
+ .option('--allow-compound-words', 'Turn on allowCompoundWords')
37
+ .addOption(new commander_1.Option('--allowCompoundWords', 'Turn on allowCompoundWords').hideHelp())
38
+ .option('--no-allow-compound-words', 'Turn off allowCompoundWords')
39
+ .option('--no-ignore-case', 'Do not ignore case and accents when searching for words')
34
40
  .option('--no-color', 'Turn off color.')
35
41
  .option('--color', 'Force color')
36
42
  .arguments('<words...>')
package/dist/lint.js CHANGED
@@ -174,7 +174,7 @@ async function runLint(cfg) {
174
174
  cspell.setLogger(getLoggerFromReporter(reporter));
175
175
  const useGitignore = (_b = (_a = cfg.options.gitignore) !== null && _a !== void 0 ? _a : configInfo.config.useGitignore) !== null && _b !== void 0 ? _b : false;
176
176
  const gitignoreRoots = (_c = cfg.options.gitignoreRoot) !== null && _c !== void 0 ? _c : configInfo.config.gitignoreRoot;
177
- const gitIgnore = useGitignore ? generateGitIgnore(gitignoreRoots) : undefined;
177
+ const gitIgnore = useGitignore ? await generateGitIgnore(gitignoreRoots) : undefined;
178
178
  const cliGlobs = cfg.files;
179
179
  const allGlobs = cliGlobs.length ? cliGlobs : configInfo.config.files || [];
180
180
  const combinedGlobs = (0, glob_1.normalizeGlobsToRoot)(allGlobs, cfg.root, false);
@@ -240,7 +240,10 @@ Options:
240
240
  }
241
241
  function filterFiles(files, globMatcher) {
242
242
  const patterns = globMatcher.patterns;
243
- const excludeInfo = patterns.map(extractGlobSource).map(({ glob, source }) => `Glob: ${glob} from ${source}`);
243
+ const excludeInfo = patterns
244
+ .map(extractGlobSource)
245
+ .map(({ glob, source }) => `Glob: ${glob} from ${source}`)
246
+ .filter(util.uniqueFn());
244
247
  reporter.info(`Exclusion Globs: \n ${excludeInfo.join('\n ')}\n`, cspell_types_1.MessageTypes.Info);
245
248
  const result = files.filter(util.uniqueFn()).filter((filename) => !isExcluded(filename, globMatcher));
246
249
  return result;
@@ -302,8 +305,13 @@ function getLoggerFromReporter(reporter) {
302
305
  error,
303
306
  };
304
307
  }
305
- function generateGitIgnore(roots) {
306
- const root = typeof roots === 'string' ? [roots] : roots;
308
+ async function generateGitIgnore(roots) {
309
+ const root = (typeof roots === 'string' ? [roots].filter((r) => !!r) : roots) || [];
310
+ if (!(root === null || root === void 0 ? void 0 : root.length)) {
311
+ const cwd = process.cwd();
312
+ const repo = (await (0, cspell_gitignore_1.findRepoRoot)(cwd)) || cwd;
313
+ root.push(repo);
314
+ }
307
315
  return new cspell_gitignore_1.GitIgnore(root === null || root === void 0 ? void 0 : root.map((p) => path.resolve(p)));
308
316
  }
309
317
  //# sourceMappingURL=lint.js.map
package/dist/options.d.ts CHANGED
@@ -56,7 +56,10 @@ export interface CSpellApplicationOptions extends BaseOptions {
56
56
  */
57
57
  gitignoreRoot?: string | string[];
58
58
  }
59
- export declare type TraceOptions = BaseOptions;
59
+ export interface TraceOptions extends BaseOptions {
60
+ allowCompoundWords?: boolean;
61
+ ignoreCase?: boolean;
62
+ }
60
63
  export interface BaseOptions {
61
64
  config?: string;
62
65
  languageId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "5.12.1",
3
+ "version": "5.12.5",
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,11 +70,11 @@
70
70
  "homepage": "https://streetsidesoftware.github.io/cspell/",
71
71
  "dependencies": {
72
72
  "chalk": "^4.1.2",
73
- "commander": "^8.2.0",
73
+ "commander": "^8.3.0",
74
74
  "comment-json": "^4.1.1",
75
- "cspell-gitignore": "^5.12.1",
76
- "cspell-glob": "^5.12.0",
77
- "cspell-lib": "^5.12.1",
75
+ "cspell-gitignore": "^5.12.5",
76
+ "cspell-glob": "^5.12.4",
77
+ "cspell-lib": "^5.12.5",
78
78
  "fast-json-stable-stringify": "^2.1.0",
79
79
  "file-entry-cache": "^6.0.1",
80
80
  "fs-extra": "^10.0.0",
@@ -88,18 +88,18 @@
88
88
  "node": ">=12.13.0"
89
89
  },
90
90
  "devDependencies": {
91
- "@cspell/cspell-json-reporter": "^5.12.1",
92
- "@cspell/cspell-types": "^5.12.1",
91
+ "@cspell/cspell-json-reporter": "^5.12.5",
92
+ "@cspell/cspell-types": "^5.12.4",
93
93
  "@types/file-entry-cache": "^5.0.2",
94
94
  "@types/fs-extra": "^9.0.13",
95
- "@types/glob": "^7.1.4",
95
+ "@types/glob": "^7.2.0",
96
96
  "@types/imurmurhash": "^0.1.1",
97
97
  "@types/micromatch": "^4.0.2",
98
98
  "@types/minimatch": "^3.0.5",
99
- "jest": "^27.2.4",
99
+ "jest": "^27.3.1",
100
100
  "micromatch": "^4.0.4",
101
101
  "minimatch": "^3.0.4",
102
102
  "rimraf": "^3.0.2"
103
103
  },
104
- "gitHead": "43a626145377e1f760ad51fc58701313c7a26243"
104
+ "gitHead": "84a21d1f7cbd17cc9633aafdff6dce19d6de35b5"
105
105
  }