style: fix some compile warnings (#12)

* style: fix some compile warnings

* style: fix tslint error

* style: fix compile error
This commit is contained in:
kunzheng 2020-02-07 17:17:11 -08:00 коммит произвёл GitHub
Родитель 94f9f07800
Коммит 50138dc1cc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 34 добавлений и 14 удалений

Просмотреть файл

@ -21,6 +21,10 @@ steps:
if [ $? -ne 0 ]; then
exit 1
fi
npm run compile
if [ $? -ne 0 ]; then
exit 1
fi
npm run build
if [ $? -ne 0 ]; then
exit 1

Просмотреть файл

@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { AzureBlobStorageError } from "./azureBlobStorageError";
import { IStorageProvider } from "./storageProviderFactory";
import { IAsset, AssetType, StorageType, AssetState, AppError } from "../../models/applicationState";
import { AssetService } from "../../services/assetService";
@ -136,7 +137,7 @@ export class AzureBlobStorage implements IStorageProvider {
marker,
);
if (!listBlobsResponse.segment || !listBlobsResponse.containerName) {
throw { statusCode: 404 };
throw new AzureBlobStorageError(404);
}
marker = listBlobsResponse.nextMarker;
for (const blob of listBlobsResponse.segment.blobItems) {

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
export class AzureBlobStorageError extends Error {
public statusCode: number;
constructor(statusCode: number) {
super();
this.statusCode = statusCode;
}
}

Просмотреть файл

@ -383,7 +383,6 @@ export class TagInput extends React.Component<ITagInputProps, ITagInputState> {
}
private getFieldAlignConfig = () => {
const coords = this.getEditingTagCoords();
return {
// Align top right of source node (color picker) with top left of target node (tag row)
points: ["tr", "cr"],

Просмотреть файл

@ -21,6 +21,7 @@ describe("Tag Input Item", () => {
onChange: jest.fn(),
onLabelEnter: jest.fn(),
onLabelLeave: jest.fn(),
onCallDropDown: jest.fn(),
};
}

Просмотреть файл

@ -129,6 +129,8 @@ export default class TagInputToolbar extends React.Component<ITagInputToolbarPro
onClick={(e) => this.onToolbarItemClick(e, itemConfig)}>
<i className={`${classNames.join(" ")} ${itemConfig.icon}`} />
</div>);
} else {
throw new Error(`Unsupported item category ${itemConfig.category}`);
}
})
);

Просмотреть файл

@ -67,9 +67,6 @@ export default class TagTypeFormat extends React.Component<ITagTypeFormatProps,
showFormat: false,
showType: false,
};
constructor(props) {
super(props);
}
public render() {
const tag = this.state.tag;

Просмотреть файл

@ -886,6 +886,7 @@ export default class Canvas extends React.Component<ICanvasProps, ICanvasState>
orderInfo = { page: pageNumber + 1, order };
return true;
}
return false;
});
return orderInfo;
@ -929,6 +930,8 @@ export default class Canvas extends React.Component<ICanvasProps, ICanvasState>
}
});
}
return ocr;
});
}

Просмотреть файл

@ -33,7 +33,7 @@ export default class TrainRecord extends React.Component<ITrainRecordProps, ITra
{(this.props.averageAccuracy * 100).toFixed(2) + "%"}
</p>
<div className="accuracy-info">
<a href="https://aka.ms/form-recognizer/docs/train" target="_blank">
<a href="https://aka.ms/form-recognizer/docs/train" target="_blank" rel="noopener noreferrer">
<i className={"ms-Icon ms-Icon--Info"}/>
<span>Learn more about improving model accuracy.</span>
</a>

Просмотреть файл

@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { Dispatch, Action } from "redux";
import { createPayloadAction, IPayloadAction, createAction } from "./actionCreators";
import { Dispatch } from "redux";
import { createPayloadAction, IPayloadAction } from "./actionCreators";
import { ActionTypes } from "./actionTypes";
/**

Просмотреть файл

@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { Action, Dispatch } from "redux";
import { Dispatch } from "redux";
import { ActionTypes } from "./actionTypes";
import { createPayloadAction, createAction, IPayloadAction } from "./actionCreators";
import { createPayloadAction, IPayloadAction } from "./actionCreators";
import { IAppSettings } from "../../models/applicationState";
import { IProject, IApplicationState } from "../../models/applicationState";
import { generateKey } from "../../common/crypto";

Просмотреть файл

@ -223,8 +223,8 @@ describe("Project Redux Actions", () => {
const actualUpdatedAssets = await projectActions.updateProjectTag(
project,
updatedTag.name,
expectedTagName,
updatedTag,
{ ...updatedTag, name: expectedTagName },
)(store.dispatch, store.getState);
const actions = store.getActions();

Просмотреть файл

@ -3,7 +3,7 @@
import _ from "lodash";
import { reducer } from "./currentProjectReducer";
import { IProject, IAssetMetadata, AssetState, ITag } from "../../models/applicationState";
import { IProject, IAssetMetadata, AssetState, ITag, FieldType, FieldFormat } from "../../models/applicationState";
import MockFactory from "../../common/mockFactory";
import {
loadProjectAction,
@ -124,6 +124,8 @@ describe("Current Project Reducer", () => {
const expectedTag: ITag = {
name: "NEWTAG",
color: expect.any(String),
type: FieldType.String,
format: FieldFormat.NotSpecified,
};
const assetMetadata = MockFactory.createTestAssetMetadata(

Просмотреть файл

@ -6,7 +6,7 @@ import _ from "lodash";
import Guard from "../common/guard";
import {
IAsset, AssetType, IProject, IAssetMetadata, AssetState,
IRegion, RegionType, ILabelData, ILabel,
ILabelData, ILabel,
} from "../models/applicationState";
import { AssetProviderFactory, IAssetProvider } from "../providers/storage/assetProviderFactory";
import { StorageProviderFactory, IStorageProvider } from "../providers/storage/storageProviderFactory";