From b0b7061b7af67d0e3111a60a6724684ae1b3c072 Mon Sep 17 00:00:00 2001 From: jbpenrath Date: Tue, 20 Aug 2024 11:47:12 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F(deps)=20migrate=20to=20types?= =?UTF-8?q?cript-eslint=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A major version of typescript-eslint has been released. This version contains some breaking change and rules change so we have to tweak our eslint configuration. https://main--typescript-eslint.netlify.app/blog/announcing-typescript-eslint-v8 --- packages/eslint-config-custom/.eslintrc.json | 8 +++++++- packages/react/cunningham.ts | 3 ++- packages/react/src/components/Forms/DatePicker/utils.ts | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/eslint-config-custom/.eslintrc.json b/packages/eslint-config-custom/.eslintrc.json index 0eb459e..53157b4 100644 --- a/packages/eslint-config-custom/.eslintrc.json +++ b/packages/eslint-config-custom/.eslintrc.json @@ -99,7 +99,13 @@ "react/prop-types": "off", "react/react-in-jsx-scope": "off", "react/require-default-props": "off", - "react/style-prop-object": ["error", { "allow": ["FormattedNumber"] }] + "react/style-prop-object": ["error", { "allow": ["FormattedNumber"] }], + /* + The two following rules can be removed once airbnb-typescript will be updated (18.0.0) + https://github.com/iamturns/eslint-config-airbnb-typescript/issues/354 + */ + "@typescript-eslint/no-throw-literal": "off", + "@typescript-eslint/only-throw-error": "error" }, "settings": { "polyfills": ["fetch", "Promise"], diff --git a/packages/react/cunningham.ts b/packages/react/cunningham.ts index ff7e494..d858382 100644 --- a/packages/react/cunningham.ts +++ b/packages/react/cunningham.ts @@ -26,7 +26,8 @@ files.forEach((file) => { .replace(sep, "-"); components[componentName] = res.tokens(defaultTokenRefs); - } catch (error) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + } catch (_error) { throw new Error("Could not find component name from file path " + file); } }); diff --git a/packages/react/src/components/Forms/DatePicker/utils.ts b/packages/react/src/components/Forms/DatePicker/utils.ts index c38e554..aa6a32e 100644 --- a/packages/react/src/components/Forms/DatePicker/utils.ts +++ b/packages/react/src/components/Forms/DatePicker/utils.ts @@ -25,7 +25,8 @@ export const isValidTimeZone = (timezone: string) => { Intl.DateTimeFormat(undefined, { timeZone: timezone }); return true; - } catch (error) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + } catch (_error) { // If an error occurs, it could be due to an invalid time zone or lack of Intl support return false; }