cspell 5.12.2 → 5.12.6

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/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.2",
3
+ "version": "5.12.6",
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.2",
76
- "cspell-glob": "^5.12.2",
77
- "cspell-lib": "^5.12.2",
75
+ "cspell-gitignore": "^5.12.6",
76
+ "cspell-glob": "^5.12.6",
77
+ "cspell-lib": "^5.12.6",
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.2",
92
- "@cspell/cspell-types": "^5.12.2",
91
+ "@cspell/cspell-json-reporter": "^5.12.6",
92
+ "@cspell/cspell-types": "^5.12.6",
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": "1418785bb9c3a29b794a6e9d447b5638f8eb9fbf"
104
+ "gitHead": "430bb6103b03793d5f0b746e7c643d12fa313216"
105
105
  }