From 824dde374b48e7645317b02dfc1f6ceb8aaf4b98 Mon Sep 17 00:00:00 2001
From: gatzjames
Date: Wed, 26 Mar 2025 16:22:27 +0100
Subject: [PATCH 1/9] init oxlint
---
.oxlintrc.json | 71 +++++++++++++++++++++
packages/insomnia-inso/.oxlintrc.json | 71 +++++++++++++++++++++
packages/insomnia-sdk/.oxlintrc.json | 71 +++++++++++++++++++++
packages/insomnia-smoke-test/.oxlintrc.json | 71 +++++++++++++++++++++
packages/insomnia-testing/.oxlintrc.json | 71 +++++++++++++++++++++
packages/insomnia/.oxlintrc.json | 71 +++++++++++++++++++++
6 files changed, 426 insertions(+)
create mode 100644 .oxlintrc.json
create mode 100644 packages/insomnia-inso/.oxlintrc.json
create mode 100644 packages/insomnia-sdk/.oxlintrc.json
create mode 100644 packages/insomnia-smoke-test/.oxlintrc.json
create mode 100644 packages/insomnia-testing/.oxlintrc.json
create mode 100644 packages/insomnia/.oxlintrc.json
diff --git a/.oxlintrc.json b/.oxlintrc.json
new file mode 100644
index 00000000000..49bfbc9de7b
--- /dev/null
+++ b/.oxlintrc.json
@@ -0,0 +1,71 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "plugins": [
+ "react",
+ "typescript"
+ ],
+ "categories": {
+ "correctness": "off"
+ },
+ "env": {
+ "builtin": true
+ },
+ "rules": {
+ "curly": "error",
+ "default-case": "error",
+ "default-case-last": "error",
+ "eqeqeq": [
+ "error",
+ "smart"
+ ],
+ "no-async-promise-executor": "off",
+ "no-case-declarations": "off",
+ "no-duplicate-imports": "off",
+ "no-prototype-builtins": "off",
+ "no-redeclare": "error",
+ "no-unused-vars": [
+ "error",
+ {
+ "ignoreRestSiblings": true
+ }
+ ],
+ "no-var": "error",
+ "react/no-unescaped-entities": "off",
+ "react/jsx-key": [
+ "error",
+ {
+ "checkFragmentShorthand": true
+ }
+ ],
+ "react/no-array-index-key": "error",
+ "react/self-closing-comp": "error",
+ "react-hooks/rules-of-hooks": "error",
+ "@typescript-eslint/array-type": [
+ "error",
+ {
+ "default": "array",
+ "readonly": "array"
+ }
+ ],
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/consistent-type-definitions": [
+ "error",
+ "interface"
+ ],
+ "@typescript-eslint/no-empty-interface": [
+ "error",
+ {
+ "allowSingleExtends": true
+ }
+ ],
+ "@typescript-eslint/no-namespace": [
+ "error",
+ {
+ "allowDeclarations": true
+ }
+ ],
+ "@typescript-eslint/no-explicit-any": "off",
+ "react/no-find-dom-node": "off",
+ "no-empty-function": "off"
+ }
+}
\ No newline at end of file
diff --git a/packages/insomnia-inso/.oxlintrc.json b/packages/insomnia-inso/.oxlintrc.json
new file mode 100644
index 00000000000..49bfbc9de7b
--- /dev/null
+++ b/packages/insomnia-inso/.oxlintrc.json
@@ -0,0 +1,71 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "plugins": [
+ "react",
+ "typescript"
+ ],
+ "categories": {
+ "correctness": "off"
+ },
+ "env": {
+ "builtin": true
+ },
+ "rules": {
+ "curly": "error",
+ "default-case": "error",
+ "default-case-last": "error",
+ "eqeqeq": [
+ "error",
+ "smart"
+ ],
+ "no-async-promise-executor": "off",
+ "no-case-declarations": "off",
+ "no-duplicate-imports": "off",
+ "no-prototype-builtins": "off",
+ "no-redeclare": "error",
+ "no-unused-vars": [
+ "error",
+ {
+ "ignoreRestSiblings": true
+ }
+ ],
+ "no-var": "error",
+ "react/no-unescaped-entities": "off",
+ "react/jsx-key": [
+ "error",
+ {
+ "checkFragmentShorthand": true
+ }
+ ],
+ "react/no-array-index-key": "error",
+ "react/self-closing-comp": "error",
+ "react-hooks/rules-of-hooks": "error",
+ "@typescript-eslint/array-type": [
+ "error",
+ {
+ "default": "array",
+ "readonly": "array"
+ }
+ ],
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/consistent-type-definitions": [
+ "error",
+ "interface"
+ ],
+ "@typescript-eslint/no-empty-interface": [
+ "error",
+ {
+ "allowSingleExtends": true
+ }
+ ],
+ "@typescript-eslint/no-namespace": [
+ "error",
+ {
+ "allowDeclarations": true
+ }
+ ],
+ "@typescript-eslint/no-explicit-any": "off",
+ "react/no-find-dom-node": "off",
+ "no-empty-function": "off"
+ }
+}
\ No newline at end of file
diff --git a/packages/insomnia-sdk/.oxlintrc.json b/packages/insomnia-sdk/.oxlintrc.json
new file mode 100644
index 00000000000..49bfbc9de7b
--- /dev/null
+++ b/packages/insomnia-sdk/.oxlintrc.json
@@ -0,0 +1,71 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "plugins": [
+ "react",
+ "typescript"
+ ],
+ "categories": {
+ "correctness": "off"
+ },
+ "env": {
+ "builtin": true
+ },
+ "rules": {
+ "curly": "error",
+ "default-case": "error",
+ "default-case-last": "error",
+ "eqeqeq": [
+ "error",
+ "smart"
+ ],
+ "no-async-promise-executor": "off",
+ "no-case-declarations": "off",
+ "no-duplicate-imports": "off",
+ "no-prototype-builtins": "off",
+ "no-redeclare": "error",
+ "no-unused-vars": [
+ "error",
+ {
+ "ignoreRestSiblings": true
+ }
+ ],
+ "no-var": "error",
+ "react/no-unescaped-entities": "off",
+ "react/jsx-key": [
+ "error",
+ {
+ "checkFragmentShorthand": true
+ }
+ ],
+ "react/no-array-index-key": "error",
+ "react/self-closing-comp": "error",
+ "react-hooks/rules-of-hooks": "error",
+ "@typescript-eslint/array-type": [
+ "error",
+ {
+ "default": "array",
+ "readonly": "array"
+ }
+ ],
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/consistent-type-definitions": [
+ "error",
+ "interface"
+ ],
+ "@typescript-eslint/no-empty-interface": [
+ "error",
+ {
+ "allowSingleExtends": true
+ }
+ ],
+ "@typescript-eslint/no-namespace": [
+ "error",
+ {
+ "allowDeclarations": true
+ }
+ ],
+ "@typescript-eslint/no-explicit-any": "off",
+ "react/no-find-dom-node": "off",
+ "no-empty-function": "off"
+ }
+}
\ No newline at end of file
diff --git a/packages/insomnia-smoke-test/.oxlintrc.json b/packages/insomnia-smoke-test/.oxlintrc.json
new file mode 100644
index 00000000000..49bfbc9de7b
--- /dev/null
+++ b/packages/insomnia-smoke-test/.oxlintrc.json
@@ -0,0 +1,71 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "plugins": [
+ "react",
+ "typescript"
+ ],
+ "categories": {
+ "correctness": "off"
+ },
+ "env": {
+ "builtin": true
+ },
+ "rules": {
+ "curly": "error",
+ "default-case": "error",
+ "default-case-last": "error",
+ "eqeqeq": [
+ "error",
+ "smart"
+ ],
+ "no-async-promise-executor": "off",
+ "no-case-declarations": "off",
+ "no-duplicate-imports": "off",
+ "no-prototype-builtins": "off",
+ "no-redeclare": "error",
+ "no-unused-vars": [
+ "error",
+ {
+ "ignoreRestSiblings": true
+ }
+ ],
+ "no-var": "error",
+ "react/no-unescaped-entities": "off",
+ "react/jsx-key": [
+ "error",
+ {
+ "checkFragmentShorthand": true
+ }
+ ],
+ "react/no-array-index-key": "error",
+ "react/self-closing-comp": "error",
+ "react-hooks/rules-of-hooks": "error",
+ "@typescript-eslint/array-type": [
+ "error",
+ {
+ "default": "array",
+ "readonly": "array"
+ }
+ ],
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/consistent-type-definitions": [
+ "error",
+ "interface"
+ ],
+ "@typescript-eslint/no-empty-interface": [
+ "error",
+ {
+ "allowSingleExtends": true
+ }
+ ],
+ "@typescript-eslint/no-namespace": [
+ "error",
+ {
+ "allowDeclarations": true
+ }
+ ],
+ "@typescript-eslint/no-explicit-any": "off",
+ "react/no-find-dom-node": "off",
+ "no-empty-function": "off"
+ }
+}
\ No newline at end of file
diff --git a/packages/insomnia-testing/.oxlintrc.json b/packages/insomnia-testing/.oxlintrc.json
new file mode 100644
index 00000000000..49bfbc9de7b
--- /dev/null
+++ b/packages/insomnia-testing/.oxlintrc.json
@@ -0,0 +1,71 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "plugins": [
+ "react",
+ "typescript"
+ ],
+ "categories": {
+ "correctness": "off"
+ },
+ "env": {
+ "builtin": true
+ },
+ "rules": {
+ "curly": "error",
+ "default-case": "error",
+ "default-case-last": "error",
+ "eqeqeq": [
+ "error",
+ "smart"
+ ],
+ "no-async-promise-executor": "off",
+ "no-case-declarations": "off",
+ "no-duplicate-imports": "off",
+ "no-prototype-builtins": "off",
+ "no-redeclare": "error",
+ "no-unused-vars": [
+ "error",
+ {
+ "ignoreRestSiblings": true
+ }
+ ],
+ "no-var": "error",
+ "react/no-unescaped-entities": "off",
+ "react/jsx-key": [
+ "error",
+ {
+ "checkFragmentShorthand": true
+ }
+ ],
+ "react/no-array-index-key": "error",
+ "react/self-closing-comp": "error",
+ "react-hooks/rules-of-hooks": "error",
+ "@typescript-eslint/array-type": [
+ "error",
+ {
+ "default": "array",
+ "readonly": "array"
+ }
+ ],
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/consistent-type-definitions": [
+ "error",
+ "interface"
+ ],
+ "@typescript-eslint/no-empty-interface": [
+ "error",
+ {
+ "allowSingleExtends": true
+ }
+ ],
+ "@typescript-eslint/no-namespace": [
+ "error",
+ {
+ "allowDeclarations": true
+ }
+ ],
+ "@typescript-eslint/no-explicit-any": "off",
+ "react/no-find-dom-node": "off",
+ "no-empty-function": "off"
+ }
+}
\ No newline at end of file
diff --git a/packages/insomnia/.oxlintrc.json b/packages/insomnia/.oxlintrc.json
new file mode 100644
index 00000000000..49bfbc9de7b
--- /dev/null
+++ b/packages/insomnia/.oxlintrc.json
@@ -0,0 +1,71 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "plugins": [
+ "react",
+ "typescript"
+ ],
+ "categories": {
+ "correctness": "off"
+ },
+ "env": {
+ "builtin": true
+ },
+ "rules": {
+ "curly": "error",
+ "default-case": "error",
+ "default-case-last": "error",
+ "eqeqeq": [
+ "error",
+ "smart"
+ ],
+ "no-async-promise-executor": "off",
+ "no-case-declarations": "off",
+ "no-duplicate-imports": "off",
+ "no-prototype-builtins": "off",
+ "no-redeclare": "error",
+ "no-unused-vars": [
+ "error",
+ {
+ "ignoreRestSiblings": true
+ }
+ ],
+ "no-var": "error",
+ "react/no-unescaped-entities": "off",
+ "react/jsx-key": [
+ "error",
+ {
+ "checkFragmentShorthand": true
+ }
+ ],
+ "react/no-array-index-key": "error",
+ "react/self-closing-comp": "error",
+ "react-hooks/rules-of-hooks": "error",
+ "@typescript-eslint/array-type": [
+ "error",
+ {
+ "default": "array",
+ "readonly": "array"
+ }
+ ],
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/consistent-type-definitions": [
+ "error",
+ "interface"
+ ],
+ "@typescript-eslint/no-empty-interface": [
+ "error",
+ {
+ "allowSingleExtends": true
+ }
+ ],
+ "@typescript-eslint/no-namespace": [
+ "error",
+ {
+ "allowDeclarations": true
+ }
+ ],
+ "@typescript-eslint/no-explicit-any": "off",
+ "react/no-find-dom-node": "off",
+ "no-empty-function": "off"
+ }
+}
\ No newline at end of file
From 8561eb25ea690e2a7f0d96b7ff717fcca62833c6 Mon Sep 17 00:00:00 2001
From: gatzjames
Date: Thu, 27 Mar 2025 11:45:13 +0100
Subject: [PATCH 2/9] fix unused variable error
---
packages/insomnia-inso/src/cli.ts | 4 +-
.../src/db/adapters/git-adapter.ts | 2 +-
.../src/db/adapters/ne-db-adapter.ts | 2 +-
packages/insomnia-inso/src/db/index.ts | 2 +-
packages/insomnia-smoke-test/server/oauth.ts | 8 +-
.../smoke/dashboard-interactions.test.ts | 1 -
packages/insomnia/src/common/api-specs.ts | 2 +-
packages/insomnia/src/common/har.ts | 2 +-
packages/insomnia/src/common/import.ts | 2 +-
packages/insomnia/src/common/insomnia-v5.ts | 2 +-
packages/insomnia/src/common/render.ts | 2 +-
packages/insomnia/src/main.development.ts | 2 +-
packages/insomnia/src/main/git-service.ts | 8 +-
.../src/main/ipc/extractPostmanDataDump.ts | 4 +-
packages/insomnia/src/models/environment.ts | 2 +-
packages/insomnia/src/network/network.ts | 4 +-
.../src/network/o-auth-2/get-token.ts | 4 +-
.../src/network/url-matches-cert-host.ts | 2 +-
packages/insomnia/src/plugins/misc.ts | 4 +-
packages/insomnia/src/sync/git/git-vcs.ts | 10 +-
.../insomnia/src/sync/git/ne-db-client.ts | 4 +-
.../src/sync/git/project-ne-db-client.ts | 6 +-
.../sync/git/project-routable-fs-client.ts | 4 +-
.../src/sync/store/drivers/graceful-rename.ts | 2 +-
.../src/sync/vcs/__tests__/vcs.test.ts | 4 +-
packages/insomnia/src/sync/vcs/vcs.ts | 8 +-
.../insomnia/src/ui/auth-session-provider.ts | 4 +-
.../ui/components/codemirror/code-editor.tsx | 8 +-
.../components/codemirror/lint/json-lint.ts | 2 +-
.../components/editors/auth/o-auth-2-auth.tsx | 2 +-
.../components/editors/body/file-editor.tsx | 4 +-
.../editors/body/graph-ql-editor.tsx | 4 +-
.../key-value-editor.tsx | 4 +-
.../src/ui/components/error-boundary.tsx | 4 +-
.../ui/components/modals/cookies-modal.tsx | 2 +-
.../components/modals/generate-code-modal.tsx | 4 +-
.../github-repository-settings-form-group.tsx | 4 +-
.../gitlab-repository-settings-form-group.tsx | 2 +-
.../modals/upload-runner-data-modal.tsx | 2 +-
.../src/ui/components/panes/request-pane.tsx | 2 +-
.../templating/local-template-tags.ts | 8 +-
packages/insomnia/src/ui/components/toast.tsx | 2 +-
.../viewers/response-cookies-viewer.tsx | 2 +-
.../ui/components/viewers/response-viewer.tsx | 6 +-
.../websockets/websocket-request-pane.tsx | 74 +-
packages/insomnia/src/ui/insomniaFetch.ts | 2 +-
packages/insomnia/src/ui/routes/actions.tsx | 2 +-
packages/insomnia/src/ui/routes/commands.tsx | 2 +-
packages/insomnia/src/ui/routes/design.tsx | 84 +--
packages/insomnia/src/ui/routes/import.tsx | 2 +-
packages/insomnia/src/ui/routes/invite.tsx | 8 +-
.../insomnia/src/ui/routes/organization.tsx | 688 +++++++++---------
packages/insomnia/src/ui/routes/project.tsx | 6 +-
.../src/ui/routes/remote-collections.tsx | 8 +-
packages/insomnia/src/ui/routes/root.tsx | 2 +-
packages/insomnia/src/ui/routes/runner.tsx | 4 +-
packages/insomnia/src/utils/graph-ql.ts | 2 +-
.../src/utils/importers/importers/curl.ts | 2 +-
.../src/utils/importers/importers/har.ts | 2 +-
.../utils/importers/importers/insomnia-1.ts | 14 +-
.../utils/importers/importers/insomnia-2.ts | 2 +-
.../utils/importers/importers/insomnia-3.ts | 2 +-
.../utils/importers/importers/insomnia-4.ts | 2 +-
.../utils/importers/importers/openapi-3.ts | 2 +-
.../utils/importers/importers/postman-env.ts | 2 +-
.../src/utils/importers/importers/postman.ts | 2 +-
.../utils/importers/importers/swagger-2.ts | 2 +-
.../src/utils/importers/importers/wsdl.ts | 2 +-
.../insomnia/src/utils/importers/utils.ts | 2 +-
packages/insomnia/src/utils/prettify/json.ts | 2 +-
packages/insomnia/src/utils/router.ts | 4 +-
.../insomnia/src/utils/url/querystring.ts | 4 +-
packages/insomnia/src/utils/vault.ts | 2 +-
73 files changed, 547 insertions(+), 548 deletions(-)
diff --git a/packages/insomnia-inso/src/cli.ts b/packages/insomnia-inso/src/cli.ts
index a341725118f..c98d903bcf2 100644
--- a/packages/insomnia-inso/src/cli.ts
+++ b/packages/insomnia-inso/src/cli.ts
@@ -269,7 +269,7 @@ const getListFromFileOrUrl = (content: string, fileType?: string): Record data && typeof data === 'object' && !Array.isArray(data) && data !== null);
}
throw new Error('Invalid JSON file uploaded, JSON file must be array of key-value pairs.');
- } catch (error) {
+ } catch {
throw new Error('Upload JSON file can not be parsed');
}
} else if (fileType === 'csv') {
@@ -726,7 +726,7 @@ Test results:`);
let isIdentiferAFile = false;
try {
isIdentiferAFile = identifier && (await fs.promises.stat(identifierAsAbsPath)).isFile();
- } catch (err) { }
+ } catch { }
const pathToSearch = '';
let specContent;
let rulesetFileName;
diff --git a/packages/insomnia-inso/src/db/adapters/git-adapter.ts b/packages/insomnia-inso/src/db/adapters/git-adapter.ts
index ed6114dec36..846e526f75d 100644
--- a/packages/insomnia-inso/src/db/adapters/git-adapter.ts
+++ b/packages/insomnia-inso/src/db/adapters/git-adapter.ts
@@ -14,7 +14,7 @@ const gitAdapter: DbAdapter = async (dir, filterTypes) => {
let files = null;
try {
files = await fs.promises.readdir(insomniaFolder);
- } catch (error) {
+ } catch {
if (files?.length === 0) {
console.error(`.insomnia folder found at "${insomniaFolder}"
but no files found inside. Ensure your workingDir is correct.`);
diff --git a/packages/insomnia-inso/src/db/adapters/ne-db-adapter.ts b/packages/insomnia-inso/src/db/adapters/ne-db-adapter.ts
index 52580b963b9..3f61c5e4391 100644
--- a/packages/insomnia-inso/src/db/adapters/ne-db-adapter.ts
+++ b/packages/insomnia-inso/src/db/adapters/ne-db-adapter.ts
@@ -10,7 +10,7 @@ const neDbAdapter: DbAdapter = async (dir, filterTypes) => {
// Confirm if db files exist
try {
await stat(path.join(dir, 'insomnia.Workspace.db'));
- } catch (err) {
+ } catch {
return null;
}
diff --git a/packages/insomnia-inso/src/db/index.ts b/packages/insomnia-inso/src/db/index.ts
index e818266d81b..cde501a17e1 100644
--- a/packages/insomnia-inso/src/db/index.ts
+++ b/packages/insomnia-inso/src/db/index.ts
@@ -61,7 +61,7 @@ interface Options {
export const isFile = async (path: string) => {
try {
return (await stat(path)).isFile();
- } catch (error) {
+ } catch {
return false;
}
};
diff --git a/packages/insomnia-smoke-test/server/oauth.ts b/packages/insomnia-smoke-test/server/oauth.ts
index 2daeb692ec1..1ffddf8cd9f 100644
--- a/packages/insomnia-smoke-test/server/oauth.ts
+++ b/packages/insomnia-smoke-test/server/oauth.ts
@@ -1,5 +1,6 @@
import express, { urlencoded } from 'express';
import type Provider from 'oidc-provider';
+import { Configuration } from 'oidc-provider';
export const oauthRoutes = async (port: number) => {
const clientIDAuthorizationCode = 'authorization_code';
@@ -12,7 +13,6 @@ export const oauthRoutes = async (port: number) => {
const clientRedirectUri = `http://127.0.0.1:${port}/callback`;
- /* eslint-disable camelcase */
const oidcConfig = {
interactions: {
url: (_, interaction) => {
@@ -124,8 +124,8 @@ export const oauthRoutes = async (port: number) => {
return grant;
},
- };
- /* eslint-enable camelcase */
+ } satisfies Configuration;
+
const provider = (await import('oidc-provider')).default;
const oidc = new provider(`http://127.0.0.1:${port}`, oidcConfig);
@@ -159,7 +159,7 @@ export const oauthRoutes = async (port: number) => {
res
.status(200)
.json(validated);
- } catch (err) {
+ } catch {
res
.status(500)
.header('Content-Type', 'text/plain')
diff --git a/packages/insomnia-smoke-test/tests/smoke/dashboard-interactions.test.ts b/packages/insomnia-smoke-test/tests/smoke/dashboard-interactions.test.ts
index cfeb4c7d624..3c66fedd126 100644
--- a/packages/insomnia-smoke-test/tests/smoke/dashboard-interactions.test.ts
+++ b/packages/insomnia-smoke-test/tests/smoke/dashboard-interactions.test.ts
@@ -1,6 +1,5 @@
import { expect } from '@playwright/test';
-import { loadFixture } from '../../playwright/paths';
import { test } from '../../playwright/test';
test.describe('Dashboard', async () => {
diff --git a/packages/insomnia/src/common/api-specs.ts b/packages/insomnia/src/common/api-specs.ts
index 5471c04b1e3..88c573bbaed 100644
--- a/packages/insomnia/src/common/api-specs.ts
+++ b/packages/insomnia/src/common/api-specs.ts
@@ -20,7 +20,7 @@ export function parseApiSpec(
// NOTE: JSON is valid YAML so we only need to parse YAML
try {
result.contents = YAML.parse(rawDocument);
- } catch (err) {
+ } catch {
throw new Error('Failed to parse API spec');
}
diff --git a/packages/insomnia/src/common/har.ts b/packages/insomnia/src/common/har.ts
index f52aede477d..bd83c89d208 100644
--- a/packages/insomnia/src/common/har.ts
+++ b/packages/insomnia/src/common/har.ts
@@ -283,7 +283,7 @@ export function getResponseCookiesFromHeaders(headers: Har.Cookie[]) {
try {
cookie = ToughCookie.parse(harCookie.value || '', { loose: true });
- } catch (error) { }
+ } catch { }
if (cookie === null || cookie === undefined) {
return accumulator;
diff --git a/packages/insomnia/src/common/import.ts b/packages/insomnia/src/common/import.ts
index f075ebc0452..3ebc09eb6cc 100644
--- a/packages/insomnia/src/common/import.ts
+++ b/packages/insomnia/src/common/import.ts
@@ -84,7 +84,7 @@ export async function getFilesFromPostmanExportedDataDump(filePath: string): Pro
let res;
try {
res = await window.main.extractJsonFileFromPostmanDataDumpArchive(filePath);
- } catch (err) {
+ } catch {
throw new Error('Extract failed');
}
if (res && res.data) {
diff --git a/packages/insomnia/src/common/insomnia-v5.ts b/packages/insomnia/src/common/insomnia-v5.ts
index 0ce3171808a..3e244fb1bfd 100644
--- a/packages/insomnia/src/common/insomnia-v5.ts
+++ b/packages/insomnia/src/common/insomnia-v5.ts
@@ -625,7 +625,7 @@ export async function getInsomniaV5DataExport({
try {
contents = JSON.parse(spec.contents);
- } catch (err) {
+ } catch {
// @TODO For some reason switching a spec from JSON to YAML doesn't update it's content type so we need to handle both here
// This must be fixed in the apiSpec model
try {
diff --git a/packages/insomnia/src/common/render.ts b/packages/insomnia/src/common/render.ts
index 8b648a79b06..0ff56d98ea8 100644
--- a/packages/insomnia/src/common/render.ts
+++ b/packages/insomnia/src/common/render.ts
@@ -594,7 +594,7 @@ export async function getRenderedRequestAndContext(
o.query = o.query.replace(/#}/g, '# }');
request.body.text = JSON.stringify(o);
}
- } catch (err) { }
+ } catch { }
// Render description separately because it's lower priority
const description = request.description;
diff --git a/packages/insomnia/src/main.development.ts b/packages/insomnia/src/main.development.ts
index 73fe7ffc662..621915cdf92 100644
--- a/packages/insomnia/src/main.development.ts
+++ b/packages/insomnia/src/main.development.ts
@@ -146,7 +146,7 @@ app.on('activate', (_error, hasVisibleWindows) => {
try {
console.log('[main] creating new window for MacOS activate event');
windowUtils.createWindow();
- } catch (error) {
+ } catch {
// This might happen if 'ready' hasn't fired yet. So we're just going
// to silence these errors.
console.log('[main] App not ready to "activate" yet');
diff --git a/packages/insomnia/src/main/git-service.ts b/packages/insomnia/src/main/git-service.ts
index 525193998cf..adc3ffb7d16 100644
--- a/packages/insomnia/src/main/git-service.ts
+++ b/packages/insomnia/src/main/git-service.ts
@@ -318,7 +318,7 @@ export const gitChangesLoader = async ({
branch,
changes,
};
- } catch (e) {
+ } catch {
return {
branch: '',
changes: {
@@ -348,7 +348,7 @@ export const canPushLoader = async ({ projectId, workspaceId }: {
});
return { canPush: hasUnpushedChanges };
- } catch (err) {
+ } catch {
return { canPush: false };
}
};
@@ -1679,7 +1679,7 @@ function getPreviewItemName(previewDiffItem: {
if (prev && 'fileName' in prev || 'name' in prev) {
prevName = prev.fileName || prev.name;
}
- } catch (e) {
+ } catch {
// Nothing to do
}
@@ -1688,7 +1688,7 @@ function getPreviewItemName(previewDiffItem: {
if (next && 'fileName' in next || 'name' in next) {
nextName = next.fileName || next.name;
}
- } catch (e) {
+ } catch {
// Nothing to do
}
diff --git a/packages/insomnia/src/main/ipc/extractPostmanDataDump.ts b/packages/insomnia/src/main/ipc/extractPostmanDataDump.ts
index d32eb3df7d8..646049fc6a3 100644
--- a/packages/insomnia/src/main/ipc/extractPostmanDataDump.ts
+++ b/packages/insomnia/src/main/ipc/extractPostmanDataDump.ts
@@ -27,7 +27,7 @@ export default async function extractPostmanDataDumpHandler(_event: unknown, dat
let archiveJsonData;
try {
archiveJsonData = JSON.parse(archiveJsonFile.data.toString());
- } catch (err) {
+ } catch {
return {
err: 'Failed to parse archive.json file',
};
@@ -62,7 +62,7 @@ export default async function extractPostmanDataDumpHandler(_event: unknown, dat
});
}
});
- } catch (err) {
+ } catch {
return {
err: 'Failed to parse collection or environment files',
};
diff --git a/packages/insomnia/src/models/environment.ts b/packages/insomnia/src/models/environment.ts
index d59cb1d7e13..55ac5fc30fc 100644
--- a/packages/insomnia/src/models/environment.ts
+++ b/packages/insomnia/src/models/environment.ts
@@ -148,7 +148,7 @@ export const decryptSecretValue = (encryptedValue: string, symmetricKey: JsonWeb
try {
const jsonWebKey = base64decode(encryptedValue, true);
return crypt.decryptAES(symmetricKey, jsonWebKey);
- } catch (error) {
+ } catch {
// return origin value if failed to decrypt
return encryptedValue;
}
diff --git a/packages/insomnia/src/network/network.ts b/packages/insomnia/src/network/network.ts
index 1b506268565..cc6e9c09462 100644
--- a/packages/insomnia/src/network/network.ts
+++ b/packages/insomnia/src/network/network.ts
@@ -646,7 +646,7 @@ export const tryToTransformRequestWithPlugins = async (renderResult: {
const { request, context } = renderResult;
try {
return await _applyRequestPluginHooks(request, context);
- } catch (err) {
+ } catch {
throw new Error(`Failed to transform request with plugins: ${request._id}`);
}
};
@@ -830,7 +830,7 @@ export const getCurrentUrl = ({ headerResults, finalUrl }: { headerResults: any;
}
try {
return new URL(location.value, finalUrl).toString();
- } catch (error) {
+ } catch {
return finalUrl;
}
};
diff --git a/packages/insomnia/src/network/o-auth-2/get-token.ts b/packages/insomnia/src/network/o-auth-2/get-token.ts
index c2f56b542ff..d4744722dd5 100644
--- a/packages/insomnia/src/network/o-auth-2/get-token.ts
+++ b/packages/insomnia/src/network/o-auth-2/get-token.ts
@@ -359,13 +359,13 @@ export const encodePKCE = (buffer: Buffer) => {
const tryToParse = (body: string): Record | null => {
try {
return JSON.parse(body);
- } catch (err) { }
+ } catch { }
try {
// NOTE: parse does not return a JS Object, so
// we cannot use hasOwnProperty on it
return querystring.parse(body);
- } catch (err) { }
+ } catch { }
return null;
};
diff --git a/packages/insomnia/src/network/url-matches-cert-host.ts b/packages/insomnia/src/network/url-matches-cert-host.ts
index 231e2ace92b..0bc051e2dce 100644
--- a/packages/insomnia/src/network/url-matches-cert-host.ts
+++ b/packages/insomnia/src/network/url-matches-cert-host.ts
@@ -11,7 +11,7 @@ export function urlMatchesCertHost(certificateHost: string, requestUrl: string,
let certificateHostWithProtocol = new URL('https://example.com');
try {
certificateHostWithProtocol = new URL(cHostWithProtocol);
- } catch (err) {
+ } catch {
// return false early if the certificate host is invalid
return false;
}
diff --git a/packages/insomnia/src/plugins/misc.ts b/packages/insomnia/src/plugins/misc.ts
index b7cd0be6bef..108322904d9 100644
--- a/packages/insomnia/src/plugins/misc.ts
+++ b/packages/insomnia/src/plugins/misc.ts
@@ -99,7 +99,7 @@ const getChildValue = (theme: any, path: string[]) => {
return path.reduce((acc, v: string) => {
try {
acc = acc[v];
- } catch (e) {
+ } catch {
return undefined;
}
return acc;
@@ -220,7 +220,7 @@ function getThemeBlockCSS(block?: ThemeBlock) {
const rgb = parsedColor.rgb();
addVar(variable, rgb.string());
addVar(`${variable}-rgb`, rgb.array().join(', '));
- } catch (err) {
+ } catch {
console.log('[theme] Failed to parse theme color', value);
}
};
diff --git a/packages/insomnia/src/sync/git/git-vcs.ts b/packages/insomnia/src/sync/git/git-vcs.ts
index 7e9dea5ba16..bb3e26f8b08 100644
--- a/packages/insomnia/src/sync/git/git-vcs.ts
+++ b/packages/insomnia/src/sync/git/git-vcs.ts
@@ -103,7 +103,7 @@ function getInsomniaFileName(blob: void | Uint8Array | undefined): string {
try {
const parsed = parse(Buffer.from(blob).toString('utf-8'));
return parsed?.fileName || parsed?.name || '';
- } catch (e) {
+ } catch {
// If the document couldn't be parsed as yaml return an empty string
return '';
}
@@ -159,7 +159,7 @@ export class GitVCS {
});
defaultBranch = mainRef?.target?.replace('refs/heads/', '') || 'main';
- } catch (err) {
+ } catch {
// Ignore error
}
@@ -175,7 +175,7 @@ export class GitVCS {
});
return remoteOriginURI;
- } catch (err) {
+ } catch {
// Ignore error
return this._baseOpts.uri || '';
}
@@ -384,7 +384,7 @@ export class GitVCS {
try {
return Buffer.from(blob).toString('utf-8');
- } catch (e) {
+ } catch {
return null;
}
});
@@ -1033,7 +1033,7 @@ export class GitVCS {
async repoExists() {
try {
await git.getConfig({ ...this._baseOpts, path: '' });
- } catch (err) {
+ } catch {
return false;
}
diff --git a/packages/insomnia/src/sync/git/ne-db-client.ts b/packages/insomnia/src/sync/git/ne-db-client.ts
index 271b37bd166..5991599c63c 100644
--- a/packages/insomnia/src/sync/git/ne-db-client.ts
+++ b/packages/insomnia/src/sync/git/ne-db-client.ts
@@ -213,14 +213,14 @@ export class NeDBClient {
try {
fileBuff = await this.readFile(filePath);
- } catch (err) {
+ } catch {
// console.log('[nedb] Failed to read file', err);
}
if (fileBuff === null) {
try {
dir = await this.readdir(filePath);
- } catch (err) {
+ } catch {
// console.log('[nedb] Failed to read dir', err);
}
}
diff --git a/packages/insomnia/src/sync/git/project-ne-db-client.ts b/packages/insomnia/src/sync/git/project-ne-db-client.ts
index 285ffacae98..f059fe8d9e8 100644
--- a/packages/insomnia/src/sync/git/project-ne-db-client.ts
+++ b/packages/insomnia/src/sync/git/project-ne-db-client.ts
@@ -61,7 +61,7 @@ export class GitProjectNeDBClient {
} else {
return raw;
}
- } catch (err) {
+ } catch {
throw this._errMissing(filePath);
}
}
@@ -163,14 +163,14 @@ export class GitProjectNeDBClient {
let dir: string[] | null = null;
try {
fileBuff = await this.readFile(filePath);
- } catch (err) {
+ } catch {
// console.log('[nedb] Failed to read file', err);
}
if (fileBuff === null) {
try {
dir = await this.readdir(filePath);
- } catch (err) {
+ } catch {
// console.log('[nedb] Failed to read dir', err);
}
}
diff --git a/packages/insomnia/src/sync/git/project-routable-fs-client.ts b/packages/insomnia/src/sync/git/project-routable-fs-client.ts
index d2ae5f4cd74..2bb91030917 100644
--- a/packages/insomnia/src/sync/git/project-routable-fs-client.ts
+++ b/packages/insomnia/src/sync/git/project-routable-fs-client.ts
@@ -38,7 +38,7 @@ export function projectRoutableFSClient(
let insomniaFiles = [];
try {
insomniaFiles = await insomniaFS.promises.readdir(filePath, ...args);
- } catch (err) {
+ } catch {
// console.log('[routablefs] Failed to execute', method, filePath, { args }, err);
}
@@ -59,7 +59,7 @@ export function projectRoutableFSClient(
try {
const result = await insomniaFS.promises[method]!(filePath, ...args);
return result;
- } catch (err) {
+ } catch {
const result = await defaultFS.promises[method]!(filePath, ...args);
return result;
diff --git a/packages/insomnia/src/sync/store/drivers/graceful-rename.ts b/packages/insomnia/src/sync/store/drivers/graceful-rename.ts
index 58abd16f6f3..e479d096f7a 100644
--- a/packages/insomnia/src/sync/store/drivers/graceful-rename.ts
+++ b/packages/insomnia/src/sync/store/drivers/graceful-rename.ts
@@ -35,7 +35,7 @@ async function renameWithRetry(source: string, target: string, startTime: number
if (!stat.isFile()) {
abortRetry = true; // if target is not a file, EPERM error may be raised and we should not attempt to retry
}
- } catch (error) {
+ } catch {
// Ignore
}
diff --git a/packages/insomnia/src/sync/vcs/__tests__/vcs.test.ts b/packages/insomnia/src/sync/vcs/__tests__/vcs.test.ts
index b42006594f7..4f134be293a 100644
--- a/packages/insomnia/src/sync/vcs/__tests__/vcs.test.ts
+++ b/packages/insomnia/src/sync/vcs/__tests__/vcs.test.ts
@@ -539,7 +539,7 @@ describe('VCS', () => {
try {
// @ts-expect-error intentionally invalid
await v.removeBranch();
- } catch (err) {
+ } catch {
didError = true;
}
@@ -552,7 +552,7 @@ describe('VCS', () => {
try {
await v.removeBranch('master');
- } catch (err) {
+ } catch {
didError = true;
}
diff --git a/packages/insomnia/src/sync/vcs/vcs.ts b/packages/insomnia/src/sync/vcs/vcs.ts
index eee152bce20..98cd327931b 100644
--- a/packages/insomnia/src/sync/vcs/vcs.ts
+++ b/packages/insomnia/src/sync/vcs/vcs.ts
@@ -211,7 +211,7 @@ export class VCS {
try {
previousBlobContent = await this.blobFromLastSnapshot(key);
- } catch (e) {
+ } catch {
// No previous blob found
} finally {
unstaged[key] = {
@@ -224,7 +224,7 @@ export class VCS {
let previousBlobContent: BaseModel | null = null;
try {
previousBlobContent = (await this._getBlob(blobId)) || null;
- } catch (e) {
+ } catch {
// No previous blob found
} finally {
unstaged[key] = {
@@ -238,7 +238,7 @@ export class VCS {
let previousBlobContent: BaseModel | null = null;
try {
previousBlobContent = 'blobContent' in stageEntry ? JSON.parse(stageEntry.blobContent) : {};
- } catch (e) {
+ } catch {
// No previous blob found
} finally {
unstaged[key] = {
@@ -772,7 +772,7 @@ export class VCS {
try {
mineBlobContent = conflict.mineBlob ? await this._getBlob(conflict.mineBlob) : null;
theirsBlobContent = conflict.theirsBlob ? await this._getBlob(conflict.theirsBlob) : null;
- } catch (e) {
+ } catch {
// No previous blob found
}
return {
diff --git a/packages/insomnia/src/ui/auth-session-provider.ts b/packages/insomnia/src/ui/auth-session-provider.ts
index fbb52b80c27..e7c364de308 100644
--- a/packages/insomnia/src/ui/auth-session-provider.ts
+++ b/packages/insomnia/src/ui/auth-session-provider.ts
@@ -13,14 +13,14 @@ const sessionKeyPair = keyPair();
encodeBase64(sessionKeyPair.publicKey).then(res => {
try {
window.localStorage.setItem('insomnia.publicKey', getInsomniaPublicKey() || res);
- } catch (error) {
+ } catch {
console.error('Failed to store public key in localStorage.');
}
});
encodeBase64(sessionKeyPair.secretKey).then(res => {
try {
window.localStorage.setItem('insomnia.secretKey', getInsomniaSecretKey() || res);
- } catch (error) {
+ } catch {
console.error('Failed to store secret key in localStorage.');
}
});
diff --git a/packages/insomnia/src/ui/components/codemirror/code-editor.tsx b/packages/insomnia/src/ui/components/codemirror/code-editor.tsx
index ced4b0ede43..22a234af379 100644
--- a/packages/insomnia/src/ui/components/codemirror/code-editor.tsx
+++ b/packages/insomnia/src/ui/components/codemirror/code-editor.tsx
@@ -68,7 +68,7 @@ const widget = (cm: CodeMirror.EditorFromTextArea | null, from: CodeMirror.Posit
const endToken = squareBraceIsOutsideCurlyBrace ? ']' : '}';
const keys = Object.keys(JSON.parse(startToken + cm?.getRange(from, to) + endToken));
return keys.length ? `\u21A4 ${keys.length} \u21A6` : '\u2194';
- } catch (error) {
+ } catch {
return '\u2194';
}
};
@@ -225,7 +225,7 @@ export const CodeEditor = memo(forwardRef(({
}
try {
return vkBeautify.xml(code, indentChars);
- } catch (error) {
+ } catch {
// Failed to parse so just return original
return code;
}
@@ -244,7 +244,7 @@ export const CodeEditor = memo(forwardRef(({
}
}
return jsonPrettify(jsonString, indentChars, autoPrettify);
- } catch (error) {
+ } catch {
// That's Ok, just leave it
return code;
}
@@ -252,7 +252,7 @@ export const CodeEditor = memo(forwardRef(({
const prettifyEDN = (code: string) => {
try {
return ednPrettify(code);
- } catch (error) {
+ } catch {
return code;
}
};
diff --git a/packages/insomnia/src/ui/components/codemirror/lint/json-lint.ts b/packages/insomnia/src/ui/components/codemirror/lint/json-lint.ts
index c9f082e5dd7..6f550527341 100644
--- a/packages/insomnia/src/ui/components/codemirror/lint/json-lint.ts
+++ b/packages/insomnia/src/ui/components/codemirror/lint/json-lint.ts
@@ -43,7 +43,7 @@ async function validator(text: string): Promise {
if (renderedText) {
try {
jsonlint.parse(renderedText);
- } catch (e) {}
+ } catch { }
}
return found;
diff --git a/packages/insomnia/src/ui/components/editors/auth/o-auth-2-auth.tsx b/packages/insomnia/src/ui/components/editors/auth/o-auth-2-auth.tsx
index 3395df9a432..21ced1fe939 100644
--- a/packages/insomnia/src/ui/components/editors/auth/o-auth-2-auth.tsx
+++ b/packages/insomnia/src/ui/components/editors/auth/o-auth-2-auth.tsx
@@ -302,7 +302,7 @@ const renderIdentityTokenExpiry = (token?: Pick) =
try {
decodedString = window.atob(base64Url);
- } catch (error) {
+ } catch {
return;
}
diff --git a/packages/insomnia/src/ui/components/editors/body/file-editor.tsx b/packages/insomnia/src/ui/components/editors/body/file-editor.tsx
index c264ed029af..964ca08c32f 100644
--- a/packages/insomnia/src/ui/components/editors/body/file-editor.tsx
+++ b/packages/insomnia/src/ui/components/editors/body/file-editor.tsx
@@ -27,7 +27,7 @@ export const FileEditor: FC = ({ onChange, path }) => {
try {
const bytes = fs.statSync(path).size;
sizeDescription = misc.describeByteSize(bytes);
- } catch (error) {
+ } catch {
sizeDescription = '';
}
@@ -46,7 +46,7 @@ export const FileEditor: FC = ({ onChange, path }) => {
Reset File
-
+
diff --git a/packages/insomnia/src/ui/components/editors/body/graph-ql-editor.tsx b/packages/insomnia/src/ui/components/editors/body/graph-ql-editor.tsx
index 387f7bfe56d..6e126775307 100644
--- a/packages/insomnia/src/ui/components/editors/body/graph-ql-editor.tsx
+++ b/packages/insomnia/src/ui/components/editors/body/graph-ql-editor.tsx
@@ -213,7 +213,7 @@ export const GraphQLEditor: FC = ({
let requestBody: GraphQLBody;
try {
requestBody = JSON.parse(request.body.text || '');
- } catch (err) {
+ } catch {
requestBody = { query: '' };
}
@@ -222,7 +222,7 @@ export const GraphQLEditor: FC = ({
let documentAST;
try {
documentAST = parse(requestBody.query || '');
- } catch (error) {
+ } catch {
documentAST = null;
}
const operations = documentAST?.definitions.filter(isOperationDefinition)?.map(def => def.name?.value || '').filter(Boolean) || [];
diff --git a/packages/insomnia/src/ui/components/editors/environment-key-value-editor/key-value-editor.tsx b/packages/insomnia/src/ui/components/editors/environment-key-value-editor/key-value-editor.tsx
index b3e8bce0599..7d7812ca0f4 100644
--- a/packages/insomnia/src/ui/components/editors/environment-key-value-editor/key-value-editor.tsx
+++ b/packages/insomnia/src/ui/components/editors/environment-key-value-editor/key-value-editor.tsx
@@ -50,7 +50,7 @@ export const EnvironmentKVEditor = ({ data, onChange, vaultKey = '', isPrivate =
// Ensure same array data will not generate different kvPairs to avoid flash issue
// eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(data)]
- ); const codeModalRef = useRef(null);
+ ); const codeModalRef = useRef(null);
const [kvPairError, setKvPairError] = useState<{ id: string; error: string }[]>([]);
const symmetricKey = vaultKey === '' ? {} : base64decode(vaultKey, true);
@@ -173,7 +173,7 @@ export const EnvironmentKVEditor = ({ data, onChange, vaultKey = '', isPrivate =
try {
JSON.parse(input);
return true;
- } catch (error) {
+ } catch {
return false;
}
};
diff --git a/packages/insomnia/src/ui/components/error-boundary.tsx b/packages/insomnia/src/ui/components/error-boundary.tsx
index 512dc86f2a4..b6ee5ff0e5e 100644
--- a/packages/insomnia/src/ui/components/error-boundary.tsx
+++ b/packages/insomnia/src/ui/components/error-boundary.tsx
@@ -34,7 +34,7 @@ class SingleErrorBoundary extends PureComponent {
try {
componentName = firstChild.type.name;
- } catch (err) {
+ } catch {
// It's okay
}
@@ -49,7 +49,7 @@ class SingleErrorBoundary extends PureComponent {
),
});
- } catch (err) {
+ } catch {
// UI is so broken that we can't even show an alert
}
}
diff --git a/packages/insomnia/src/ui/components/modals/cookies-modal.tsx b/packages/insomnia/src/ui/components/modals/cookies-modal.tsx
index 24b03a47fbf..50202f28d77 100644
--- a/packages/insomnia/src/ui/components/modals/cookies-modal.tsx
+++ b/packages/insomnia/src/ui/components/modals/cookies-modal.tsx
@@ -61,7 +61,7 @@ export const CookiesModal = ({ setIsOpen }: Props) => {
for (const cookie of (activeCookieJar?.cookies || [])) {
try {
renderedCookies.push(await handleRender(cookie));
- } catch (err) {
+ } catch {
renderedCookies.push(cookie);
}
}
diff --git a/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx b/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx
index 8a8927c62d7..25b56d55e5b 100644
--- a/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx
+++ b/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx
@@ -49,11 +49,11 @@ export const GenerateCodeModal = forwardRef((pro
let storedClient: HTTPSnippetClient | undefined;
try {
storedTarget = JSON.parse(window.localStorage.getItem('insomnia::generateCode::target') || '') as HTTPSnippetTarget;
- } catch (error) { }
+ } catch { }
try {
storedClient = JSON.parse(window.localStorage.getItem('insomnia::generateCode::client') || '') as HTTPSnippetClient;
- } catch (error) { }
+ } catch { }
const [state, setState] = useState({
request: undefined,
target: storedTarget,
diff --git a/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/github-repository-settings-form-group.tsx b/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/github-repository-settings-form-group.tsx
index c7abc91760b..7ffff7f6cd3 100644
--- a/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/github-repository-settings-form-group.tsx
+++ b/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/github-repository-settings-form-group.tsx
@@ -138,7 +138,7 @@ const GitHubRepositoryForm = ({
>
Sign out
-
+
{error && (
@@ -183,7 +183,7 @@ const GitHubSignInForm = () => {
let parsedURL: URL;
try {
parsedURL = new URL(link);
- } catch (error) {
+ } catch {
setError('Invalid URL');
return;
}
diff --git a/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/gitlab-repository-settings-form-group.tsx b/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/gitlab-repository-settings-form-group.tsx
index 5881c6f8a68..f6b2911af40 100644
--- a/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/gitlab-repository-settings-form-group.tsx
+++ b/packages/insomnia/src/ui/components/modals/git-repository-settings-modal/gitlab-repository-settings-form-group.tsx
@@ -201,7 +201,7 @@ const GitLabSignInForm = () => {
let parsedURL: URL;
try {
parsedURL = new URL(link);
- } catch (error) {
+ } catch {
setError('Invalid URL');
return;
}
diff --git a/packages/insomnia/src/ui/components/modals/upload-runner-data-modal.tsx b/packages/insomnia/src/ui/components/modals/upload-runner-data-modal.tsx
index e94f01e4b9d..76a0e8834e4 100644
--- a/packages/insomnia/src/ui/components/modals/upload-runner-data-modal.tsx
+++ b/packages/insomnia/src/ui/components/modals/upload-runner-data-modal.tsx
@@ -69,7 +69,7 @@ export const UploadDataModal = ({ onUploadFile, onClose, userUploadData }: Uploa
} else {
setInvalidFileReason('Invalid JSON file uploaded, JSON file must be array of key-value pairs.');
}
- } catch (error) {
+ } catch {
setInvalidFileReason('Upload JSON file can not be parsed');
}
} else if (fileType === 'text/csv') {
diff --git a/packages/insomnia/src/ui/components/panes/request-pane.tsx b/packages/insomnia/src/ui/components/panes/request-pane.tsx
index b4146891a52..2770257ab22 100644
--- a/packages/insomnia/src/ui/components/panes/request-pane.tsx
+++ b/packages/insomnia/src/ui/components/panes/request-pane.tsx
@@ -54,7 +54,7 @@ export const RequestPane: FC = ({
try {
query = extractQueryStringFromUrl(activeRequest.url);
- } catch (error) {
+ } catch {
console.warn('Failed to parse url to import querystring');
return;
}
diff --git a/packages/insomnia/src/ui/components/templating/local-template-tags.ts b/packages/insomnia/src/ui/components/templating/local-template-tags.ts
index 22a12bed5c5..b6b907c7295 100644
--- a/packages/insomnia/src/ui/components/templating/local-template-tags.ts
+++ b/packages/insomnia/src/ui/components/templating/local-template-tags.ts
@@ -198,7 +198,7 @@ const localTemplatePlugins: { templateTag: PluginTemplateTag }[] = [
try {
const results = JSONPath({ json: value, path: filter });
value = Array.isArray(results) ? results[0] : results;
- } catch (err) { }
+ } catch { }
}
if (typeof value !== 'string') {
@@ -306,7 +306,7 @@ const localTemplatePlugins: { templateTag: PluginTemplateTag }[] = [
if (!Array.isArray(results)) {
results = [results];
}
- } catch (err) {
+ } catch {
throw new Error(`Invalid JSONPath query: ${filter}`);
}
@@ -735,7 +735,7 @@ const localTemplatePlugins: { templateTag: PluginTemplateTag }[] = [
if (!Array.isArray(results)) {
results = [results];
}
- } catch (err) {
+ } catch {
throw new Error(`Invalid JSONPath query: ${sanitizedFilter}`);
}
@@ -793,7 +793,7 @@ const localTemplatePlugins: { templateTag: PluginTemplateTag }[] = [
}
return results[0].inner;
- } catch (err) {
+ } catch {
throw new Error(`Invalid XPath query: ${sanitizedFilter}`);
}
}
diff --git a/packages/insomnia/src/ui/components/toast.tsx b/packages/insomnia/src/ui/components/toast.tsx
index 02da671f0b6..0f493bfe928 100644
--- a/packages/insomnia/src/ui/components/toast.tsx
+++ b/packages/insomnia/src/ui/components/toast.tsx
@@ -40,7 +40,7 @@ export const Toast: FC = () => {
if (storedKeys) {
seenNotifications = JSON.parse(storedKeys) as SeenNotifications || {};
}
- } catch (e) { }
+ } catch { }
console.log(`[toast] Received notification ${notification.key}`);
if (seenNotifications[notification.key]) {
console.log(`[toast] Not showing notification ${notification.key} because has already been seen`);
diff --git a/packages/insomnia/src/ui/components/viewers/response-cookies-viewer.tsx b/packages/insomnia/src/ui/components/viewers/response-cookies-viewer.tsx
index 8e957d89374..b8fe7060ca4 100644
--- a/packages/insomnia/src/ui/components/viewers/response-cookies-viewer.tsx
+++ b/packages/insomnia/src/ui/components/viewers/response-cookies-viewer.tsx
@@ -16,7 +16,7 @@ export const ResponseCookiesViewer: FC = props => {
try {
cookie = h ? Cookie.parse(h.value || '', { loose: true }) : null;
- } catch (err) {
+ } catch {
console.warn('Failed to parse set-cookie header', h);
}
diff --git a/packages/insomnia/src/ui/components/viewers/response-viewer.tsx b/packages/insomnia/src/ui/components/viewers/response-viewer.tsx
index 553851aed8f..0839ad4a33d 100644
--- a/packages/insomnia/src/ui/components/viewers/response-viewer.tsx
+++ b/packages/insomnia/src/ui/components/viewers/response-viewer.tsx
@@ -127,7 +127,7 @@ export const ResponseViewer = ({
JSON.parse(overSizedBody.toString('utf8'));
return 'application/json';
}
- } catch (error) { }
+ } catch { }
// Try to detect HTML in all cases (even if header is set).
// It is fairly common for webservers to send errors in HTML by default.
// NOTE: This will probably never throw but I'm not 100% so wrap anyway
@@ -144,7 +144,7 @@ export const ResponseViewer = ({
) {
return 'text/html';
}
- } catch (error) { }
+ } catch { }
return lowercasedOriginalContentType;
}, [originalContentType, overSizedBody]);
@@ -245,7 +245,7 @@ export const ResponseViewer = ({
// So we try to use the native JSON.stringify to prettify the json string better. The native way can handle the issue.
try {
bodyStr = JSON.stringify(JSON.parse(bodyStr));
- } catch (err) { }
+ } catch { }
return (
= ({ environment }) => {
try {
query = extractQueryStringFromUrl(activeRequest.url);
- } catch (error) {
+ } catch {
console.warn('Failed to parse url to import querystring');
return;
}
@@ -391,44 +391,44 @@ export const WebSocketRequestPane: FC = ({ environment }) => {
Path parameters
- {pathParameters.length > 0 && (
+ {pathParameters.length > 0 && (
-
- {pathParameters.map(pathParameter => (
-
-
- {pathParameter.name}
-
-
- {
- onPathParameterChange(pathParameters.map(p => p.name === pathParameter.name ? { ...p, value: name } : p));
- }}
- />
-
-
- ))}
+
+ {pathParameters.map(pathParameter => (
+
+
+ {pathParameter.name}
+
+
+ {
+ onPathParameterChange(pathParameters.map(p => p.name === pathParameter.name ? { ...p, value: name } : p));
+ }}
+ />
+
+
+ ))}
+
-
- )}
- {pathParameters.length === 0 && !dismissPathParameterTip && (
-
-
- Path parameters are url path segments that start with a colon ':' e.g. ':id'
-
-
- )}
-
+ )}
+ {pathParameters.length === 0 && !dismissPathParameterTip && (
+
+
+ Path parameters are url path segments that start with a colon ':' e.g. ':id'
+
+
+ )}
+
diff --git a/packages/insomnia/src/ui/insomniaFetch.ts b/packages/insomnia/src/ui/insomniaFetch.ts
index 4c9ac789b91..27a309fce16 100644
--- a/packages/insomnia/src/ui/insomniaFetch.ts
+++ b/packages/insomnia/src/ui/insomniaFetch.ts
@@ -72,7 +72,7 @@ export async function insomniaFetch({
if (typeof json?.message === 'string') {
errMsg = json.message;
}
- } catch (err) {}
+ } catch { }
}
throw new ResponseFailError(errMsg, response);
}
diff --git a/packages/insomnia/src/ui/routes/actions.tsx b/packages/insomnia/src/ui/routes/actions.tsx
index bd81848f43b..347d7a5a289 100644
--- a/packages/insomnia/src/ui/routes/actions.tsx
+++ b/packages/insomnia/src/ui/routes/actions.tsx
@@ -1389,7 +1389,7 @@ export const accessAIApiAction: ActionFunction = async ({ params }) => {
return {
enabled: response.enabled,
};
- } catch (err) {
+ } catch {
return { enabled: false };
}
};
diff --git a/packages/insomnia/src/ui/routes/commands.tsx b/packages/insomnia/src/ui/routes/commands.tsx
index 982ef970315..f7fd3262fe1 100644
--- a/packages/insomnia/src/ui/routes/commands.tsx
+++ b/packages/insomnia/src/ui/routes/commands.tsx
@@ -340,7 +340,7 @@ export const remoteFilesLoader: LoaderFunction = async (): Promise {
let spec = {};
try {
spec = parseApiSpec(text).contents || {};
- } catch (err) { }
+ } catch { }
SwaggerUIBundle({ spec, dom_id: '#swagger-ui' });
}, [text]);
return (
@@ -468,47 +468,47 @@ const Design: FC = () => {