From 8c82cb2c10ec3736bf0051dc93731fe5de2d2054 Mon Sep 17 00:00:00 2001 From: Khangarid Bayarsaikhan Date: Wed, 17 Oct 2018 01:00:49 +0800 Subject: [PATCH] Fixed some module's no-lambda and other tslint warnings --- src/locales/index.ts | 1 + src/modules/auth/routes.tsx | 52 +- src/modules/common/components/Chooser.tsx | 13 +- src/modules/common/components/CountsByTag.tsx | 11 +- src/modules/common/components/DateFilter.tsx | 21 +- .../common/components/FilterByParams.tsx | 10 +- .../common/components/ModifiableSelect.tsx | 20 +- src/modules/common/components/SortHandler.tsx | 4 +- src/modules/common/components/Uploader.tsx | 2 +- .../common/components/editor/Editor.tsx | 4 +- .../common/components/filter/Filter.tsx | 6 +- .../filterableList/FilterableList.tsx | 4 +- .../common/components/form/Textarea.tsx | 8 +- .../components/pagination/PerPageChooser.tsx | 2 +- src/modules/common/components/step/Step.tsx | 12 +- src/modules/common/styles/global-styles.ts | 1406 +++++++++-------- src/modules/common/utils/uploadHandler.ts | 2 +- .../components/common/CompanySection.tsx | 18 +- .../companies/components/detail/BasicInfo.tsx | 24 +- .../components/detail/CompaniesMerge.tsx | 27 +- .../components/detail/CompanyDetails.tsx | 10 +- .../components/list/CompaniesList.tsx | 52 +- .../companies/components/list/CompanyForm.tsx | 35 +- .../companies/components/list/CompanyRow.tsx | 26 +- .../companies/containers/CompaniesList.tsx | 19 +- src/modules/companies/routes.tsx | 48 +- .../components/common/ActionSection.tsx | 40 +- .../components/common/CustomerSection.tsx | 18 +- .../components/common/InfoSection.tsx | 8 +- .../components/common/TargetMerge.tsx | 28 +- .../components/detail/CustomerDetails.tsx | 10 +- .../components/detail/CustomersMerge.tsx | 29 +- .../customers/components/list/BrandFilter.tsx | 8 +- .../components/list/CustomerForm.tsx | 33 +- .../customers/components/list/CustomerRow.tsx | 10 +- .../components/list/CustomersList.tsx | 56 +- .../customers/components/list/FormFilter.tsx | 8 +- .../components/list/IntegrationFilter.tsx | 8 +- .../components/list/LeadStatusFilter.tsx | 19 +- .../components/list/LifecycleStateFilter.tsx | 19 +- .../customers/containers/CustomersList.tsx | 17 +- src/modules/customers/routes.tsx | 47 +- src/modules/deals/routes.tsx | 41 +- src/modules/engage/routes.tsx | 84 +- src/modules/forms/routes.tsx | 85 +- .../workarea/RespondBox.tsx | 4 +- .../twitter/TwitterVideoEmbed.tsx | 2 +- .../containers/conversationDetail/Sidebar.tsx | 2 +- src/modules/inbox/routes.tsx | 23 +- src/modules/insights/routes.tsx | 122 +- .../components/knowledge/KnowledgeForm.tsx | 4 +- src/modules/notifications/routes.tsx | 26 +- src/modules/segments/routes.tsx | 82 +- src/modules/settings/email/routes.tsx | 46 +- .../settings/emailTemplates/routes.tsx | 15 +- src/modules/settings/general/routes.tsx | 15 +- src/modules/settings/importHistory/routes.tsx | 20 +- .../components/google/MailForm.tsx | 4 +- src/modules/settings/integrations/routes.tsx | 218 +-- .../settings/productService/routes.tsx | 15 +- src/modules/settings/profile/routes.tsx | 25 +- src/modules/settings/properties/routes.tsx | 17 +- .../settings/responseTemplates/routes.tsx | 17 +- src/modules/settings/team/routes.tsx | 52 +- src/modules/tags/routes.tsx | 15 +- tslint.json | 6 - 66 files changed, 1594 insertions(+), 1541 deletions(-) diff --git a/src/locales/index.ts b/src/locales/index.ts index ff6197e0b..8a05351b7 100644 --- a/src/locales/index.ts +++ b/src/locales/index.ts @@ -1,3 +1,4 @@ +// tslint:disable const en = require('./en.json'); const mn = require('./mn.json'); diff --git a/src/modules/auth/routes.tsx b/src/modules/auth/routes.tsx index 573a7acea..34a4f0ab1 100755 --- a/src/modules/auth/routes.tsx +++ b/src/modules/auth/routes.tsx @@ -4,39 +4,29 @@ import { Route } from 'react-router-dom'; import { AuthLayout } from '../layout/components'; import { ForgotPassword, ResetPassword, SignIn } from './containers'; -const routes = () => ( - - { - return } />; - }} - /> +const routes = () => { + const home = () => } />; + const signIn = () => } />; + const forgotPassword = () => } />; - { - return } />; - }} - /> + const resetPassword = ({ location }) => { + const parsed = queryString.parse(location.search); + return ( + } /> + ); + }; - { - return } />; - }} - /> + return ( + + - { - const parsed = queryString.parse(location.search); - return ( - } /> - ); - }} - /> - -); + + + + + + + ); +}; export default routes; diff --git a/src/modules/common/components/Chooser.tsx b/src/modules/common/components/Chooser.tsx index a54b68cc7..c14f81786 100644 --- a/src/modules/common/components/Chooser.tsx +++ b/src/modules/common/components/Chooser.tsx @@ -46,7 +46,6 @@ class CommonChooser extends React.Component { }; this.onSelect = this.onSelect.bind(this); - this.handleChange = this.handleChange.bind(this); this.search = this.search.bind(this); this.loadMore = this.loadMore.bind(this); } @@ -105,7 +104,7 @@ class CommonChooser extends React.Component { } return ( -
  • this.handleChange(icon, data)}> +
  • {this.props.renderName(data)}
  • @@ -125,7 +124,7 @@ class CommonChooser extends React.Component { } render() { - const { renderForm, datas, title, data } = this.props; + const { renderForm, datas, title, data, closeModal } = this.props; const selectedDatas = this.state.datas; const addTrigger = ( @@ -141,7 +140,7 @@ class CommonChooser extends React.Component { this.search(e)} + onChange={this.search} />
      {datas.map(dataItem => this.renderRow(dataItem, 'add'))} @@ -177,11 +176,7 @@ class CommonChooser extends React.Component { content={renderForm} />
      - diff --git a/src/modules/common/components/FilterByParams.tsx b/src/modules/common/components/FilterByParams.tsx index 023923969..e1309a2dc 100644 --- a/src/modules/common/components/FilterByParams.tsx +++ b/src/modules/common/components/FilterByParams.tsx @@ -48,6 +48,12 @@ class FilterByParams extends React.Component { } } + onClick(paramKey: string, fieldId: string) { + const { history } = this.props; + + router.setParams(history, { [paramKey]: fieldId }); + } + renderItems() { const { history, fields, counts, paramKey, icon, searchable } = this.props; const { key } = this.state; @@ -75,9 +81,7 @@ class FilterByParams extends React.Component { ? 'active' : '' } - onClick={() => { - router.setParams(history, { [paramKey]: field._id }); - }} + onClick={this.onClick.bind(this, paramKey, field._id)} > {icon ? ( diff --git a/src/modules/common/components/ModifiableSelect.tsx b/src/modules/common/components/ModifiableSelect.tsx index 781f961e8..173f37ae8 100644 --- a/src/modules/common/components/ModifiableSelect.tsx +++ b/src/modules/common/components/ModifiableSelect.tsx @@ -5,7 +5,7 @@ import { __, Alert } from '../utils'; type OptionProps = { option: any; - onSelect: (option: any[], e: any) => void; + onSelect: (option: any[]) => void; }; class Option extends React.Component { @@ -19,11 +19,11 @@ class Option extends React.Component { }; return ( -
      onSelect(option, e)}> +
      {option.label} onRemove(option.value)} + onClick={onRemove(option.value)} icon="cancel-1" />
      @@ -80,7 +80,11 @@ class ModifiableSelect extends React.Component { return {selectedOption}; } - handleSave() { + handleSave(e) { + if (e.key !== 'Enter') { + return; + } + const { options, selectedOption } = this.state; const { onChange } = this.props; const value = (document.getElementById( @@ -157,11 +161,7 @@ class ModifiableSelect extends React.Component { { - if (e.key === 'Enter') { - this.handleSave(); - } - }} + onKeyPress={this.handleSave} />
      ); diff --git a/src/modules/common/components/Uploader.tsx b/src/modules/common/components/Uploader.tsx index f55788b5a..7241df117 100644 --- a/src/modules/common/components/Uploader.tsx +++ b/src/modules/common/components/Uploader.tsx @@ -95,7 +95,7 @@ class Uploader extends React.Component { alt="attachment" src="/images/attach.svg" style={attachmentPreviewStyle} - onClick={e => this.removeAttachment(e)} + onClick={this.removeAttachment} /> ))} {loading && } diff --git a/src/modules/common/components/editor/Editor.tsx b/src/modules/common/components/editor/Editor.tsx index 8256c8331..6839675d9 100755 --- a/src/modules/common/components/editor/Editor.tsx +++ b/src/modules/common/components/editor/Editor.tsx @@ -191,7 +191,9 @@ export class ErxesEditor extends React.Component { this.toggleInlineStyle = this.toggleInlineStyle.bind(this); } - focus() {} + focus() { + return; + } onTab(e) { const { onChange, editorState } = this.props; diff --git a/src/modules/common/components/filter/Filter.tsx b/src/modules/common/components/filter/Filter.tsx index 01f43c6b1..18161a4ef 100644 --- a/src/modules/common/components/filter/Filter.tsx +++ b/src/modules/common/components/filter/Filter.tsx @@ -28,7 +28,7 @@ function Filter({ queryParams = {}, history }: IProps) { } return ( - onClickClose([paramKey])}> + {bool ? paramKey : queryParams[paramKey]} ); @@ -53,7 +53,7 @@ function Filter({ queryParams = {}, history }: IProps) { const ChipText = createChipText(graphqlQuery, id); return ( - onClickClose([paramKey])}> + ); @@ -67,7 +67,7 @@ function Filter({ queryParams = {}, history }: IProps) { return ( onClickClose(['startDate', 'endDate'])} + onClickClose={onClickClose.bind(null, ['startDate', 'endDate'])} > {queryParams.startDate} - {queryParams.endDate} diff --git a/src/modules/common/components/filterableList/FilterableList.tsx b/src/modules/common/components/filterableList/FilterableList.tsx index 15631997d..cb3df9f67 100755 --- a/src/modules/common/components/filterableList/FilterableList.tsx +++ b/src/modules/common/components/filterableList/FilterableList.tsx @@ -88,9 +88,7 @@ class FilterableList extends React.Component {
    • { - this.toggleItem(item._id); - }} + onClick={this.toggleItem.bind(this, item._id)} > {item.iconClass ? ( { } } + setArea({ area }) { + this.area = area; + } + render() { const { maxHeight, ...props } = this.props; return (