diff --git a/.changeset/poor-spies-grin.md b/.changeset/poor-spies-grin.md new file mode 100644 index 0000000000..cab5df9029 --- /dev/null +++ b/.changeset/poor-spies-grin.md @@ -0,0 +1,5 @@ +--- +'@backstage/config': patch +--- + +Fix unneeded defensive code diff --git a/.changeset/seven-tigers-mate.md b/.changeset/seven-tigers-mate.md new file mode 100644 index 0000000000..c48bcf649a --- /dev/null +++ b/.changeset/seven-tigers-mate.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Fix string template literal diff --git a/.changeset/violet-windows-run.md b/.changeset/violet-windows-run.md new file mode 100644 index 0000000000..5f385d4dfe --- /dev/null +++ b/.changeset/violet-windows-run.md @@ -0,0 +1,5 @@ +--- +'@backstage/config': patch +--- + +Fix useless conditional diff --git a/packages/config/src/reader.ts b/packages/config/src/reader.ts index eb8c91e366..cd0a6f3221 100644 --- a/packages/config/src/reader.ts +++ b/packages/config/src/reader.ts @@ -272,23 +272,17 @@ export class ConfigReader implements Config { if (value === undefined) { return this.fallback?.readConfigValue(key, validate); } - if (value !== undefined) { - const result = validate(value); - if (result !== true) { - const { - key: keyName = key, - value: theValue = value, + const result = validate(value); + if (result !== true) { + const { key: keyName = key, value: theValue = value, expected } = result; + throw new TypeError( + errors.type( + this.fullKey(keyName), + this.context, + typeOf(theValue), expected, - } = result; - throw new TypeError( - errors.type( - this.fullKey(keyName), - this.context, - typeOf(theValue), - expected, - ), - ); - } + ), + ); } return value as T; diff --git a/plugins/catalog-backend/src/ingestion/processors/microsoftGraph/client.ts b/plugins/catalog-backend/src/ingestion/processors/microsoftGraph/client.ts index 6dded56aa1..9db76542f4 100644 --- a/plugins/catalog-backend/src/ingestion/processors/microsoftGraph/client.ts +++ b/plugins/catalog-backend/src/ingestion/processors/microsoftGraph/client.ts @@ -184,7 +184,7 @@ export class MicrosoftGraphClient { const response = await this.requestApi(`organization/${tenantId}`); if (response.status !== 200) { - await this.handleError('organization/${tenantId}', response); + await this.handleError(`organization/${tenantId}`, response); } return await response.json(); diff --git a/plugins/catalog/src/components/EntityPageLayout/Tabbed/Tabbed.tsx b/plugins/catalog/src/components/EntityPageLayout/Tabbed/Tabbed.tsx index 096b2fa708..9a4e872d8f 100644 --- a/plugins/catalog/src/components/EntityPageLayout/Tabbed/Tabbed.tsx +++ b/plugins/catalog/src/components/EntityPageLayout/Tabbed/Tabbed.tsx @@ -39,8 +39,8 @@ const getSelectedIndexOrDefault = ( /** * Compound component, which allows you to define layout - * for EntityPage using Tabs as a subnavigation mechanism - * Constists of 2 parts: Tabbed.Layout and Tabbed.Content. + * for EntityPage using Tabs as a sub-navigation mechanism + * Consists of 2 parts: Tabbed.Layout and Tabbed.Content. * Takes care of: tabs, routes, document titles, spacing around content * * @example diff --git a/plugins/catalog/src/components/Router.tsx b/plugins/catalog/src/components/Router.tsx index fe1ba3a593..298aa28d52 100644 --- a/plugins/catalog/src/components/Router.tsx +++ b/plugins/catalog/src/components/Router.tsx @@ -50,7 +50,7 @@ const EntityPageSwitch = ({ EntityPage }: { EntityPage: ComponentType }) => { const { entity, loading, error } = useEntity(); // Loading and error states if (loading) return ; - if (error || (!loading && !entity)) return ; + if (error || !entity) return ; // Otherwise EntityPage provided from the App // Note that EntityPage will include EntityPageLayout already