From 8ce8e4981e09bf13e6efee543dc59eb9e6dfa2ca Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 18:46:52 +0000 Subject: [PATCH 01/10] Change default cache strategy to `content` --- .github/workflows/cspell-cli.yml | 3 +- cspell.schema.json | 8 +-- packages/cspell-types/cspell.schema.json | 8 +-- .../cspell-types/src/CSpellSettingsDef.ts | 4 +- packages/cspell/src/app/application.test.ts | 8 +-- packages/cspell/src/app/commandLint.ts | 7 +-- .../src/app/util/cache/createCache.test.ts | 30 +++++----- .../cspell/src/app/util/cache/createCache.ts | 2 +- tools/perf-chart/lib/app.cjs | 56 +++++++++---------- 9 files changed, 62 insertions(+), 64 deletions(-) diff --git a/.github/workflows/cspell-cli.yml b/.github/workflows/cspell-cli.yml index ca8671a8078..fd6115661de 100644 --- a/.github/workflows/cspell-cli.yml +++ b/.github/workflows/cspell-cli.yml @@ -41,5 +41,4 @@ jobs: cspell-cache-v2-${{ runner.os }}- - name: cspell@latest - run: npx cspell@latest --cache --cache-strategy=content --cache-location=.cspellcache --exclude="yarn2" --no-progress "**" - # run: npx cspell@latest --cache --cache-strategy=content --cache-location=.cspellcache --exclude="yarn2" "**" + run: npx cspell@latest --cache --cache-location=.cspellcache --exclude="yarn2" --no-progress "**" diff --git a/cspell.schema.json b/cspell.schema.json index 605af833936..a98dfde8852 100644 --- a/cspell.schema.json +++ b/cspell.schema.json @@ -40,12 +40,12 @@ "type": "object" }, "CacheStrategy": { - "description": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", + "description": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "enum": [ - "metadata", - "content" + "content", + "metadata" ], - "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", + "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "type": "string" }, "CharacterSet": { diff --git a/packages/cspell-types/cspell.schema.json b/packages/cspell-types/cspell.schema.json index 605af833936..a98dfde8852 100644 --- a/packages/cspell-types/cspell.schema.json +++ b/packages/cspell-types/cspell.schema.json @@ -40,12 +40,12 @@ "type": "object" }, "CacheStrategy": { - "description": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", + "description": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "enum": [ - "metadata", - "content" + "content", + "metadata" ], - "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", + "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "type": "string" }, "CharacterSet": { diff --git a/packages/cspell-types/src/CSpellSettingsDef.ts b/packages/cspell-types/src/CSpellSettingsDef.ts index 2a3c17b23a2..cd7097409d1 100644 --- a/packages/cspell-types/src/CSpellSettingsDef.ts +++ b/packages/cspell-types/src/CSpellSettingsDef.ts @@ -335,10 +335,10 @@ export interface PnPSettings { /** * The Strategy to use to detect if a file has changed. - * - `metadata` - uses the file system timestamp and size to detect changes (fastest). * - `content` - uses a hash of the file content to check file changes (slower - more accurate). + * - `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI). */ -export type CacheStrategy = 'metadata' | 'content'; +export type CacheStrategy = 'content' | 'metadata'; export type CacheFormat = 'legacy' | 'universal'; diff --git a/packages/cspell/src/app/application.test.ts b/packages/cspell/src/app/application.test.ts index 5d34d3ad5e3..843282fcdf8 100644 --- a/packages/cspell/src/app/application.test.ts +++ b/packages/cspell/src/app/application.test.ts @@ -239,15 +239,15 @@ describe('Linter File Caching', () => { const NoCache: LinterOptions = { cache: false }; const Config: LinterOptions = { cacheFormat: 'legacy' }; - const WithCache: LinterOptions = { cache: true, cacheStrategy: 'metadata', cacheFormat: 'legacy' }; + const WithCache: LinterOptions = { cache: true, cacheStrategy: 'content', cacheFormat: 'legacy' }; // const WithCacheUniversal: LinterOptions = { cache: true, cacheStrategy: 'metadata' }; const WithCacheReset: LinterOptions = { cache: true, - cacheStrategy: 'metadata', + cacheStrategy: 'content', cacheReset: true, cacheFormat: 'legacy', }; - const CacheContent: LinterOptions = { cache: true, cacheStrategy: 'content', cacheFormat: 'legacy' }; + const CacheMetadata: LinterOptions = { cache: true, cacheStrategy: 'metadata', cacheFormat: 'legacy' }; test.each` runs | root | comment @@ -257,7 +257,7 @@ describe('Linter File Caching', () => { ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.md'], WithCache, fc(1, 1)), run(['*.md'], WithCache, fc(1, 1))]} | ${fr('cached')} | ${'Single .md file cached three runs'} ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], WithCache, fc(2, 2))]} | ${fr('cached')} | ${'cached changing glob three runs'} ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], WithCacheReset, fc(2, 0))]} | ${fr('cached')} | ${'cached changing glob three runs'} - ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], CacheContent, fc(2, 0))]} | ${fr('cached')} | ${'with cache rebuild'} + ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], CacheMetadata, fc(2, 0))]} | ${fr('cached')} | ${'with cache rebuild'} ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCacheReset, fc(2, 0)), run(['*.{md,ts}'], WithCache, fc(2, 2))]} | ${fr('cached')} | ${'cached changing glob three runs'} `('lint caching with $root $comment', async ({ runs, root }: TestCase) => { const reporter = new InMemoryReporter(); diff --git a/packages/cspell/src/app/commandLint.ts b/packages/cspell/src/app/commandLint.ts index 6389bea9029..7a843c14bed 100644 --- a/packages/cspell/src/app/commandLint.ts +++ b/packages/cspell/src/app/commandLint.ts @@ -135,10 +135,9 @@ export function commandLint(prog: Command): Command { .option('--no-cache', 'Do not use cache.') .option('--cache-reset', 'Reset the cache file.') .addOption( - crOpt('--cache-strategy ', 'Strategy to use for detecting changed files.').choices([ - 'metadata', - 'content', - ]), + crOpt('--cache-strategy ', 'Strategy to use for detecting changed files.') + .choices(['content', 'metadata']) + .default('content'), ) .option( '--cache-location ', diff --git a/packages/cspell/src/app/util/cache/createCache.test.ts b/packages/cspell/src/app/util/cache/createCache.test.ts index e67f64b5ae3..9785b037b0e 100644 --- a/packages/cspell/src/app/util/cache/createCache.test.ts +++ b/packages/cspell/src/app/util/cache/createCache.test.ts @@ -25,21 +25,21 @@ const F = false; describe('Validate calcCacheSettings', () => { test.each` - config | options | root | expected | comment - ${{}} | ${{}} | ${process.cwd()} | ${cco()} | ${''} - ${{}} | ${{}} | ${__dirname} | ${cco(F, r(__dirname, '.cspellcache'))} | ${''} - ${{}} | ${{}} | ${'.'} | ${cco()} | ${''} - ${{}} | ${co()} | ${'.'} | ${cco()} | ${''} - ${{}} | ${co(U, '.')} | ${'.'} | ${cco()} | ${'Location is a directory'} - ${{}} | ${co(U, __filename)} | ${'.'} | ${cco(F, __filename)} | ${'Location is a file'} - ${cs(T)} | ${co()} | ${'.'} | ${cco(T)} | ${'Use cache in config but not command-line'} - ${cs(F)} | ${co()} | ${'.'} | ${cco(F)} | ${'cfg: true, cli: -'} - ${cs(F)} | ${co(T)} | ${'.'} | ${cco(T)} | ${'cfg: false, cli: true'} - ${{}} | ${co(T)} | ${'.'} | ${cco(T)} | ${'cfg: -, cli: true'} - ${{}} | ${{ cacheStrategy: 'content' }} | ${'.'} | ${cco(F, U, 'content')} | ${'override default strategy'} - ${{}} | ${co(T, U, 'content')} | ${'.'} | ${cco(T, U, 'content')} | ${'override strategy'} - ${cs(U, U, 'content')} | ${co(T, U, 'metadata')} | ${'.'} | ${cco(T, U, 'metadata')} | ${'override config strategy'} - ${cs(T, U, 'content')} | ${{ version }} | ${'.'} | ${cco(T, U, 'content')} | ${'override default strategy'} + config | options | root | expected | comment + ${{}} | ${{}} | ${process.cwd()} | ${cco()} | ${''} + ${{}} | ${{}} | ${__dirname} | ${cco(F, r(__dirname, '.cspellcache'))} | ${''} + ${{}} | ${{}} | ${'.'} | ${cco()} | ${''} + ${{}} | ${co()} | ${'.'} | ${cco()} | ${''} + ${{}} | ${co(U, '.')} | ${'.'} | ${cco()} | ${'Location is a directory'} + ${{}} | ${co(U, __filename)} | ${'.'} | ${cco(F, __filename)} | ${'Location is a file'} + ${cs(T)} | ${co()} | ${'.'} | ${cco(T)} | ${'Use cache in config but not command-line'} + ${cs(F)} | ${co()} | ${'.'} | ${cco(F)} | ${'cfg: true, cli: -'} + ${cs(F)} | ${co(T)} | ${'.'} | ${cco(T)} | ${'cfg: false, cli: true'} + ${{}} | ${co(T)} | ${'.'} | ${cco(T)} | ${'cfg: -, cli: true'} + ${{}} | ${{ cacheStrategy: 'metadata' }} | ${'.'} | ${cco(F, U, 'metadata')} | ${'override default strategy'} + ${{}} | ${co(T, U, 'metadata')} | ${'.'} | ${cco(T, U, 'metadata')} | ${'override strategy'} + ${cs(U, U, 'metadata')} | ${co(T, U, 'content')} | ${'.'} | ${cco(T, U, 'content')} | ${'override config strategy'} + ${cs(T, U, 'metadata')} | ${{ version }} | ${'.'} | ${cco(T, U, 'metadata')} | ${'override default strategy'} `('calcCacheSettings $comment - $config $options $root', async ({ config, options, root, expected }) => { if (!options.version) { options.version = version; diff --git a/packages/cspell/src/app/util/cache/createCache.ts b/packages/cspell/src/app/util/cache/createCache.ts index 860f9a5ef67..f70d9eeb072 100644 --- a/packages/cspell/src/app/util/cache/createCache.ts +++ b/packages/cspell/src/app/util/cache/createCache.ts @@ -53,7 +53,7 @@ export async function calcCacheSettings( path.resolve(root, cacheOptions.cacheLocation ?? cs.cacheLocation ?? DEFAULT_CACHE_LOCATION), ); - const cacheStrategy = cacheOptions.cacheStrategy ?? cs.cacheStrategy ?? 'metadata'; + const cacheStrategy = cacheOptions.cacheStrategy ?? cs.cacheStrategy ?? 'content'; const cacheFormat = cacheOptions.cacheFormat ?? cs.cacheFormat ?? 'universal'; const optionals: Partial = {}; if (cacheOptions.cacheReset) { diff --git a/tools/perf-chart/lib/app.cjs b/tools/perf-chart/lib/app.cjs index 7f5f40f1305..8627c27e346 100644 --- a/tools/perf-chart/lib/app.cjs +++ b/tools/perf-chart/lib/app.cjs @@ -25,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge mod )); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/error.js +// ../../node_modules/commander/lib/error.js var require_error = __commonJS({ - "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/error.js"(exports2) { + "../../node_modules/commander/lib/error.js"(exports2) { var CommanderError2 = class extends Error { /** * Constructs the CommanderError class @@ -60,9 +60,9 @@ var require_error = __commonJS({ } }); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/argument.js +// ../../node_modules/commander/lib/argument.js var require_argument = __commonJS({ - "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/argument.js"(exports2) { + "../../node_modules/commander/lib/argument.js"(exports2) { var { InvalidArgumentError: InvalidArgumentError2 } = require_error(); var Argument2 = class { /** @@ -187,9 +187,9 @@ var require_argument = __commonJS({ } }); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/help.js +// ../../node_modules/commander/lib/help.js var require_help = __commonJS({ - "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/help.js"(exports2) { + "../../node_modules/commander/lib/help.js"(exports2) { var { humanReadableArgName } = require_argument(); var Help2 = class { constructor() { @@ -601,9 +601,9 @@ var require_help = __commonJS({ } }); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/option.js +// ../../node_modules/commander/lib/option.js var require_option = __commonJS({ - "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/option.js"(exports2) { + "../../node_modules/commander/lib/option.js"(exports2) { var { InvalidArgumentError: InvalidArgumentError2 } = require_error(); var Option2 = class { /** @@ -873,9 +873,9 @@ var require_option = __commonJS({ } }); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/suggestSimilar.js +// ../../node_modules/commander/lib/suggestSimilar.js var require_suggestSimilar = __commonJS({ - "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/suggestSimilar.js"(exports2) { + "../../node_modules/commander/lib/suggestSimilar.js"(exports2) { var maxDistance = 3; function editDistance(a, b) { if (Math.abs(a.length - b.length) > maxDistance) @@ -953,9 +953,9 @@ var require_suggestSimilar = __commonJS({ } }); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js +// ../../node_modules/commander/lib/command.js var require_command = __commonJS({ - "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports2) { + "../../node_modules/commander/lib/command.js"(exports2) { var EventEmitter = require("node:events").EventEmitter; var childProcess = require("node:child_process"); var path = require("node:path"); @@ -2996,9 +2996,9 @@ Expecting one of '${allowedValues.join("', '")}'`); } }); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/index.js +// ../../node_modules/commander/index.js var require_commander = __commonJS({ - "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/index.js"(exports2) { + "../../node_modules/commander/index.js"(exports2) { var { Argument: Argument2 } = require_argument(); var { Command: Command2 } = require_command(); var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error(); @@ -3018,7 +3018,7 @@ var require_commander = __commonJS({ } }); -// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/esm.mjs +// ../../node_modules/commander/esm.mjs var import_index = __toESM(require_commander(), 1); var { program, @@ -3038,7 +3038,7 @@ var { // src/perfChart.ts var import_node_fs = require("node:fs"); -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/CsvError.js +// ../../node_modules/csv-parse/lib/api/CsvError.js var CsvError = class _CsvError extends Error { constructor(code, message, options, ...contexts) { if (Array.isArray(message)) message = message.join(" ").trim(); @@ -3056,12 +3056,12 @@ var CsvError = class _CsvError extends Error { } }; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/is_object.js +// ../../node_modules/csv-parse/lib/utils/is_object.js var is_object = function(obj) { return typeof obj === "object" && obj !== null && !Array.isArray(obj); }; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/normalize_columns_array.js +// ../../node_modules/csv-parse/lib/api/normalize_columns_array.js var normalize_columns_array = function(columns) { const normalizedColumns = []; for (let i = 0, l = columns.length; i < l; i++) { @@ -3090,7 +3090,7 @@ var normalize_columns_array = function(columns) { return normalizedColumns; }; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/ResizeableBuffer.js +// ../../node_modules/csv-parse/lib/utils/ResizeableBuffer.js var ResizeableBuffer = class { constructor(size = 100) { this.size = size; @@ -3154,7 +3154,7 @@ var ResizeableBuffer = class { }; var ResizeableBuffer_default = ResizeableBuffer; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/init_state.js +// ../../node_modules/csv-parse/lib/api/init_state.js var np = 12; var cr = 13; var nl = 10; @@ -3203,14 +3203,14 @@ var init_state = function(options) { }; }; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/underscore.js +// ../../node_modules/csv-parse/lib/utils/underscore.js var underscore = function(str) { return str.replace(/([A-Z])/g, function(_, match) { return "_" + match.toLowerCase(); }); }; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/normalize_options.js +// ../../node_modules/csv-parse/lib/api/normalize_options.js var normalize_options = function(opts) { const options = {}; for (const opt in opts) { @@ -3610,7 +3610,7 @@ var normalize_options = function(opts) { return options; }; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/index.js +// ../../node_modules/csv-parse/lib/api/index.js var isRecordEmpty = function(record) { return record.every((field) => field == null || field.toString && field.toString().trim() === ""); }; @@ -4283,7 +4283,7 @@ var transform = function(original_options = {}) { }; }; -// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/sync.js +// ../../node_modules/csv-parse/lib/sync.js var parse = function(data, opts = {}) { if (typeof data === "string") { data = Buffer.from(data); @@ -4306,7 +4306,7 @@ var parse = function(data, opts = {}) { return records; }; -// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/drawingCharacters.js +// ../../node_modules/thistogram/dist/drawingCharacters.js var BoxSymbol; (function(BoxSymbol2) { BoxSymbol2[BoxSymbol2["topLeft"] = 0] = "topLeft"; @@ -4324,7 +4324,7 @@ var BoxSymbol; var boxSymbols = ["\u250F", "\u2513", "\u251B", "\u2517", "\u2503", "\u2501", "\u2523", "\u252B", "\u253B", "\u2533", "\u254B"]; var histoCharsBottomToTop = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"]; -// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/bars.js +// ../../node_modules/thistogram/dist/bars.js function simpleHistogram(data, min, max, barChars = histoCharsBottomToTop) { const [minVal, maxVal] = minMaxRange(data, min, max); const range = maxVal - minVal || 1; @@ -4369,7 +4369,7 @@ function minMaxRange(values, min, max) { return r; } -// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/histogram.js +// ../../node_modules/thistogram/dist/histogram.js var valueMinMaxSymbols = [ "\u25CF", boxSymbols[BoxSymbol.leftT], @@ -4377,7 +4377,7 @@ var valueMinMaxSymbols = [ boxSymbols[BoxSymbol.rightT] ]; -// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/stats.js +// ../../node_modules/thistogram/dist/stats.js function calcStandardDeviation(values) { const variance = calcVariance(values); return Math.sqrt(variance); From f1d78b2aa39c2bb13383ac5600b574153cb0e43a Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 19:01:59 +0000 Subject: [PATCH 02/10] wip --- cspell.schema.json | 1 + packages/cspell-types/cspell.schema.json | 1 + .../cspell-types/src/CSpellSettingsDef.ts | 1 + packages/cspell/src/app/application.test.ts | 2 +- packages/cspell/static/help-lint.txt | 106 ------------------ 5 files changed, 4 insertions(+), 107 deletions(-) diff --git a/cspell.schema.json b/cspell.schema.json index a98dfde8852..9b85d0da0dd 100644 --- a/cspell.schema.json +++ b/cspell.schema.json @@ -40,6 +40,7 @@ "type": "object" }, "CacheStrategy": { + "default": "content", "description": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "enum": [ "content", diff --git a/packages/cspell-types/cspell.schema.json b/packages/cspell-types/cspell.schema.json index a98dfde8852..9b85d0da0dd 100644 --- a/packages/cspell-types/cspell.schema.json +++ b/packages/cspell-types/cspell.schema.json @@ -40,6 +40,7 @@ "type": "object" }, "CacheStrategy": { + "default": "content", "description": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "enum": [ "content", diff --git a/packages/cspell-types/src/CSpellSettingsDef.ts b/packages/cspell-types/src/CSpellSettingsDef.ts index cd7097409d1..ff6bf511dd8 100644 --- a/packages/cspell-types/src/CSpellSettingsDef.ts +++ b/packages/cspell-types/src/CSpellSettingsDef.ts @@ -337,6 +337,7 @@ export interface PnPSettings { * The Strategy to use to detect if a file has changed. * - `content` - uses a hash of the file content to check file changes (slower - more accurate). * - `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI). + * @default 'content' */ export type CacheStrategy = 'content' | 'metadata'; diff --git a/packages/cspell/src/app/application.test.ts b/packages/cspell/src/app/application.test.ts index 843282fcdf8..51015936170 100644 --- a/packages/cspell/src/app/application.test.ts +++ b/packages/cspell/src/app/application.test.ts @@ -257,7 +257,7 @@ describe('Linter File Caching', () => { ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.md'], WithCache, fc(1, 1)), run(['*.md'], WithCache, fc(1, 1))]} | ${fr('cached')} | ${'Single .md file cached three runs'} ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], WithCache, fc(2, 2))]} | ${fr('cached')} | ${'cached changing glob three runs'} ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], WithCacheReset, fc(2, 0))]} | ${fr('cached')} | ${'cached changing glob three runs'} - ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], CacheMetadata, fc(2, 0))]} | ${fr('cached')} | ${'with cache rebuild'} + ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCache, fc(2, 1)), run(['*.{md,ts}'], CacheMetadata, fc(2, 0))]} | ${fr('cached')} | ${'with cache rebuild'} ${[run(['*.md'], WithCache, fc(1, 0)), run(['*.{md,ts}'], WithCacheReset, fc(2, 0)), run(['*.{md,ts}'], WithCache, fc(2, 2))]} | ${fr('cached')} | ${'cached changing glob three runs'} `('lint caching with $root $comment', async ({ runs, root }: TestCase) => { const reporter = new InMemoryReporter(); diff --git a/packages/cspell/static/help-lint.txt b/packages/cspell/static/help-lint.txt index b3565c806d3..e69de29bb2d 100644 --- a/packages/cspell/static/help-lint.txt +++ b/packages/cspell/static/help-lint.txt @@ -1,106 +0,0 @@ -Usage: cspell lint [options] [globs...] [file:// ...] [stdin[://]] - -Patterns: - - [globs...] Glob Patterns - - [stdin] Read from "stdin" assume text file. - - [stdin://] Read from "stdin", use for file type and config. - - [file://] Check the file at - -Examples: - cspell . Recursively check all files. - cspell lint . The same as "cspell ." - cspell "*.js" Check all .js files in the current directory - cspell "**/*.js" Check all .js files recursively - cspell "src/**/*.js" Only check .js under src - cspell "**/*.txt" "**/*.js" Check both .js and .txt files. - cspell "**/*.{txt,js,md}" Check .txt, .js, and .md files. - cat LICENSE | cspell stdin Check stdin - cspell stdin://docs/doc.md Check stdin as if it was "./docs/doc.md" - -Check spelling - -Options: - -c, --config Configuration file to use. By default cspell - looks for cspell.json in the current directory. - -v, --verbose Display more information about the files being - checked and the configuration. - --locale Set language locales. i.e. "en,fr" for English - and French, or "en-GB" for British English. - --language-id Force programming language for unknown - extensions. i.e. "php" or "scala" - --words-only Only output the words not found in the - dictionaries. - -u, --unique Only output the first instance of a word not - found in the dictionaries. - -e, --exclude Exclude files matching the glob pattern. This - option can be used multiple times to add - multiple globs. - --file-list Specify a list of files to be spell checked. The - list is filtered against the glob file patterns. - Note: the format is 1 file path per line. - --file [file...] Specify files to spell check. They are filtered - by the [globs...]. - --no-issues Do not show the spelling errors. - --no-progress Turn off progress messages - --no-summary Turn off summary message in console. - -s, --silent Silent mode, suppress error messages. - --no-exit-code Do not return an exit code if issues are found. - --quiet Only show spelling issues or errors. - --fail-fast Exit after first file with an issue or error. - -r, --root Root directory, defaults to current directory. - --no-relative Issues are displayed with absolute path instead - of relative to the root. - --show-context Show the surrounding text around an issue. - --show-suggestions Show spelling suggestions. - --no-show-suggestions Do not show spelling suggestions or fixes. - --no-must-find-files Do not error if no files are found. - --cache Use cache to only check changed files. - --no-cache Do not use cache. - --cache-reset Reset the cache file. - --cache-strategy Strategy to use for detecting changed files. - (choices: "metadata", "content") - --cache-location Path to the cache file or directory. (default: - ".cspellcache") - --dot Include files and directories starting with `.` - (period) when matching globs. - --gitignore Ignore files matching glob patterns found in - .gitignore files. - --no-gitignore Do NOT use .gitignore files. - --gitignore-root Prevent searching for .gitignore files past - root. - --validate-directives Validate in-document CSpell directives. - --no-color Turn off color. - --color Force color. - --no-default-configuration Do not load the default configuration and - dictionaries. - --debug Output information useful for debugging - cspell.json files. - --reporter Specify one or more reporters to use. - --issue-template [template] Use a custom issue template. See --help - --issue-template for details. - -h, --help display help for command - -More Examples: - - cspell "**/*.js" --reporter @cspell/cspell-json-reporter - This will spell check all ".js" files recursively and use - "@cspell/cspell-json-reporter". - - cspell . --reporter default - This will force the default reporter to be used overriding - any reporters defined in the configuration. - - cspell . --reporter .//reporter.cjs - Use a custom reporter. See API for details. - - cspell "*.md" --exclude CHANGELOG.md --files README.md CHANGELOG.md - Spell check only check "README.md" but NOT "CHANGELOG.md". - - cspell "/*.md" --no-must-find-files --files $FILES - Only spell check the "/*.md" files in $FILES, - where $FILES is a shell variable that contains the list of files. - -References: - https://cspell.org - https://github.com/streetsidesoftware/cspell - From da8b573f8f64f8d42c1caa0eb28af7a7bf7dd553 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 19:24:47 +0000 Subject: [PATCH 03/10] Revert .github/workflows/cspell-cli.yml --- .github/workflows/cspell-cli.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cspell-cli.yml b/.github/workflows/cspell-cli.yml index fd6115661de..ca8671a8078 100644 --- a/.github/workflows/cspell-cli.yml +++ b/.github/workflows/cspell-cli.yml @@ -41,4 +41,5 @@ jobs: cspell-cache-v2-${{ runner.os }}- - name: cspell@latest - run: npx cspell@latest --cache --cache-location=.cspellcache --exclude="yarn2" --no-progress "**" + run: npx cspell@latest --cache --cache-strategy=content --cache-location=.cspellcache --exclude="yarn2" --no-progress "**" + # run: npx cspell@latest --cache --cache-strategy=content --cache-location=.cspellcache --exclude="yarn2" "**" From f4cf3a13dbaa5fe266ab2f628980d84fac943582 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 19:26:38 +0000 Subject: [PATCH 04/10] Revert cspell.schema.json --- cspell.schema.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cspell.schema.json b/cspell.schema.json index 9b85d0da0dd..605af833936 100644 --- a/cspell.schema.json +++ b/cspell.schema.json @@ -40,13 +40,12 @@ "type": "object" }, "CacheStrategy": { - "default": "content", - "description": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", + "description": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", "enum": [ - "content", - "metadata" + "metadata", + "content" ], - "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", + "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", "type": "string" }, "CharacterSet": { From 4a3ea2a07c879273d98bdfe91e1b6820300e3b86 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 22:20:33 +0000 Subject: [PATCH 05/10] Update tests --- .../cspell/src/app/__snapshots__/app.test.ts.snap | 12 ++++++++---- .../cspell/src/app/util/cache/createCache.test.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/cspell/src/app/__snapshots__/app.test.ts.snap b/packages/cspell/src/app/__snapshots__/app.test.ts.snap index daac92af1aa..947cf1be069 100644 --- a/packages/cspell/src/app/__snapshots__/app.test.ts.snap +++ b/packages/cspell/src/app/__snapshots__/app.test.ts.snap @@ -653,7 +653,8 @@ exports[`Validate cli > app 'lint --help --issue-template' Expect Error: 'output " --no-cache Do not use cache.", " --cache-reset Reset the cache file.", " --cache-strategy Strategy to use for detecting changed files.", - " (choices: "metadata", "content")", + " (choices: "content", "metadata", default:", + " "content")", " --cache-location Path to the cache file or directory. (default:", " ".cspellcache")", " --dot Include files and directories starting with \`.\`", @@ -796,7 +797,8 @@ exports[`Validate cli > app 'lint --help --verbose' Expect Error: 'outputHelp' 1 " --no-cache Do not use cache.", " --cache-reset Reset the cache file.", " --cache-strategy Strategy to use for detecting changed files.", - " (choices: "metadata", "content")", + " (choices: "content", "metadata", default:", + " "content")", " --cache-location Path to the cache file or directory. (default:", " ".cspellcache")", " --dot Include files and directories starting with \`.\`", @@ -932,7 +934,8 @@ exports[`Validate cli > app 'lint --help' Expect Error: 'outputHelp' 1`] = ` " --no-cache Do not use cache.", " --cache-reset Reset the cache file.", " --cache-strategy Strategy to use for detecting changed files.", - " (choices: "metadata", "content")", + " (choices: "content", "metadata", default:", + " "content")", " --cache-location Path to the cache file or directory. (default:", " ".cspellcache")", " --dot Include files and directories starting with \`.\`", @@ -1066,7 +1069,8 @@ exports[`Validate cli > app 'no-args' Expect Error: 'outputHelp' 1`] = ` " --no-cache Do not use cache.", " --cache-reset Reset the cache file.", " --cache-strategy Strategy to use for detecting changed files.", - " (choices: "metadata", "content")", + " (choices: "content", "metadata", default:", + " "content")", " --cache-location Path to the cache file or directory. (default:", " ".cspellcache")", " --dot Include files and directories starting with \`.\`", diff --git a/packages/cspell/src/app/util/cache/createCache.test.ts b/packages/cspell/src/app/util/cache/createCache.test.ts index 9785b037b0e..d541fe036e6 100644 --- a/packages/cspell/src/app/util/cache/createCache.test.ts +++ b/packages/cspell/src/app/util/cache/createCache.test.ts @@ -90,7 +90,7 @@ describe('validate normalizeVersion', () => { function cco( useCache = false, cacheLocation = '.cspellcache', - cacheStrategy: CreateCacheSettings['cacheStrategy'] = 'metadata', + cacheStrategy: CreateCacheSettings['cacheStrategy'] = 'content', cacheFormat: CreateCacheSettings['cacheFormat'] = 'universal', ): CreateCacheSettings { if (cacheLocation) { From 059f9ab10039d8805ce81690c369f532b5cb307c Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 22:20:44 +0000 Subject: [PATCH 06/10] Update schema --- cspell.schema.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cspell.schema.json b/cspell.schema.json index 605af833936..9b85d0da0dd 100644 --- a/cspell.schema.json +++ b/cspell.schema.json @@ -40,12 +40,13 @@ "type": "object" }, "CacheStrategy": { - "description": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", + "default": "content", + "description": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "enum": [ - "metadata", - "content" + "content", + "metadata" ], - "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `metadata` - uses the file system timestamp and size to detect changes (fastest).\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).", + "markdownDescription": "The Strategy to use to detect if a file has changed.\n- `content` - uses a hash of the file content to check file changes (slower - more accurate).\n- `metadata` - uses the file system timestamp and size to detect changes (fastest, may not work in CI).", "type": "string" }, "CharacterSet": { From a180bc5eb474fdac80299a46b839a06cdda614b5 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 22:23:57 +0000 Subject: [PATCH 07/10] Revert confusing diff --- tools/perf-chart/lib/app.cjs | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tools/perf-chart/lib/app.cjs b/tools/perf-chart/lib/app.cjs index 8627c27e346..7f5f40f1305 100644 --- a/tools/perf-chart/lib/app.cjs +++ b/tools/perf-chart/lib/app.cjs @@ -25,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge mod )); -// ../../node_modules/commander/lib/error.js +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/error.js var require_error = __commonJS({ - "../../node_modules/commander/lib/error.js"(exports2) { + "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/error.js"(exports2) { var CommanderError2 = class extends Error { /** * Constructs the CommanderError class @@ -60,9 +60,9 @@ var require_error = __commonJS({ } }); -// ../../node_modules/commander/lib/argument.js +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/argument.js var require_argument = __commonJS({ - "../../node_modules/commander/lib/argument.js"(exports2) { + "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/argument.js"(exports2) { var { InvalidArgumentError: InvalidArgumentError2 } = require_error(); var Argument2 = class { /** @@ -187,9 +187,9 @@ var require_argument = __commonJS({ } }); -// ../../node_modules/commander/lib/help.js +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/help.js var require_help = __commonJS({ - "../../node_modules/commander/lib/help.js"(exports2) { + "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/help.js"(exports2) { var { humanReadableArgName } = require_argument(); var Help2 = class { constructor() { @@ -601,9 +601,9 @@ var require_help = __commonJS({ } }); -// ../../node_modules/commander/lib/option.js +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/option.js var require_option = __commonJS({ - "../../node_modules/commander/lib/option.js"(exports2) { + "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/option.js"(exports2) { var { InvalidArgumentError: InvalidArgumentError2 } = require_error(); var Option2 = class { /** @@ -873,9 +873,9 @@ var require_option = __commonJS({ } }); -// ../../node_modules/commander/lib/suggestSimilar.js +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/suggestSimilar.js var require_suggestSimilar = __commonJS({ - "../../node_modules/commander/lib/suggestSimilar.js"(exports2) { + "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/suggestSimilar.js"(exports2) { var maxDistance = 3; function editDistance(a, b) { if (Math.abs(a.length - b.length) > maxDistance) @@ -953,9 +953,9 @@ var require_suggestSimilar = __commonJS({ } }); -// ../../node_modules/commander/lib/command.js +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js var require_command = __commonJS({ - "../../node_modules/commander/lib/command.js"(exports2) { + "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports2) { var EventEmitter = require("node:events").EventEmitter; var childProcess = require("node:child_process"); var path = require("node:path"); @@ -2996,9 +2996,9 @@ Expecting one of '${allowedValues.join("', '")}'`); } }); -// ../../node_modules/commander/index.js +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/index.js var require_commander = __commonJS({ - "../../node_modules/commander/index.js"(exports2) { + "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/index.js"(exports2) { var { Argument: Argument2 } = require_argument(); var { Command: Command2 } = require_command(); var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error(); @@ -3018,7 +3018,7 @@ var require_commander = __commonJS({ } }); -// ../../node_modules/commander/esm.mjs +// ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/esm.mjs var import_index = __toESM(require_commander(), 1); var { program, @@ -3038,7 +3038,7 @@ var { // src/perfChart.ts var import_node_fs = require("node:fs"); -// ../../node_modules/csv-parse/lib/api/CsvError.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/CsvError.js var CsvError = class _CsvError extends Error { constructor(code, message, options, ...contexts) { if (Array.isArray(message)) message = message.join(" ").trim(); @@ -3056,12 +3056,12 @@ var CsvError = class _CsvError extends Error { } }; -// ../../node_modules/csv-parse/lib/utils/is_object.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/is_object.js var is_object = function(obj) { return typeof obj === "object" && obj !== null && !Array.isArray(obj); }; -// ../../node_modules/csv-parse/lib/api/normalize_columns_array.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/normalize_columns_array.js var normalize_columns_array = function(columns) { const normalizedColumns = []; for (let i = 0, l = columns.length; i < l; i++) { @@ -3090,7 +3090,7 @@ var normalize_columns_array = function(columns) { return normalizedColumns; }; -// ../../node_modules/csv-parse/lib/utils/ResizeableBuffer.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/ResizeableBuffer.js var ResizeableBuffer = class { constructor(size = 100) { this.size = size; @@ -3154,7 +3154,7 @@ var ResizeableBuffer = class { }; var ResizeableBuffer_default = ResizeableBuffer; -// ../../node_modules/csv-parse/lib/api/init_state.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/init_state.js var np = 12; var cr = 13; var nl = 10; @@ -3203,14 +3203,14 @@ var init_state = function(options) { }; }; -// ../../node_modules/csv-parse/lib/utils/underscore.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/underscore.js var underscore = function(str) { return str.replace(/([A-Z])/g, function(_, match) { return "_" + match.toLowerCase(); }); }; -// ../../node_modules/csv-parse/lib/api/normalize_options.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/normalize_options.js var normalize_options = function(opts) { const options = {}; for (const opt in opts) { @@ -3610,7 +3610,7 @@ var normalize_options = function(opts) { return options; }; -// ../../node_modules/csv-parse/lib/api/index.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/index.js var isRecordEmpty = function(record) { return record.every((field) => field == null || field.toString && field.toString().trim() === ""); }; @@ -4283,7 +4283,7 @@ var transform = function(original_options = {}) { }; }; -// ../../node_modules/csv-parse/lib/sync.js +// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/sync.js var parse = function(data, opts = {}) { if (typeof data === "string") { data = Buffer.from(data); @@ -4306,7 +4306,7 @@ var parse = function(data, opts = {}) { return records; }; -// ../../node_modules/thistogram/dist/drawingCharacters.js +// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/drawingCharacters.js var BoxSymbol; (function(BoxSymbol2) { BoxSymbol2[BoxSymbol2["topLeft"] = 0] = "topLeft"; @@ -4324,7 +4324,7 @@ var BoxSymbol; var boxSymbols = ["\u250F", "\u2513", "\u251B", "\u2517", "\u2503", "\u2501", "\u2523", "\u252B", "\u253B", "\u2533", "\u254B"]; var histoCharsBottomToTop = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"]; -// ../../node_modules/thistogram/dist/bars.js +// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/bars.js function simpleHistogram(data, min, max, barChars = histoCharsBottomToTop) { const [minVal, maxVal] = minMaxRange(data, min, max); const range = maxVal - minVal || 1; @@ -4369,7 +4369,7 @@ function minMaxRange(values, min, max) { return r; } -// ../../node_modules/thistogram/dist/histogram.js +// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/histogram.js var valueMinMaxSymbols = [ "\u25CF", boxSymbols[BoxSymbol.leftT], @@ -4377,7 +4377,7 @@ var valueMinMaxSymbols = [ boxSymbols[BoxSymbol.rightT] ]; -// ../../node_modules/thistogram/dist/stats.js +// ../../node_modules/.pnpm/thistogram@1.1.1/node_modules/thistogram/dist/stats.js function calcStandardDeviation(values) { const variance = calcVariance(values); return Math.sqrt(variance); From 6ff55f0dad997db364b5f71911fb7935ba56d85c Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 22:24:27 +0000 Subject: [PATCH 08/10] Temporarily commit diff that helped me run build --- packages/cspell-eslint-plugin/package.json | 2 +- packages/cspell-tools/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cspell-eslint-plugin/package.json b/packages/cspell-eslint-plugin/package.json index 12fe98487e7..12b9592f957 100644 --- a/packages/cspell-eslint-plugin/package.json +++ b/packages/cspell-eslint-plugin/package.json @@ -56,7 +56,7 @@ "bt": "pnpm build && pnpm test", "build": "pnpm build:schema && pnpm build:src", "build:src": "tsc -b ./tsconfig.json -f", - "build:schema": "pnpm build-options-schema", + "build:schema": "echo skipping schema build", "build:schema:old": "ts-json-schema-generator --no-top-ref --expose none --path src/common/options.cts --type Options -o ./assets/options.schema.json", "watch": "tsc -b ./tsconfig.json --watch -f", "clean": "shx rm -rf dist temp coverage \"*.tsbuildInfo\"", diff --git a/packages/cspell-tools/package.json b/packages/cspell-tools/package.json index e599962ebec..ade63aa7c3d 100644 --- a/packages/cspell-tools/package.json +++ b/packages/cspell-tools/package.json @@ -13,7 +13,7 @@ }, "scripts": { "build": "pnpm run build-schema && pnpm run compile", - "build-schema": "ts-json-schema-generator --no-top-ref --path src/config/config.ts --type RunConfig --validation-keywords deprecated -o ./cspell-tools.config.schema.json", + "build-schema": "echo skipping schema build", "compile": "tsc -p .", "watch": "tsc -p . -w", "clean-build": "pnpm run clean && pnpm run build", From 11af5a30a036ff5ccc339e3bbcd3363f21c7e8c8 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 22:24:33 +0000 Subject: [PATCH 09/10] Revert "Temporarily commit diff that helped me run build" This reverts commit 6ff55f0dad997db364b5f71911fb7935ba56d85c. --- packages/cspell-eslint-plugin/package.json | 2 +- packages/cspell-tools/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cspell-eslint-plugin/package.json b/packages/cspell-eslint-plugin/package.json index 12b9592f957..12fe98487e7 100644 --- a/packages/cspell-eslint-plugin/package.json +++ b/packages/cspell-eslint-plugin/package.json @@ -56,7 +56,7 @@ "bt": "pnpm build && pnpm test", "build": "pnpm build:schema && pnpm build:src", "build:src": "tsc -b ./tsconfig.json -f", - "build:schema": "echo skipping schema build", + "build:schema": "pnpm build-options-schema", "build:schema:old": "ts-json-schema-generator --no-top-ref --expose none --path src/common/options.cts --type Options -o ./assets/options.schema.json", "watch": "tsc -b ./tsconfig.json --watch -f", "clean": "shx rm -rf dist temp coverage \"*.tsbuildInfo\"", diff --git a/packages/cspell-tools/package.json b/packages/cspell-tools/package.json index ade63aa7c3d..e599962ebec 100644 --- a/packages/cspell-tools/package.json +++ b/packages/cspell-tools/package.json @@ -13,7 +13,7 @@ }, "scripts": { "build": "pnpm run build-schema && pnpm run compile", - "build-schema": "echo skipping schema build", + "build-schema": "ts-json-schema-generator --no-top-ref --path src/config/config.ts --type RunConfig --validation-keywords deprecated -o ./cspell-tools.config.schema.json", "compile": "tsc -p .", "watch": "tsc -p . -w", "clean-build": "pnpm run clean && pnpm run build", From daf018ed75e9e7027f656bcbe0005117993198f1 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Mon, 4 Nov 2024 22:26:12 +0000 Subject: [PATCH 10/10] Revert diff in packages/cspell/static/help-lint.txt --- packages/cspell/static/help-lint.txt | 106 +++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/packages/cspell/static/help-lint.txt b/packages/cspell/static/help-lint.txt index e69de29bb2d..b3565c806d3 100644 --- a/packages/cspell/static/help-lint.txt +++ b/packages/cspell/static/help-lint.txt @@ -0,0 +1,106 @@ +Usage: cspell lint [options] [globs...] [file:// ...] [stdin[://]] + +Patterns: + - [globs...] Glob Patterns + - [stdin] Read from "stdin" assume text file. + - [stdin://] Read from "stdin", use for file type and config. + - [file://] Check the file at + +Examples: + cspell . Recursively check all files. + cspell lint . The same as "cspell ." + cspell "*.js" Check all .js files in the current directory + cspell "**/*.js" Check all .js files recursively + cspell "src/**/*.js" Only check .js under src + cspell "**/*.txt" "**/*.js" Check both .js and .txt files. + cspell "**/*.{txt,js,md}" Check .txt, .js, and .md files. + cat LICENSE | cspell stdin Check stdin + cspell stdin://docs/doc.md Check stdin as if it was "./docs/doc.md" + +Check spelling + +Options: + -c, --config Configuration file to use. By default cspell + looks for cspell.json in the current directory. + -v, --verbose Display more information about the files being + checked and the configuration. + --locale Set language locales. i.e. "en,fr" for English + and French, or "en-GB" for British English. + --language-id Force programming language for unknown + extensions. i.e. "php" or "scala" + --words-only Only output the words not found in the + dictionaries. + -u, --unique Only output the first instance of a word not + found in the dictionaries. + -e, --exclude Exclude files matching the glob pattern. This + option can be used multiple times to add + multiple globs. + --file-list Specify a list of files to be spell checked. The + list is filtered against the glob file patterns. + Note: the format is 1 file path per line. + --file [file...] Specify files to spell check. They are filtered + by the [globs...]. + --no-issues Do not show the spelling errors. + --no-progress Turn off progress messages + --no-summary Turn off summary message in console. + -s, --silent Silent mode, suppress error messages. + --no-exit-code Do not return an exit code if issues are found. + --quiet Only show spelling issues or errors. + --fail-fast Exit after first file with an issue or error. + -r, --root Root directory, defaults to current directory. + --no-relative Issues are displayed with absolute path instead + of relative to the root. + --show-context Show the surrounding text around an issue. + --show-suggestions Show spelling suggestions. + --no-show-suggestions Do not show spelling suggestions or fixes. + --no-must-find-files Do not error if no files are found. + --cache Use cache to only check changed files. + --no-cache Do not use cache. + --cache-reset Reset the cache file. + --cache-strategy Strategy to use for detecting changed files. + (choices: "metadata", "content") + --cache-location Path to the cache file or directory. (default: + ".cspellcache") + --dot Include files and directories starting with `.` + (period) when matching globs. + --gitignore Ignore files matching glob patterns found in + .gitignore files. + --no-gitignore Do NOT use .gitignore files. + --gitignore-root Prevent searching for .gitignore files past + root. + --validate-directives Validate in-document CSpell directives. + --no-color Turn off color. + --color Force color. + --no-default-configuration Do not load the default configuration and + dictionaries. + --debug Output information useful for debugging + cspell.json files. + --reporter Specify one or more reporters to use. + --issue-template [template] Use a custom issue template. See --help + --issue-template for details. + -h, --help display help for command + +More Examples: + + cspell "**/*.js" --reporter @cspell/cspell-json-reporter + This will spell check all ".js" files recursively and use + "@cspell/cspell-json-reporter". + + cspell . --reporter default + This will force the default reporter to be used overriding + any reporters defined in the configuration. + + cspell . --reporter .//reporter.cjs + Use a custom reporter. See API for details. + + cspell "*.md" --exclude CHANGELOG.md --files README.md CHANGELOG.md + Spell check only check "README.md" but NOT "CHANGELOG.md". + + cspell "/*.md" --no-must-find-files --files $FILES + Only spell check the "/*.md" files in $FILES, + where $FILES is a shell variable that contains the list of files. + +References: + https://cspell.org + https://github.com/streetsidesoftware/cspell +