diff --git a/configs/eslint-config-compass/index.js b/configs/eslint-config-compass/index.js index 7752482a7f9..f2c4369c006 100644 --- a/configs/eslint-config-compass/index.js +++ b/configs/eslint-config-compass/index.js @@ -25,13 +25,6 @@ const extraTsRules = { // clean those out and re-enable the rules '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-base-to-string': 'warn', - '@typescript-eslint/no-unused-vars': [ - 'error', - { - caughtErrors: 'none', // should be `'all'` - }, - ], - '@typescript-eslint/no-redundant-type-constituents': 'warn', '@typescript-eslint/unbound-method': 'warn', '@typescript-eslint/no-duplicate-type-constituents': 'warn', '@typescript-eslint/no-unsafe-declaration-merging': 'warn', diff --git a/configs/webpack-config-compass/src/util.ts b/configs/webpack-config-compass/src/util.ts index 6cc1677fb5d..651f77867d0 100644 --- a/configs/webpack-config-compass/src/util.ts +++ b/configs/webpack-config-compass/src/util.ts @@ -38,7 +38,7 @@ export function entriesToHtml( fs.statSync(maybeTemplatePath); template = maybeTemplatePath; break; - } catch (e) { + } catch { // ignore and use default template, electron renderer entry will need // at least some kind of html page provided one way or the other } diff --git a/packages/atlas-service/src/main.ts b/packages/atlas-service/src/main.ts index c5c7dd56ac4..229199e27d8 100644 --- a/packages/atlas-service/src/main.ts +++ b/packages/atlas-service/src/main.ts @@ -244,7 +244,7 @@ export class CompassAuthService { throwIfAborted(signal); try { return (await this.introspect({ signal })).active; - } catch (err) { + } catch { return false; } } diff --git a/packages/atlas-service/src/store/atlas-signin-reducer.ts b/packages/atlas-service/src/store/atlas-signin-reducer.ts index be009428054..0745d150ea6 100644 --- a/packages/atlas-service/src/store/atlas-signin-reducer.ts +++ b/packages/atlas-service/src/store/atlas-signin-reducer.ts @@ -278,7 +278,7 @@ export const restoreSignInState = (): AtlasSignInThunkAction> => { } else { dispatch({ type: AtlasSignInActions.RestoringFailed }); } - } catch (err) { + } catch { // For the initial state check if failed to check auth for any reason we // will just allow user to sign in again, ignoring the error dispatch({ type: AtlasSignInActions.RestoringFailed }); diff --git a/packages/compass-aggregations/src/modules/count-documents.ts b/packages/compass-aggregations/src/modules/count-documents.ts index b6e25d9e43b..f6c5c6972df 100644 --- a/packages/compass-aggregations/src/modules/count-documents.ts +++ b/packages/compass-aggregations/src/modules/count-documents.ts @@ -132,7 +132,7 @@ export const countDocuments = (): PipelineBuilderThunkAction> => { type: ActionTypes.CountFinished, count: Number(count), }); - } catch (e) { + } catch { dispatch({ type: ActionTypes.CountFailed, }); diff --git a/packages/compass-aggregations/src/modules/insights.ts b/packages/compass-aggregations/src/modules/insights.ts index 7a915d7ffe4..9bf8683b1ba 100644 --- a/packages/compass-aggregations/src/modules/insights.ts +++ b/packages/compass-aggregations/src/modules/insights.ts @@ -97,7 +97,7 @@ export const fetchExplainForPipeline = (): PipelineBuilderThunkAction< const explainPlan = new ExplainPlan(rawExplainPlan as Stage); dispatch({ type: FETCH_EXPLAIN_PLAN_SUCCESS, explainPlan }); ExplainFetchAbortControllerMap.delete(id); - } catch (err) { + } catch { // We are only fetching this to get information about index usage for // insight badge, if this fails for any reason: server, cancel, error // getting pipeline from state, or parsing explain plan. Whatever it is, diff --git a/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-builder.ts b/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-builder.ts index 37dfc912f4f..b946353c95a 100644 --- a/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-builder.ts +++ b/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-builder.ts @@ -96,7 +96,7 @@ export class PipelineBuilder { if (!Array.isArray(this.pipeline)) { throw new Error('Pipeline should be an array'); } - } catch (e) { + } catch { this.pipeline = null; } } diff --git a/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-parser/stage-parser.ts b/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-parser/stage-parser.ts index 167a6024f3f..14d64766200 100644 --- a/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-parser/stage-parser.ts +++ b/packages/compass-aggregations/src/modules/pipeline-builder/pipeline-parser/stage-parser.ts @@ -26,7 +26,7 @@ export function isValidStageNode(node?: t.ObjectExpression): boolean { // before validating it again parseShellBSON(generate(node)); return true; - } catch (err) { + } catch { return false; } } diff --git a/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts b/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts index 92e833f1d3c..2058bf21da0 100644 --- a/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts +++ b/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts @@ -886,13 +886,13 @@ const formatWizardValue = (value?: string): string => { let reIndented = value; try { reIndented = JSON.stringify(JSON.parse(value), null, 2); - } catch (e) { + } catch { // not valid json } try { return prettify(reIndented); - } catch (e) { + } catch { // not valid js (ie. the generated stage has placeholders for the user to fill etc ..) return reIndented; } diff --git a/packages/compass-aggregations/src/modules/search-indexes.ts b/packages/compass-aggregations/src/modules/search-indexes.ts index 2af955f551f..c29a03c3fde 100644 --- a/packages/compass-aggregations/src/modules/search-indexes.ts +++ b/packages/compass-aggregations/src/modules/search-indexes.ts @@ -109,7 +109,7 @@ export const fetchIndexes = (): PipelineBuilderThunkAction> => { type: ActionTypes.FetchIndexesFinished, indexes, }); - } catch (e) { + } catch { dispatch({ type: ActionTypes.FetchIndexesFailed, }); diff --git a/packages/compass-components/src/components/guide-cue/guide-cue-storage.ts b/packages/compass-components/src/components/guide-cue/guide-cue-storage.ts index a9e077b5ec8..53ec034550f 100644 --- a/packages/compass-components/src/components/guide-cue/guide-cue-storage.ts +++ b/packages/compass-components/src/components/guide-cue/guide-cue-storage.ts @@ -19,7 +19,7 @@ export class CompassGuideCueStorage implements GuideCueStorage { get data(): GuideCueData { try { return JSON.parse(this.storage.getItem(this.key) ?? '[]'); - } catch (e) { + } catch { return []; } } diff --git a/packages/compass-components/src/components/index-icon.tsx b/packages/compass-components/src/components/index-icon.tsx index f97e9bbd283..adc0c51b5ce 100644 --- a/packages/compass-components/src/components/index-icon.tsx +++ b/packages/compass-components/src/components/index-icon.tsx @@ -1,7 +1,7 @@ import React from 'react'; import Icon from '@leafygreen-ui/icon'; -type IndexDirection = number | unknown; +type IndexDirection = unknown; const IndexIcon = ({ className, diff --git a/packages/compass-connections/src/stores/connections-store-redux.spec.tsx b/packages/compass-connections/src/stores/connections-store-redux.spec.tsx index de86a7aecac..5d476bf6130 100644 --- a/packages/compass-connections/src/stores/connections-store-redux.spec.tsx +++ b/packages/compass-connections/src/stores/connections-store-redux.spec.tsx @@ -145,7 +145,7 @@ describe('CompassConnections store', function () { // Connect method should not reject, all the logic is encapsulated, // there is no reason to expose the error outside the store await connectPromise; - } catch (err) { + } catch { expect.fail('Expected connect() method to not throw'); } }); diff --git a/packages/compass-crud/src/components/change-view/bson-utils.ts b/packages/compass-crud/src/components/change-view/bson-utils.ts index d6e2a98561c..dbaab06abc8 100644 --- a/packages/compass-crud/src/components/change-view/bson-utils.ts +++ b/packages/compass-crud/src/components/change-view/bson-utils.ts @@ -16,12 +16,12 @@ export function stringifyBSON(value: any) { return EJSON.stringify(value); } -export function unBSON(value: any | any[]): any | any[] { +export function unBSON(value: any): any { const shape = getValueShape(value); if (shape === 'array') { return value.map(unBSON); } else if (shape === 'object') { - const mapped: Record = {}; + const mapped: Record = {}; for (const [k, v] of Object.entries(value)) { mapped[k] = unBSON(v); } diff --git a/packages/compass-crud/src/components/change-view/unified-document.ts b/packages/compass-crud/src/components/change-view/unified-document.ts index fbef33f0e41..581f08fd12b 100644 --- a/packages/compass-crud/src/components/change-view/unified-document.ts +++ b/packages/compass-crud/src/components/change-view/unified-document.ts @@ -97,7 +97,7 @@ export type ArrayItemBranch = UnifiedBranch & { export type Branch = { path: ObjectPath; - value: any | any[]; + value: any; }; export type BranchesWithChanges = { diff --git a/packages/compass-crud/src/components/table-view/cell-editor.tsx b/packages/compass-crud/src/components/table-view/cell-editor.tsx index 6f3877df56d..b343dd970c6 100644 --- a/packages/compass-crud/src/components/table-view/cell-editor.tsx +++ b/packages/compass-crud/src/components/table-view/cell-editor.tsx @@ -347,7 +347,7 @@ class CellEditor _pasteEdit(value: string) { try { this.editor().paste(value); - } catch (e) { + } catch { this.editor().edit(value); } finally { this._pasting = false; diff --git a/packages/compass-crud/src/stores/crud-store.spec.ts b/packages/compass-crud/src/stores/crud-store.spec.ts index 4b0459595d1..87f084f5c11 100644 --- a/packages/compass-crud/src/stores/crud-store.spec.ts +++ b/packages/compass-crud/src/stores/crud-store.spec.ts @@ -211,7 +211,7 @@ describe('store', function () { try { await dataService.dropCollection('compass-crud.test'); - } catch (err) { + } catch { // noop } @@ -357,7 +357,7 @@ describe('store', function () { writeText: mockCopyToClipboard, }, }); - } catch (e) { + } catch { // Electron has the global navigator as a getter. sinon.replaceGetter(global as any, 'navigator', () => ({ clipboard: { @@ -1836,7 +1836,7 @@ describe('store', function () { try { await dataService.dropCollection('compass-crud.timeseries'); - } catch (err) { + } catch { // noop } diff --git a/packages/compass-crud/src/stores/crud-store.ts b/packages/compass-crud/src/stores/crud-store.ts index 055a5eff17f..c2c98a61370 100644 --- a/packages/compass-crud/src/stores/crud-store.ts +++ b/packages/compass-crud/src/stores/crud-store.ts @@ -1216,7 +1216,7 @@ class CrudStoreImpl let update; try { update = parseShellBSON(this.state.bulkUpdate.updateText); - } catch (err) { + } catch { // If this couldn't parse then the update button should have been // disabled. So if we get here it is a race condition and ignoring is // probably OK - the button will soon appear disabled to the user anyway. @@ -1978,7 +1978,7 @@ class CrudStoreImpl let update; try { update = parseShellBSON(this.state.bulkUpdate.updateText); - } catch (err) { + } catch { // If this couldn't parse then the update button should have been // disabled. So if we get here it is a race condition and ignoring is // probably OK - the button will soon appear disabled to the user anyway. @@ -2193,7 +2193,7 @@ export async function findAndModifyWithFLEFallback( { promoteValues: false } ); return [undefined, docs[0]] as ErrorOrResult; - } catch (e) { + } catch { /* fallthrough */ } } diff --git a/packages/compass-crud/src/utils/cancellable-queries.spec.ts b/packages/compass-crud/src/utils/cancellable-queries.spec.ts index 5db15055ff7..ef7530cef12 100644 --- a/packages/compass-crud/src/utils/cancellable-queries.spec.ts +++ b/packages/compass-crud/src/utils/cancellable-queries.spec.ts @@ -33,14 +33,14 @@ describe('cancellable-queries', function () { try { await dataService.dropCollection('cancel.numbers'); - } catch (err) { + } catch { // noop } await dataService.insertMany('cancel.numbers', docs, {}); try { await dataService.dropCollection('cancel.empty'); - } catch (err) { + } catch { // noop } await dataService.createCollection('cancel.empty', {}); @@ -60,7 +60,7 @@ describe('cancellable-queries', function () { if (dataService) { try { await dataService.disconnect(); - } catch (err) { + } catch { // ignore } } diff --git a/packages/compass-data-modeling/src/services/data-model-storage-electron.tsx b/packages/compass-data-modeling/src/services/data-model-storage-electron.tsx index 0aa5feaf277..29c23458f3e 100644 --- a/packages/compass-data-modeling/src/services/data-model-storage-electron.tsx +++ b/packages/compass-data-modeling/src/services/data-model-storage-electron.tsx @@ -25,7 +25,7 @@ class DataModelStorageElectron implements DataModelStorage { try { const res = await this.userData.readAll(); return res.data; - } catch (err) { + } catch { return []; } } diff --git a/packages/compass-data-modeling/src/store/diagram.ts b/packages/compass-data-modeling/src/store/diagram.ts index 2b86d1efa3a..65c215a0d16 100644 --- a/packages/compass-data-modeling/src/store/diagram.ts +++ b/packages/compass-data-modeling/src/store/diagram.ts @@ -273,7 +273,7 @@ export function renameDiagram( } dispatch({ type: DiagramActionTypes.RENAME_DIAGRAM, id, name: newName }); void dataModelStorage.save({ ...diagram, name: newName }); - } catch (err) { + } catch { // TODO log } }; diff --git a/packages/compass-e2e-tests/helpers/commands/exists-eventually.ts b/packages/compass-e2e-tests/helpers/commands/exists-eventually.ts index 2983d64bfb8..81eef398078 100644 --- a/packages/compass-e2e-tests/helpers/commands/exists-eventually.ts +++ b/packages/compass-e2e-tests/helpers/commands/exists-eventually.ts @@ -12,7 +12,7 @@ export async function existsEventually( typeof timeout !== 'undefined' ? { timeout } : undefined ); return true; - } catch (err) { + } catch { // return false if not return false; } diff --git a/packages/compass-e2e-tests/helpers/commands/screenshot.ts b/packages/compass-e2e-tests/helpers/commands/screenshot.ts index 8e840db9200..08d4d7ed294 100644 --- a/packages/compass-e2e-tests/helpers/commands/screenshot.ts +++ b/packages/compass-e2e-tests/helpers/commands/screenshot.ts @@ -29,7 +29,7 @@ export async function screenshot( const fullPath = path.join(LOG_SCREENSHOTS_PATH, filename); try { await withTimeout(10000, browser.saveScreenshot(fullPath)); - } catch (err: any) { + } catch { // For some reason browser.saveScreenshot() sometimes times out on mac with // `WARN webdriver: Request timed out! Consider increasing the // "connectionRetryTimeout" option.`. The default is 120 seconds. diff --git a/packages/compass-e2e-tests/helpers/commands/shell-eval.ts b/packages/compass-e2e-tests/helpers/commands/shell-eval.ts index 5ab994decd4..d0392c5300a 100644 --- a/packages/compass-e2e-tests/helpers/commands/shell-eval.ts +++ b/packages/compass-e2e-tests/helpers/commands/shell-eval.ts @@ -59,7 +59,7 @@ export async function shellEval( if (parse === true) { try { result = JSON.parse(result); - } catch (err) { + } catch { // just leave it unparsed for now if there's a parse error because // that's really helpful when debugging console.error('Could not parse result:', result); diff --git a/packages/compass-e2e-tests/helpers/compass.ts b/packages/compass-e2e-tests/helpers/compass.ts index 0a954f43f1b..919ef2650f6 100644 --- a/packages/compass-e2e-tests/helpers/compass.ts +++ b/packages/compass-e2e-tests/helpers/compass.ts @@ -200,7 +200,7 @@ export class Compass { let value; try { value = await arg.jsonValue(); - } catch (err) { + } catch { // there are still some edge cases we can't easily convert into text console.error('could not convert', arg); value = '¯\\_(ツ)_/¯'; @@ -989,7 +989,7 @@ export async function buildCompass( try { await getCompassBuildMetadata(); return; - } catch (e) { + } catch { /* ignore */ } @@ -1137,7 +1137,7 @@ export async function cleanup(compass?: Compass): Promise { try { // make sure the process can exit await compass.browser.deleteSession({ shutdownDriver: true }); - } catch (_) { + } catch { debug('browser already closed'); } } diff --git a/packages/compass-e2e-tests/helpers/test-runner-global-fixtures.ts b/packages/compass-e2e-tests/helpers/test-runner-global-fixtures.ts index a2bd3e751e2..d710b4c0c94 100644 --- a/packages/compass-e2e-tests/helpers/test-runner-global-fixtures.ts +++ b/packages/compass-e2e-tests/helpers/test-runner-global-fixtures.ts @@ -131,7 +131,7 @@ export async function mochaGlobalSetup(this: Mocha.Runner) { try { debug('Clearing out past logs'); fs.rmdirSync(LOG_PATH, { recursive: true }); - } catch (e) { + } catch { debug('.log dir already removed'); } diff --git a/packages/compass-e2e-tests/tests/in-use-encryption.test.ts b/packages/compass-e2e-tests/tests/in-use-encryption.test.ts index efaa2a86376..790314c97e7 100644 --- a/packages/compass-e2e-tests/tests/in-use-encryption.test.ts +++ b/packages/compass-e2e-tests/tests/in-use-encryption.test.ts @@ -575,7 +575,7 @@ describe('CSFLE / QE', function () { // present and smaller than the default one to allow for tests to // proceed correctly await footer.waitForDisplayed({ reverse: true, timeout: 10000 }); - } catch (err) { + } catch { if ( mode === 'unindexed' && (await footer.getText()) === diff --git a/packages/compass-e2e-tests/tests/search-indexes.test.ts b/packages/compass-e2e-tests/tests/search-indexes.test.ts index b8c5285d13d..841f21937f2 100644 --- a/packages/compass-e2e-tests/tests/search-indexes.test.ts +++ b/packages/compass-e2e-tests/tests/search-indexes.test.ts @@ -185,7 +185,7 @@ describe('Search Indexes', function () { // Try to delete a namespace if it exists try { await dbInstance.dropCollection(collectionName); - } catch (e) { + } catch { // noop } @@ -210,7 +210,7 @@ describe('Search Indexes', function () { { try { await dbInstance.dropCollection(collectionName); - } catch (e) { + } catch { console.log(`Failed to drop collection: ${DB_NAME}.${collectionName}`); } } diff --git a/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts b/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts index 3fedc6ecb4f..50e4d00cfa4 100644 --- a/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts +++ b/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts @@ -49,7 +49,7 @@ export type ExplainPlanModalState = { isModalOpen: boolean; status: 'initial' | 'loading' | 'ready' | 'error'; explainPlan: SerializedExplainPlan | null; - rawExplainPlan: unknown | null; + rawExplainPlan: unknown; explainPlanFetchId: number; }; diff --git a/packages/compass-export-to-language/src/components/modal.tsx b/packages/compass-export-to-language/src/components/modal.tsx index fde05818137..f5d650bdf4d 100644 --- a/packages/compass-export-to-language/src/components/modal.tsx +++ b/packages/compass-export-to-language/src/components/modal.tsx @@ -89,7 +89,7 @@ function stageCountForTelemetry(inputExpression: InputExpression) { return { num_stages: countAggregationStagesInString(inputExpression.aggregation), }; - } catch (ignore) { + } catch { // Things like [{ $match: { x: NumberInt(10) } }] do not evaluate in any kind of context return { num_stages: -1 }; } diff --git a/packages/compass-export-to-language/src/stores/index.ts b/packages/compass-export-to-language/src/stores/index.ts index 1c3cd57de51..7e484882966 100644 --- a/packages/compass-export-to-language/src/stores/index.ts +++ b/packages/compass-export-to-language/src/stores/index.ts @@ -74,7 +74,7 @@ function getCurrentlyConnectedUri( try { connectionStringUrl = dataService.getConnectionString().clone(); - } catch (e) { + } catch { return ''; } diff --git a/packages/compass-generative-ai/src/atlas-ai-service.ts b/packages/compass-generative-ai/src/atlas-ai-service.ts index 0a9c56a1a89..d504c1fcc9a 100644 --- a/packages/compass-generative-ai/src/atlas-ai-service.ts +++ b/packages/compass-generative-ai/src/atlas-ai-service.ts @@ -342,7 +342,7 @@ export class AtlasAiService { let data; try { data = JSON.parse(text); - } catch (e) { + } catch { this.logger.log.info( this.logger.mongoLogId(1_001_000_310), 'AtlasAIService', diff --git a/packages/compass-import-export/src/csv/csv-utils.ts b/packages/compass-import-export/src/csv/csv-utils.ts index f55fd38b7c9..a04ed0c1875 100644 --- a/packages/compass-import-export/src/csv/csv-utils.ts +++ b/packages/compass-import-export/src/csv/csv-utils.ts @@ -204,7 +204,7 @@ function isEJSON(value: string) { ) { try { JSON.parse(value); - } catch (err) { + } catch { return false; } return true; @@ -254,7 +254,7 @@ export function detectCSVFieldType( let number; try { number = BigInt(value); - } catch (err) { + } catch { // just in case something makes it past the regex by accident return 'string'; } diff --git a/packages/compass-import-export/src/export/export-csv.spec.ts b/packages/compass-import-export/src/export/export-csv.spec.ts index df823428fda..affaeee193b 100644 --- a/packages/compass-import-export/src/export/export-csv.spec.ts +++ b/packages/compass-import-export/src/export/export-csv.spec.ts @@ -48,7 +48,7 @@ describe('exportCSV', function () { try { await dataService.dropCollection('db.col'); - } catch (err) { + } catch { // ignore } await dataService.createCollection('db.col', {}); @@ -57,7 +57,7 @@ describe('exportCSV', function () { afterEach(async function () { try { await dataService.disconnect(); - } catch (err) { + } catch { // ignore } }); diff --git a/packages/compass-import-export/src/export/export-json.spec.ts b/packages/compass-import-export/src/export/export-json.spec.ts index 9bec557bb3c..516b9f380a0 100644 --- a/packages/compass-import-export/src/export/export-json.spec.ts +++ b/packages/compass-import-export/src/export/export-json.spec.ts @@ -59,7 +59,7 @@ describe('exportJSON', function () { try { await dataService.dropCollection(testNS); - } catch (err) { + } catch { // ignore } await dataService.createCollection(testNS, {}); @@ -277,7 +277,7 @@ describe('exportJSON', function () { try { await fs.promises.readFile(resultPath, 'utf8'); expect.fail('Expected file to not exist'); - } catch (err) { + } catch { // noop } // close the stream so that afterEach hook can clear the tmpdir @@ -313,7 +313,7 @@ describe('exportJSON', function () { try { JSON.parse(data); expect.fail('Expected file to not be valid JSON'); - } catch (err) { + } catch { // With signal part of streams pipeline the file is created and if // the signal is aborted the stream is destroyed and file is not // writable anymore and as a result its not able to write trailing ] to the file. diff --git a/packages/compass-import-export/src/export/gather-fields.spec.ts b/packages/compass-import-export/src/export/gather-fields.spec.ts index 6fb03765ae6..b5c6807bc09 100644 --- a/packages/compass-import-export/src/export/gather-fields.spec.ts +++ b/packages/compass-import-export/src/export/gather-fields.spec.ts @@ -47,7 +47,7 @@ describe('gatherFields', function () { try { await dataService.dropCollection(testNS); - } catch (err) { + } catch { // ignore } await dataService.createCollection(testNS, {}); @@ -56,7 +56,7 @@ describe('gatherFields', function () { afterEach(async function () { try { await dataService.disconnect(); - } catch (err) { + } catch { // ignore } }); diff --git a/packages/compass-import-export/src/import/import-csv.spec.ts b/packages/compass-import-export/src/import/import-csv.spec.ts index 3c4c4353014..5f509992796 100644 --- a/packages/compass-import-export/src/import/import-csv.spec.ts +++ b/packages/compass-import-export/src/import/import-csv.spec.ts @@ -47,7 +47,7 @@ describe('importCSV', function () { try { await dataService.dropCollection('db.col'); - } catch (err) { + } catch { // ignore } await dataService.createCollection('db.col', {}); @@ -56,7 +56,7 @@ describe('importCSV', function () { afterEach(async function () { try { await dataService.disconnect(); - } catch (err) { + } catch { // ignore } }); diff --git a/packages/compass-import-export/src/import/import-json.spec.ts b/packages/compass-import-export/src/import/import-json.spec.ts index 24a0a3772d9..bb684403a1a 100644 --- a/packages/compass-import-export/src/import/import-json.spec.ts +++ b/packages/compass-import-export/src/import/import-json.spec.ts @@ -43,7 +43,7 @@ describe('importJSON', function () { try { await dataService.dropCollection('db.col'); - } catch (err) { + } catch { // ignore } await dataService.createCollection('db.col', {}); @@ -52,7 +52,7 @@ describe('importJSON', function () { afterEach(async function () { try { await dataService.disconnect(); - } catch (err) { + } catch { // ignore } }); diff --git a/packages/compass-import-export/src/import/import-utils.ts b/packages/compass-import-export/src/import/import-utils.ts index 5d31b078830..2d454a353df 100644 --- a/packages/compass-import-export/src/import/import-utils.ts +++ b/packages/compass-import-export/src/import/import-utils.ts @@ -97,7 +97,7 @@ export class DocStatsCollector { this.stats.biggestDocSize, docString.length ); - } catch (error) { + } catch { // We ignore the JSON stringification error } } diff --git a/packages/compass-import-export/src/modules/export.spec.ts b/packages/compass-import-export/src/modules/export.spec.ts index 5061b5c4383..82c80aac41c 100644 --- a/packages/compass-import-export/src/modules/export.spec.ts +++ b/packages/compass-import-export/src/modules/export.spec.ts @@ -317,7 +317,7 @@ describe('export [module]', function () { try { await dataService.dropCollection(testNS); - } catch (err) { + } catch { // ignore } await dataService.createCollection(testNS, {}); diff --git a/packages/compass-indexes/src/components/create-index-form/query-flow-section.tsx b/packages/compass-indexes/src/components/create-index-form/query-flow-section.tsx index 89c7ae3649c..2d02174dd55 100644 --- a/packages/compass-indexes/src/components/create-index-form/query-flow-section.tsx +++ b/packages/compass-indexes/src/components/create-index-form/query-flow-section.tsx @@ -178,7 +178,7 @@ const QueryFlowSection = ({ if (!inputQuery.startsWith('{') || !inputQuery.endsWith('}')) { _isShowSuggestionsButtonDisabled = true; } - } catch (e) { + } catch { _isShowSuggestionsButtonDisabled = true; } finally { setIsShowSuggestionsButtonDisabled(_isShowSuggestionsButtonDisabled); diff --git a/packages/compass-indexes/src/components/regular-indexes-table/regular-index-actions.tsx b/packages/compass-indexes/src/components/regular-indexes-table/regular-index-actions.tsx index 3b8752fdea2..891d224c7e8 100644 --- a/packages/compass-indexes/src/components/regular-indexes-table/regular-index-actions.tsx +++ b/packages/compass-indexes/src/components/regular-indexes-table/regular-index-actions.tsx @@ -30,7 +30,7 @@ const MIN_HIDE_INDEX_SERVER_VERSION = '4.4.0'; const serverSupportsHideIndex = (serverVersion: string) => { try { return semver.gte(serverVersion, MIN_HIDE_INDEX_SERVER_VERSION); - } catch (e) { + } catch { return true; } }; diff --git a/packages/compass-indexes/src/modules/create-index.tsx b/packages/compass-indexes/src/modules/create-index.tsx index 6f169d460bc..4e239d7f8e0 100644 --- a/packages/compass-indexes/src/modules/create-index.tsx +++ b/packages/compass-indexes/src/modules/create-index.tsx @@ -405,7 +405,7 @@ export const fetchIndexSuggestions = ({ try { sampleDocuments = (await dataService.sample(namespace, { size: 50 })) || []; - } catch (e) { + } catch { // Swallow the error because mql package still will work fine with empty sampleDocuments sampleDocuments = []; } diff --git a/packages/compass-indexes/src/utils/columnstore-indexes.ts b/packages/compass-indexes/src/utils/columnstore-indexes.ts index 695c72fd522..6fc2926ff5d 100644 --- a/packages/compass-indexes/src/utils/columnstore-indexes.ts +++ b/packages/compass-indexes/src/utils/columnstore-indexes.ts @@ -19,7 +19,7 @@ export function hasColumnstoreIndexesSupport( } try { return semver.gte(serverVersion, MIN_COLUMNSTORE_INDEXES_SERVER_VERSION); - } catch (e) { + } catch { return true; } } diff --git a/packages/compass-indexes/src/utils/vector-search-indexes.ts b/packages/compass-indexes/src/utils/vector-search-indexes.ts index a1b6fc40b74..da32e38174e 100644 --- a/packages/compass-indexes/src/utils/vector-search-indexes.ts +++ b/packages/compass-indexes/src/utils/vector-search-indexes.ts @@ -13,7 +13,7 @@ export function isAtlasVectorSearchSupportedForServerVersion( semver.gte(serverVersion, '7.0.2') || (semver.gte(serverVersion, '6.0.11') && semver.lt(serverVersion, '7.0.0')) ); - } catch (e) { + } catch { return true; } } diff --git a/packages/compass-schema-validation/src/modules/sample-documents.ts b/packages/compass-schema-validation/src/modules/sample-documents.ts index e822f80a2cf..01183789c64 100644 --- a/packages/compass-schema-validation/src/modules/sample-documents.ts +++ b/packages/compass-schema-validation/src/modules/sample-documents.ts @@ -281,7 +281,7 @@ const fetchValidDocument = ({ )[0]; dispatch(fetchedValidDocument(valid)); - } catch (e) { + } catch { dispatch(fetchingValidDocumentFailed()); } }; @@ -309,7 +309,7 @@ const fetchInvalidDocument = ({ )[0]; dispatch(fetchedInvalidDocument(invalid)); - } catch (e) { + } catch { dispatch(fetchingInvalidDocumentFailed()); } }; diff --git a/packages/compass-schema-validation/src/modules/validation.ts b/packages/compass-schema-validation/src/modules/validation.ts index 55df3d2dadc..608746d7357 100644 --- a/packages/compass-schema-validation/src/modules/validation.ts +++ b/packages/compass-schema-validation/src/modules/validation.ts @@ -541,7 +541,7 @@ export const hasErrorAndLogValidationActionSupport = ( ) => { try { return semver.gte(serverVersion, '8.1.0-rc.0'); - } catch (err) { + } catch { return false; } }; diff --git a/packages/compass-shell/src/modules/history-storage.ts b/packages/compass-shell/src/modules/history-storage.ts index db47c66169c..f302a2cf892 100644 --- a/packages/compass-shell/src/modules/history-storage.ts +++ b/packages/compass-shell/src/modules/history-storage.ts @@ -34,7 +34,7 @@ export class HistoryStorage { async load(): Promise { try { return (await this.userData.readOne(this.fileName)) ?? []; - } catch (e) { + } catch { return []; } } diff --git a/packages/compass-sidebar/src/components/navigation-items-filter.tsx b/packages/compass-sidebar/src/components/navigation-items-filter.tsx index a655ff17a48..4b10ef53ba2 100644 --- a/packages/compass-sidebar/src/components/navigation-items-filter.tsx +++ b/packages/compass-sidebar/src/components/navigation-items-filter.tsx @@ -19,7 +19,7 @@ const textInputStyles = css({ function createRegExp(input: string) { try { return input ? new RegExp(input, 'i') : null; - } catch (e) { + } catch { return null; } } diff --git a/packages/compass-web/polyfills/dns/index.ts b/packages/compass-web/polyfills/dns/index.ts index 7151958c6c2..4345074c955 100644 --- a/packages/compass-web/polyfills/dns/index.ts +++ b/packages/compass-web/polyfills/dns/index.ts @@ -8,7 +8,7 @@ const dohEndpoints = process.env.COMPASS_WEB_DOH_ENDPOINT ?? [ export function resolveSrv( hostname: string, - cb: (err: null | any, answers?: any[]) => void + cb: (err: any, answers?: any[]) => void ) { query( { question: { type: 'SRV', name: hostname } }, @@ -29,7 +29,7 @@ export function resolveSrv( } export function resolveTxt( hostname: string, - cb: (err: null | any, answers?: string[][]) => void + cb: (err: any, answers?: string[][]) => void ) { lookupTxt(hostname, { endpoints: dohEndpoints }).then(({ entries }) => { const res = entries.map((entry) => { diff --git a/packages/compass-web/sandbox/sandbox-connection-storage.tsx b/packages/compass-web/sandbox/sandbox-connection-storage.tsx index 475af237f30..aae40bd3da4 100644 --- a/packages/compass-web/sandbox/sandbox-connection-storage.tsx +++ b/packages/compass-web/sandbox/sandbox-connection-storage.tsx @@ -15,7 +15,7 @@ function getHistory(): ConnectionInfo[] { const bytes = Uint8Array.from(binStr, (v) => v.codePointAt(0) ?? 0); const str = new TextDecoder().decode(bytes); return JSON.parse(str); - } catch (err) { + } catch { return []; } } @@ -25,7 +25,7 @@ function saveHistory(history: ConnectionInfo[]) { const binStr = String.fromCodePoint(...bytes); const b64Str = window.btoa(binStr); localStorage.setItem(historyKey, b64Str); - } catch (err) { + } catch { // noop } } diff --git a/packages/compass-welcome/src/components/desktop-welcome-tab.spec.tsx b/packages/compass-welcome/src/components/desktop-welcome-tab.spec.tsx index 0f40d41ea67..ca9693a8757 100644 --- a/packages/compass-welcome/src/components/desktop-welcome-tab.spec.tsx +++ b/packages/compass-welcome/src/components/desktop-welcome-tab.spec.tsx @@ -27,7 +27,7 @@ describe('DesktopWelcomeTab', function () { try { screen.getByTestId('add-new-connection-button'); expect.fail('add-new-connection-button should not be rendered'); - } catch (e) { + } catch { // noop } }); diff --git a/packages/compass-welcome/src/components/web-welcome-tab.spec.tsx b/packages/compass-welcome/src/components/web-welcome-tab.spec.tsx index 17344a10a06..66b013b217e 100644 --- a/packages/compass-welcome/src/components/web-welcome-tab.spec.tsx +++ b/packages/compass-welcome/src/components/web-welcome-tab.spec.tsx @@ -54,7 +54,7 @@ describe('WebWelcomeTab', function () { try { screen.getByTestId('add-new-atlas-cluster-button'); expect.fail('add-new-atlas-cluster-button should not be rendered'); - } catch (e) { + } catch { // noop } }); diff --git a/packages/compass/src/main/auto-update-manager.ts b/packages/compass/src/main/auto-update-manager.ts index da043559d99..3735c860ae7 100644 --- a/packages/compass/src/main/auto-update-manager.ts +++ b/packages/compass/src/main/auto-update-manager.ts @@ -765,7 +765,7 @@ class CompassAutoUpdateManager { private static currentActionAbortController: AbortController = new AbortController(); - private static currentStateTransition: Promise | undefined; + private static currentStateTransition: Promise | undefined; static setState(newState: AutoUpdateManagerState, ...args: unknown[]) { // State update was aborted outside state transition loop. This indicates diff --git a/packages/compass/src/main/validate-connection-string.ts b/packages/compass/src/main/validate-connection-string.ts index cff943505fa..d18ec94615c 100644 --- a/packages/compass/src/main/validate-connection-string.ts +++ b/packages/compass/src/main/validate-connection-string.ts @@ -176,7 +176,7 @@ export function hasDisallowedConnectionStringOptions( connectionStringUrl = new ConnectionStringUrl(connectionString, { looseValidation: false, }); - } catch (error) { + } catch { return true; } diff --git a/packages/compass/src/main/window-manager.ts b/packages/compass/src/main/window-manager.ts index f74a9947b59..b904f91537f 100644 --- a/packages/compass/src/main/window-manager.ts +++ b/packages/compass/src/main/window-manager.ts @@ -221,7 +221,7 @@ async function onAppReady() { ); try { await installDevtools(REACT_DEVELOPER_TOOLS); - } catch (e) { + } catch { // noop } } diff --git a/packages/connection-form/src/components/advanced-options-tabs/advanced-options-tabs.tsx b/packages/connection-form/src/components/advanced-options-tabs/advanced-options-tabs.tsx index 149f740a1a3..f224af19493 100644 --- a/packages/connection-form/src/components/advanced-options-tabs/advanced-options-tabs.tsx +++ b/packages/connection-form/src/components/advanced-options-tabs/advanced-options-tabs.tsx @@ -100,7 +100,7 @@ function AdvancedOptionsTabs({ return new ConnectionStringUrl(connectionOptions.connectionString, { looseValidation: true, }); - } catch (e) { + } catch { // Return default connection string url when can't be parsed. return new ConnectionStringUrl(defaultConnectionString); } diff --git a/packages/connection-form/src/components/advanced-options-tabs/authentication-tab/authentication-oidc.spec.tsx b/packages/connection-form/src/components/advanced-options-tabs/authentication-tab/authentication-oidc.spec.tsx index 3911aa751ba..86858f496e0 100644 --- a/packages/connection-form/src/components/advanced-options-tabs/authentication-tab/authentication-oidc.spec.tsx +++ b/packages/connection-form/src/components/advanced-options-tabs/authentication-tab/authentication-oidc.spec.tsx @@ -78,7 +78,7 @@ describe('Authentication OIDC Connection Form', function () { fireEvent.click(screen.getByTestId('connect-button')); try { await waitFor(() => expect(connectSpy).to.have.been.calledOnce); - } catch (e) { + } catch { // this only finds something if it is a validation error const errors = screen.getByTestId( 'connection-error-summary' diff --git a/packages/connection-form/src/components/advanced-options-tabs/csfle-tab/csfle-tab.spec.tsx b/packages/connection-form/src/components/advanced-options-tabs/csfle-tab/csfle-tab.spec.tsx index 7a4375824cf..e3c53b93fe2 100644 --- a/packages/connection-form/src/components/advanced-options-tabs/csfle-tab/csfle-tab.spec.tsx +++ b/packages/connection-form/src/components/advanced-options-tabs/csfle-tab/csfle-tab.spec.tsx @@ -64,7 +64,7 @@ describe('In-Use Encryption', function () { fireEvent.click(screen.getByTestId('connect-button')); try { await waitFor(() => expect(connectSpy).to.have.been.calledOnce); - } catch (e) { + } catch { const errors = screen.getByTestId( 'connection-error-summary' ).textContent; diff --git a/packages/connection-form/src/components/connection-form.tsx b/packages/connection-form/src/components/connection-form.tsx index 660bb426ac0..2cbb4c19a8a 100644 --- a/packages/connection-form/src/components/connection-form.tsx +++ b/packages/connection-form/src/components/connection-form.tsx @@ -151,7 +151,10 @@ const colorPreviewStyles = css({ type ColorCircleGlyphProps = { hexColor?: string }; export const ColorCircleGlyph = createGlyphComponent( 'ColorCircle', - ({ hexColor, ...props }: any & ColorCircleGlyphProps) => ( + ({ + hexColor, + ...props + }: ColorCircleGlyphProps & React.SVGProps) => ( ( authMechanismPropertiesString ); - } catch (e) { + } catch { return new CommaAndColonSeparatedRecord(); } } diff --git a/packages/connection-form/src/utils/validation.ts b/packages/connection-form/src/utils/validation.ts index 42d8beb09d1..6d70edff63f 100644 --- a/packages/connection-form/src/utils/validation.ts +++ b/packages/connection-form/src/utils/validation.ts @@ -342,7 +342,7 @@ export function validateConnectionOptionsWarnings( looseValidation: true, } ); - } catch (err: unknown) { + } catch { return []; } diff --git a/packages/connection-info/src/connection-title.ts b/packages/connection-info/src/connection-title.ts index cf7aaf39466..696e19449b5 100644 --- a/packages/connection-info/src/connection-title.ts +++ b/packages/connection-info/src/connection-title.ts @@ -28,7 +28,7 @@ export function getConnectionTitle(info: ConnectionInfoForTitle): string { try { const url = new ConnectionString(info.connectionOptions.connectionString); title = url.hosts.join(','); - } catch (e) { + } catch { // When parsing a connection for its title fails we default the title. title = info.connectionOptions.connectionString || 'Connection'; } diff --git a/packages/connection-storage/src/compass-main-connection-storage.spec.ts b/packages/connection-storage/src/compass-main-connection-storage.spec.ts index a52a740128e..3cb992a386d 100644 --- a/packages/connection-storage/src/compass-main-connection-storage.spec.ts +++ b/packages/connection-storage/src/compass-main-connection-storage.spec.ts @@ -1415,7 +1415,7 @@ describe('ConnectionStorage', function () { expect.fail( 'Did not expect auto connect info to be saved but it was' ); - } catch (error) { + } catch { // } }); diff --git a/packages/connection-storage/src/compass-main-connection-storage.ts b/packages/connection-storage/src/compass-main-connection-storage.ts index 7d089c83893..ade7c9e9e6e 100644 --- a/packages/connection-storage/src/compass-main-connection-storage.ts +++ b/packages/connection-storage/src/compass-main-connection-storage.ts @@ -345,7 +345,7 @@ class CompassMainConnectionStorage implements ConnectionStorage { return legacyConnections.map((x) => ({ name: x.name!, })); - } catch (e) { + } catch { return []; } } diff --git a/packages/connection-storage/src/utils.ts b/packages/connection-storage/src/utils.ts index c24eca2844a..1c46de6c12e 100644 --- a/packages/connection-storage/src/utils.ts +++ b/packages/connection-storage/src/utils.ts @@ -46,7 +46,7 @@ export const parseStoredPassword = ( ): ConnectionSecrets | undefined => { try { return JSON.parse(password).secrets; - } catch (e) { + } catch { return undefined; } }; diff --git a/packages/data-service/src/data-service.ts b/packages/data-service/src/data-service.ts index 1e7739c583d..17bb28287bb 100644 --- a/packages/data-service/src/data-service.ts +++ b/packages/data-service/src/data-service.ts @@ -938,7 +938,7 @@ function op( pickLogAttrs: ( args: T, result?: K extends Promise ? R : K - ) => unknown | undefined = maybePickNs + ) => unknown = maybePickNs ) { return function ( target: (this: WithLogContext, ...args: T) => K, @@ -1825,7 +1825,7 @@ class DataServiceImpl extends WithLogContext implements DataService { async isListSearchIndexesSupported(ns: string): Promise { try { await this.getSearchIndexes(ns); - } catch (err) { + } catch { return false; } return true; diff --git a/packages/data-service/src/run-command.ts b/packages/data-service/src/run-command.ts index b31c22f2811..e478b064ad4 100644 --- a/packages/data-service/src/run-command.ts +++ b/packages/data-service/src/run-command.ts @@ -187,7 +187,7 @@ export type ListDatabasesResult = export type CollectionInfoNameOnly = { name: string; - type?: 'collection' | 'view' | 'timeseries' | string; + type?: string; }; export type CollectionInfo = CollectionInfoNameOnly & { diff --git a/packages/databases-collections/src/components/collection-fields/has-flexible-bucket-config-support.ts b/packages/databases-collections/src/components/collection-fields/has-flexible-bucket-config-support.ts index 43d8dac367f..69d8000213b 100644 --- a/packages/databases-collections/src/components/collection-fields/has-flexible-bucket-config-support.ts +++ b/packages/databases-collections/src/components/collection-fields/has-flexible-bucket-config-support.ts @@ -5,7 +5,7 @@ const MIN_SERVER_VERSION_FOR_BUCKET_OPTIONS = '6.3.0-alpha0'; export default function hasFlexibleBucketConfigSupport(serverVersion: string) { try { return semver.gte(serverVersion, MIN_SERVER_VERSION_FOR_BUCKET_OPTIONS); - } catch (e) { + } catch { return true; } } diff --git a/packages/explain-plan-helper/src/utils.ts b/packages/explain-plan-helper/src/utils.ts index 9cf705bc3c0..16081f44dee 100644 --- a/packages/explain-plan-helper/src/utils.ts +++ b/packages/explain-plan-helper/src/utils.ts @@ -9,7 +9,7 @@ export function getStageIndexFields(stage: Stage): Record { try { const result = parse(stage.keyPattern, { mode: ParseMode.Loose }); return typeof result === 'string' ? {} : result; - } catch (e) { + } catch { return {}; } } diff --git a/packages/hadron-app-registry/src/app-registry.ts b/packages/hadron-app-registry/src/app-registry.ts index e3313fb500d..575c4a4e9cb 100644 --- a/packages/hadron-app-registry/src/app-registry.ts +++ b/packages/hadron-app-registry/src/app-registry.ts @@ -6,9 +6,7 @@ import type { ReactReduxContext } from 'react-redux'; // type can derive it automatically based on the passed activate function. This // is helpful when using useActivate hook to get the stricter type of returned // activate store elsewhere in the code -export type Store = any & { - onActivated?: (appRegistry: AppRegistry) => void; -}; +export type Store = any; // This is basically what createActions will return, this doesn't exactly match // reflux.Actions type diff --git a/packages/hadron-document/src/element.ts b/packages/hadron-document/src/element.ts index d89ca86876d..5c8203e4f8e 100644 --- a/packages/hadron-document/src/element.ts +++ b/packages/hadron-document/src/element.ts @@ -465,7 +465,7 @@ export class Element extends EventEmitter { _isObjectIdEqual(): boolean { try { return (this.value as ObjectId).toHexString() === this.currentValue; - } catch (_) { + } catch { return false; } } diff --git a/packages/my-queries-storage/src/compass-query-storage.ts b/packages/my-queries-storage/src/compass-query-storage.ts index 191afd82719..2c904a49cd6 100644 --- a/packages/my-queries-storage/src/compass-query-storage.ts +++ b/packages/my-queries-storage/src/compass-query-storage.ts @@ -31,7 +31,7 @@ export abstract class CompassQueryStorage { }) .filter((x) => !namespace || x._ns === namespace); return sortedData; - } catch (e) { + } catch { return []; } }