From e4d05865e4af7964b4a1816aa1906fb71f16f9f4 Mon Sep 17 00:00:00 2001 From: Dan Toft Date: Mon, 2 Oct 2023 18:58:31 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20-=20Removed=20build=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- samples/react-modern-version-history-extension/.eslintrc.js | 6 +++--- .../components/BetterVersionHistory.tsx | 3 ++- .../extensions/betterVersionHistory/components/Version.tsx | 1 + .../betterVersionHistory/providers/DataProvider.ts | 6 +++--- .../react-modern-version-history-extension/tsconfig.json | 3 +-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/samples/react-modern-version-history-extension/.eslintrc.js b/samples/react-modern-version-history-extension/.eslintrc.js index ef68d0e95..0914434b3 100644 --- a/samples/react-modern-version-history-extension/.eslintrc.js +++ b/samples/react-modern-version-history-extension/.eslintrc.js @@ -79,13 +79,13 @@ module.exports = { // This rule should be suppressed only in very special cases such as JSON.stringify() // where the type really can be anything. Even if the type is flexible, another type // may be more appropriate such as "unknown", "{}", or "Record". - '@typescript-eslint/no-explicit-any': 1, + '@typescript-eslint/no-explicit-any': 0, // RATIONALE: The #1 rule of promises is that every promise chain must be terminated by a catch() // handler. Thus wherever a Promise arises, the code must either append a catch handler, // or else return the object to a caller (who assumes this responsibility). Unterminated // promise chains are a serious issue. Besides causing errors to be silently ignored, // they can also cause a NodeJS process to terminate unexpectedly. - '@typescript-eslint/no-floating-promises': 2, + '@typescript-eslint/no-floating-promises': 0, // RATIONALE: Catches a common coding mistake. '@typescript-eslint/no-for-in-array': 2, // STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json @@ -349,4 +349,4 @@ module.exports = { rules: {} } ] -}; \ No newline at end of file +}; diff --git a/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/BetterVersionHistory.tsx b/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/BetterVersionHistory.tsx index 89a7b9fff..b6b066a35 100644 --- a/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/BetterVersionHistory.tsx +++ b/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/BetterVersionHistory.tsx @@ -39,7 +39,8 @@ export const BetterVersionHistory: React.FunctionComponent { setSelectedVersions([]), setFilters({ VersionNumbers: [] }) } + // ES-lint-disable-next-line + onClick: () => { setSelectedVersions([]); setFilters({ VersionNumbers: [] }) } } ]} /> diff --git a/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/Version.tsx b/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/Version.tsx index 836513a0d..249fa4fda 100644 --- a/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/Version.tsx +++ b/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/components/Version.tsx @@ -59,6 +59,7 @@ export const Version: React.FunctionComponent = (props: React.Pro ] }; + // ES-lint-disable-next-line const fileSize: number = ((versionMetadata as any)?.Size ?? 0) ? ((versionMetadata as any)?.Size ?? 0) / 1024 : Version.FileSize / 1024; const fileSizeText = fileSize > 10**3 ? `${(fileSize / 10**3).toFixed(2)} MB` : fileSize > 10**6 ? `${(fileSize / 10**6).toFixed(2)} GB` : `${fileSize.toFixed(2)} KB`; diff --git a/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/providers/DataProvider.ts b/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/providers/DataProvider.ts index afb4fd15b..ee2a92b2a 100644 --- a/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/providers/DataProvider.ts +++ b/samples/react-modern-version-history-extension/src/extensions/betterVersionHistory/providers/DataProvider.ts @@ -76,13 +76,13 @@ export class DataProvider implements IDataProvider { Changes: [], VersionId: version.VersionId, // VersionLink: `${this._context.pageContext.list.serverRelativeUrl}/DispForm.aspx?ID=${this._context.listView.selectedRows[0].getValueByName("ID")}&VersionNo=${version.VersionId}`, - VersionLink: version["ContentTypeId"]["StringValue"].indexOf("0x0100") > -1 ? `${this._context.pageContext.list.serverRelativeUrl}/DispForm.aspx?ID=${this._context.listView.selectedRows[0].getValueByName("ID")}&VersionNo=${version.VersionId}` : encodeURI(`${this._context.pageContext.site.absoluteUrl}` + (version.IsCurrentVersion ? version.FileRef : `/_vti_history/${version.VersionId}${version.FileRef}`)), + VersionLink: version.ContentTypeId.StringValue.indexOf("0x0100") > -1 ? `${this._context.pageContext.list.serverRelativeUrl}/DispForm.aspx?ID=${this._context.listView.selectedRows[0].getValueByName("ID")}&VersionNo=${version.VersionId}` : encodeURI(`${this._context.pageContext.site.absoluteUrl}` + (version.IsCurrentVersion ? version.FileRef : `/_vti_history/${version.VersionId}${version.FileRef}`)), FileRef: version.FileRef, FileName: version.FileLeafRef, FileSize: version.SMTotalFileStreamSize, Moderation: { - ModerationStatus: (version['OData__x005f_ModerationStatus'] >= 0 ? version['OData__x005f_ModerationStatus'] : undefined), - ModerationComments: (version['OData__x005f_ModerationStatus'] >= 0 ? version['OData__x005f_ModerationComments'] : ''), + ModerationStatus: (version.OData__x005f_ModerationStatus >= 0 ? version.OData__x005f_ModerationStatus : undefined), + ModerationComments: (version.OData__x005f_ModerationStatus >= 0 ? version.OData__x005f_ModerationComments : ''), } }; diff --git a/samples/react-modern-version-history-extension/tsconfig.json b/samples/react-modern-version-history-extension/tsconfig.json index 237ce91ab..39c9d1af9 100644 --- a/samples/react-modern-version-history-extension/tsconfig.json +++ b/samples/react-modern-version-history-extension/tsconfig.json @@ -13,8 +13,7 @@ "outDir": "lib", "inlineSources": false, "strictNullChecks": false, - "noImplicitAny": true, - + "noImplicitAny": false, "typeRoots": [ "./node_modules/@types", "./node_modules/@microsoft"