From 2d506f03124d4ef2595529d2d5e0fc831dcbb9d1 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Yadav <79906609+sunilyadav840@users.noreply.github.com> Date: Thu, 13 May 2021 05:53:10 +0530 Subject: [PATCH] Add Files to TypeScript Strict Mode (#777) --- src/Common/Tooltip/InfoTooltip.tsx | 2 +- src/Explorer/Controls/Dialog.tsx | 2 +- src/Explorer/Controls/Header/GalleryHeaderComponent.tsx | 4 ++-- src/Explorer/Notebook/NotebookRenderer/Prompt.tsx | 2 +- .../Notebook/NotebookRenderer/decorators/CellLabeler.tsx | 7 +++---- src/hooks/useGraphPhoto.tsx | 2 +- tsconfig.strict.json | 9 ++++++++- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Common/Tooltip/InfoTooltip.tsx b/src/Common/Tooltip/InfoTooltip.tsx index c16e22ce8..480aa9020 100644 --- a/src/Common/Tooltip/InfoTooltip.tsx +++ b/src/Common/Tooltip/InfoTooltip.tsx @@ -5,7 +5,7 @@ export interface TooltipProps { children: string; } -export const InfoTooltip: React.FunctionComponent = ({ children }: TooltipProps) => { +export const InfoTooltip: React.FunctionComponent = ({ children }: TooltipProps) => { return ( diff --git a/src/Explorer/Controls/Dialog.tsx b/src/Explorer/Controls/Dialog.tsx index 779cdb049..3481e4a1f 100644 --- a/src/Explorer/Controls/Dialog.tsx +++ b/src/Explorer/Controls/Dialog.tsx @@ -103,7 +103,7 @@ export const Dialog: FunctionComponent = ({ text: secondaryButtonText, onClick: onSecondaryButtonClick, } - : undefined; + : {}; return ( diff --git a/src/Explorer/Controls/Header/GalleryHeaderComponent.tsx b/src/Explorer/Controls/Header/GalleryHeaderComponent.tsx index 4f5489d98..a3c7cc2f7 100644 --- a/src/Explorer/Controls/Header/GalleryHeaderComponent.tsx +++ b/src/Explorer/Controls/Header/GalleryHeaderComponent.tsx @@ -1,5 +1,5 @@ +import { CommandButton, FontIcon, FontWeights, ITextProps, Separator, Stack, Text } from "@fluentui/react"; import * as React from "react"; -import { Stack, Text, Separator, FontIcon, CommandButton, FontWeights, ITextProps } from "@fluentui/react"; export class GalleryHeaderComponent extends React.Component { private static readonly azureText = "Microsoft Azure"; @@ -61,7 +61,7 @@ export class GalleryHeaderComponent extends React.Component { {this.renderHeaderItem( GalleryHeaderComponent.galleryText, - undefined, + () => "", GalleryHeaderComponent.headerItemTextProps )} diff --git a/src/Explorer/Notebook/NotebookRenderer/Prompt.tsx b/src/Explorer/Notebook/NotebookRenderer/Prompt.tsx index af81cd347..b8d95fa67 100644 --- a/src/Explorer/Notebook/NotebookRenderer/Prompt.tsx +++ b/src/Explorer/Notebook/NotebookRenderer/Prompt.tsx @@ -53,7 +53,7 @@ export class PromptPure extends React.Component { } } -const makeMapStateToProps = (state: CdbAppState, ownProps: ComponentProps): ((state: CdbAppState) => StateProps) => { +const makeMapStateToProps = (_state: CdbAppState, ownProps: ComponentProps): ((state: CdbAppState) => StateProps) => { const mapStateToProps = (state: CdbAppState) => { const { contentRef, id } = ownProps; const model = selectors.model(state, { contentRef }); diff --git a/src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx b/src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx index 45fc1cde9..cfef39026 100644 --- a/src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx +++ b/src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx @@ -1,10 +1,9 @@ +import { AppState, ContentRef, DocumentRecordProps, selectors } from "@nteract/core"; +import { RecordOf } from "immutable"; import React from "react"; import { connect } from "react-redux"; import "./CellLabeler.less"; -import { AppState, ContentRef, selectors, DocumentRecordProps } from "@nteract/core"; -import { RecordOf } from "immutable"; - interface ComponentProps { id: string; contentRef: ContentRef; // TODO: Make this per contentRef? @@ -29,7 +28,7 @@ class CellLabeler extends React.Component { } } -const makeMapStateToProps = (state: AppState, ownProps: ComponentProps): ((state: AppState) => StateProps) => { +const makeMapStateToProps = (_state: AppState, ownProps: ComponentProps): ((state: AppState) => StateProps) => { const mapStateToProps = (state: AppState) => { const model = selectors.model(state, { contentRef: ownProps.contentRef }); const cellOrder = selectors.notebook.cellOrder(model as RecordOf); diff --git a/src/hooks/useGraphPhoto.tsx b/src/hooks/useGraphPhoto.tsx index 1afdc56cb..e09efeb04 100644 --- a/src/hooks/useGraphPhoto.tsx +++ b/src/hooks/useGraphPhoto.tsx @@ -18,7 +18,7 @@ export async function fetchPhoto(accessToken: string): Promise { } export function useGraphPhoto(graphToken: string): string { - const [photo, setPhoto] = useState(); + const [photo, setPhoto] = useState(""); useEffect(() => { if (graphToken) { diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 15c304aec..7443dd212 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -8,6 +8,13 @@ "noUnusedParameters": true }, "files": [ + "./src/hooks/useGraphPhoto.tsx", + "./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx", + "./src/Explorer/Notebook/NotebookRenderer/Prompt.tsx", + "./src/Explorer/Controls/Header/GalleryHeaderComponent.tsx", + "./src/Explorer/Controls/Header/GalleryHeaderComponent.tsx", + "./src/Explorer/Controls/Dialog.tsx", + "./src/Common/Tooltip/InfoTooltip.tsx", "./src/AuthType.ts", "./src/Bindings/ReactBindingHandler.ts", "./src/Common/ArrayHashMap.ts", @@ -129,4 +136,4 @@ "src/Terminal/**/*", "src/Utils/arm/**/*" ] -} +} \ No newline at end of file