Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TS, React, TSLint, add Locale type checking #313

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ node_modules
dist
.cache-loader
build_utils
.vscode
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cSpell.words": [
"Unmount",
"Euroset",
"Alipay"
],
"typescript.tsdk": "node_modules/typescript/lib"
}
148 changes: 91 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"ismobilejs": "~0.4.1",
"libphonenumber-js": "1.1.4",
"lodash-es": "~4.17.15",
"react": "~16.6.3",
"react-dom": "~16.6.3",
"react": "~16.12.0",
"react-dom": "~16.12.0",
"react-redux": "~5.1.1",
"react-transition-group": "1.2.1",
"redux": "~3.7.2",
Expand All @@ -72,8 +72,8 @@
"@types/jest": "~23.3.14",
"@types/lodash-es": "~4.17.0",
"@types/node": "^11.13.18",
"@types/react": "~16.7.6",
"@types/react-dom": "~16.0.9",
"@types/react": "~16.9.19",
"@types/react-dom": "~16.9.5",
"@types/react-redux": "~5.0.21",
"@types/react-test-renderer": "~16.0.1",
"@types/react-transition-group": "1.1.5",
Expand Down Expand Up @@ -103,12 +103,12 @@
"thread-loader": "~2.1.2",
"ts-jest": "~23.10.5",
"ts-loader": "~5.3.3",
"tslint": "~5.11.0",
"tslint": "~6.0.0",
"tslint-config-prettier": "~1.18.0",
"tslint-immutable": "~4.5.1",
"tslint-loader": "~3.5.4",
"tslint-react": "~3.6.0",
"typescript": "~3.5.3",
"typescript": "~3.7.5",
"typescript-plugin-styled-components": "~1.0.0",
"webpack": "~4.29.0",
"webpack-bundle-analyzer": "~3.6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AppWrapper } from 'checkout/components/app/app-wrapper';
import { GlobalStyle } from 'checkout/components/app/global-style';

class AppDef extends React.Component<AppProps> {
componentWillMount() {
UNSAFE_componentWillMount() {
this.props.initApp(this.props.initConfig);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface ModalContentProps {
}

class ModalContentDef extends React.Component<ModalContentProps> {
componentWillMount() {
UNSAFE_componentWillMount() {
window.addEventListener('message', (e) => {
if (e.data === 'finish-interaction') {
this.props.finishInteraction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CardFormDef extends React.Component<Props> {
this.submit = this.submit.bind(this);
}

componentWillMount() {
UNSAFE_componentWillMount() {
const {
cardFormInfo: { paymentStatus },
formValues
Expand All @@ -68,7 +68,7 @@ class CardFormDef extends React.Component<Props> {
}
}

componentWillReceiveProps(props: Props) {
UNSAFE_componentWillReceiveProps(props: Props) {
if (props.submitFailed) {
props.setViewInfoError(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NumerableList, ListItem } from 'checkout/components/app/modal-container
import { Text } from '../text';

interface HelpDefProps {
errorCode: string;
errorCode: keyof Locale['form.help.codes'];
locale: Locale;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const mapDispatchToProps = (dispatch: Dispatch<any>) => ({
class PaymentMethodsDef extends React.Component<PaymentMethodsProps, PaymentMethodsState> {
private formElement: HTMLFormElement;

componentWillMount() {
UNSAFE_componentWillMount() {
const { methods } = this.props;
const visibilityThreshold = 3;
const visibleMethods = methods.filter((_m, i) => i < visibilityThreshold);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ const toReenterButtonText = (startedInfo: FormInfo, locale: Locale): string => {
return locale['form.button.use.other.card.label'];
case FormName.walletForm:
return locale['form.button.use.other.wallet.label'];
case FormName.terminalForm:
return locale['form.button.use.other.terminal.label'];
}
throw new Error('Unsupported form type');
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LogicError } from 'checkout/backend';
import { Text } from './text';

const getDescription = (l: Locale, e: LogicError): string => {
const result = l[e.code] ? l[e.code] : e.code;
const result: string = (l[e.code as keyof Locale] as string) || e.code;
if (e.message) {
return result ? result.concat(`.\n${e.message}`) : e.message;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class TerminalFormDef extends React.Component<Props> {
});
}

componentWillMount() {
UNSAFE_componentWillMount() {
const {
terminalFormInfo: { paymentStatus },
formValues
Expand All @@ -76,7 +76,7 @@ export class TerminalFormDef extends React.Component<Props> {
}
}

componentWillReceiveProps(props: Props) {
UNSAFE_componentWillReceiveProps(props: Props) {
if (props.submitFailed) {
props.setViewInfoError(true);
}
Expand Down
Loading