From 57b530aa43d5664bdc31e619faf7b7c1f23c9f25 Mon Sep 17 00:00:00 2001 From: Cody Olsen Date: Tue, 27 Feb 2024 08:47:00 +0100 Subject: [PATCH] chore: fix linter issues --- .eslintignore | 1 + package-lock.json | 23 +++++++++++++++++++---- package.json | 13 +++---------- test/signature.test.ts | 4 ++-- 4 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..53c37a1 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +dist \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 19787c8..b3764b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "body-parser": "^1.20.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", - "eslint-config-sanity": "^7.0.2", + "eslint-config-sanity": "^7.1.0", "eslint-plugin-prettier": "^5.1.3", "express": "^4.18.2", "ls-engines": "^0.9.1", @@ -6067,10 +6067,13 @@ } }, "node_modules/eslint-config-sanity": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/eslint-config-sanity/-/eslint-config-sanity-7.0.2.tgz", - "integrity": "sha512-0QOqc75lJjkmPQXmc31ZKu05cE75HuEE3WWKaRV5zsXZFz3cxWqHr5XPNi24uH6ZVnxLlQsgiE9eq7eKHOHtSg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-sanity/-/eslint-config-sanity-7.1.0.tgz", + "integrity": "sha512-B/8cAYen6BHJpgRKUgPAfffPo+G3x8s8o9upqh+/BOEeoJ2ienHP65HXD1gAOxMoyocNOlfdTYsxRFwz2lyQQQ==", "dev": true, + "dependencies": { + "eslint-plugin-simple-import-sort": "^12.0.0" + }, "engines": { "node": ">=14.0.0" }, @@ -6093,6 +6096,9 @@ }, "eslint-plugin-react": { "optional": true + }, + "eslint-plugin-react-hooks": { + "optional": true } } }, @@ -6126,6 +6132,15 @@ } } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.0.0.tgz", + "integrity": "sha512-8o0dVEdAkYap0Cn5kNeklaKcT1nUsa3LITWEuFk3nJifOoD+5JQGoyDUW2W/iPWwBsNBJpyJS9y4je/BgxLcyQ==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", diff --git a/package.json b/package.json index 67faf6d..14c949a 100644 --- a/package.json +++ b/package.json @@ -60,19 +60,12 @@ "browser": false, "node": true }, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier" - ], + "plugins": ["prettier"], "extends": [ - "plugin:@typescript-eslint/recommended", - "prettier/@typescript-eslint", - "sanity", + "sanity/typescript", "prettier" ], "rules": { - "operator-linebreak": "off", "prettier/prettier": "error" }, "root": true @@ -93,7 +86,7 @@ "body-parser": "^1.20.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", - "eslint-config-sanity": "^7.0.2", + "eslint-config-sanity": "^7.1.0", "eslint-plugin-prettier": "^5.1.3", "express": "^4.18.2", "ls-engines": "^0.9.1", diff --git a/test/signature.test.ts b/test/signature.test.ts index 8de2796..9c53b89 100644 --- a/test/signature.test.ts +++ b/test/signature.test.ts @@ -212,14 +212,14 @@ describe.runIf(isWebCrypto)('signature', () => { test('throws on non-string payload', async () => { await expect( - // @ts-expect-error + // @ts-expect-error (testing invalid input) () => encodeSignatureHeader({}, timestamp, secret), ).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Payload must be a JSON-encoded string]`) }) test('throws on invalid timestamp type (invalid type)', async () => { await expect(() => - // @ts-expect-error + // @ts-expect-error (testing invalid input) encodeSignatureHeader(stringifiedPayload, 'foo', secret), ).rejects.toThrowErrorMatchingInlineSnapshot( `[Error: Invalid signature timestamp, must be a unix timestamp with millisecond precision]`,