From 566261b91a28e4dfbec135642e0d9ad245d38df5 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 7 Nov 2019 07:55:07 +0200 Subject: [PATCH] lint: fix all remaining warnings! --- src/Journals/ImportDialog.tsx | 3 ++- src/Journals/JournalMemberAddDialog.tsx | 2 +- src/Pim/index.tsx | 2 +- src/Settings/index.tsx | 2 +- src/SideMenu/index.tsx | 2 +- src/components/AddressBook.tsx | 2 +- src/components/ContactEdit.tsx | 6 +++--- src/components/TaskList.tsx | 2 +- src/store/actions.ts | 2 +- src/store/construct.ts | 2 +- src/store/reducers.ts | 14 +++++++------- 11 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Journals/ImportDialog.tsx b/src/Journals/ImportDialog.tsx index e8c0f86..6ce2d32 100644 --- a/src/Journals/ImportDialog.tsx +++ b/src/Journals/ImportDialog.tsx @@ -101,7 +101,8 @@ class ImportDialog extends React.Component { ); } - private onFileDropCommon(itemsCreator: (fileText: string) => PimType[], acceptedFiles: File[], rejectedFiles: File[]) { + private onFileDropCommon(itemsCreator: (fileText: string) => PimType[], acceptedFiles: File[], _rejectedFiles: File[]) { + // XXX: implement handling of rejectedFiles const reader = new FileReader(); reader.onabort = () => alert('file reading was aborted'); diff --git a/src/Journals/JournalMemberAddDialog.tsx b/src/Journals/JournalMemberAddDialog.tsx index 4c56542..2d3037d 100644 --- a/src/Journals/JournalMemberAddDialog.tsx +++ b/src/Journals/JournalMemberAddDialog.tsx @@ -103,7 +103,7 @@ class JournalMemberAddDialog extends React.PureComponent { } } - private onAddRequest(user: string) { + private onAddRequest(_user: string) { this.setState({ userChosen: true, }); diff --git a/src/Pim/index.tsx b/src/Pim/index.tsx index bcf5151..1b549ac 100644 --- a/src/Pim/index.tsx +++ b/src/Pim/index.tsx @@ -135,7 +135,7 @@ const CollectionRoutes = withStyles(styles)(withRouter( ( + render={() => ( { } } -const mapStateToProps = (state: StoreState, props: PropsType) => { +const mapStateToProps = (state: StoreState, _props: PropsType) => { return { settings: state.settings, }; diff --git a/src/SideMenu/index.tsx b/src/SideMenu/index.tsx index ed88e2d..00c53af 100644 --- a/src/SideMenu/index.tsx +++ b/src/SideMenu/index.tsx @@ -103,7 +103,7 @@ class SideMenu extends React.PureComponent { } } -const mapStateToProps = (state: StoreState, props: PropsType) => { +const mapStateToProps = (state: StoreState, _props: PropsType) => { return { journals: state.cache.journals, userInfo: state.cache.userInfo.value, diff --git a/src/components/AddressBook.tsx b/src/components/AddressBook.tsx index dc24e26..098ea4d 100644 --- a/src/components/AddressBook.tsx +++ b/src/components/AddressBook.tsx @@ -83,7 +83,7 @@ class AddressBook extends React.PureComponent { sortedEntries.filter(this.props.filter) : sortedEntries; - const itemList = entries.map((entry, idx, array) => { + const itemList = entries.map((entry) => { const uid = entry.uid; return ( diff --git a/src/components/ContactEdit.tsx b/src/components/ContactEdit.tsx index 12a3bc7..f78489a 100644 --- a/src/components/ContactEdit.tsx +++ b/src/components/ContactEdit.tsx @@ -216,7 +216,7 @@ class ContactEdit extends React.PureComponent { public addValueType(name: string, _type?: string) { const type = _type ? _type : 'home'; - this.setState((prevState, props) => { + this.setState((prevState) => { const newArray = prevState[name].slice(0); newArray.push(new ValueType(type)); return { @@ -227,7 +227,7 @@ class ContactEdit extends React.PureComponent { } public removeValueType(name: string, idx: number) { - this.setState((prevState, props) => { + this.setState((prevState) => { const newArray = prevState[name].slice(0); newArray.splice(idx, 1); return { @@ -238,7 +238,7 @@ class ContactEdit extends React.PureComponent { } public handleValueTypeChange(name: string, idx: number, value: ValueType) { - this.setState((prevState, props) => { + this.setState((prevState) => { const newArray = prevState[name].slice(0); newArray[idx] = value; return { diff --git a/src/components/TaskList.tsx b/src/components/TaskList.tsx index 807dc85..79376af 100644 --- a/src/components/TaskList.tsx +++ b/src/components/TaskList.tsx @@ -49,7 +49,7 @@ class TaskList extends React.PureComponent { const entries = this.props.entries.filter((x) => !x.finished); const sortedEntries = sortSelector(entries); - const itemList = sortedEntries.map((entry, idx, array) => { + const itemList = sortedEntries.map((entry) => { const uid = entry.uid; return ( diff --git a/src/store/actions.ts b/src/store/actions.ts index c365840..5e2319f 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -122,7 +122,7 @@ export const { fetchEntries, addEntries } = createActions({ const apiBase = etesync.serviceApiUrl; const entryManager = new EteSync.EntryManager(creds, apiBase, journalUid); - return entryManager.create(newEntries, prevUid).then((response) => newEntries); + return entryManager.create(newEntries, prevUid).then(() => newEntries); }, (etesync: CredentialsData, journalUid: string, newEntries: EteSync.Entry[], prevUid: string | null) => { return { journal: journalUid, entries: newEntries, prevUid }; diff --git a/src/store/construct.ts b/src/store/construct.ts index 42b0b1b..ae61625 100644 --- a/src/store/construct.ts +++ b/src/store/construct.ts @@ -45,7 +45,7 @@ const journalsSerialize = (state: JournalsData) => { return null; } - return state.map((x, uid) => x.serialize()).toJS(); + return state.map((x, _uid) => x.serialize()).toJS(); }; const journalsDeserialize = (state: {}) => { diff --git a/src/store/reducers.ts b/src/store/reducers.ts index 33a6de6..52e2153 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -81,13 +81,13 @@ function fetchTypeIdentityReducer( export const encryptionKeyReducer = handleActions( { - [actions.deriveKey.toString()]: (state: {key: string | null}, action: any) => ( + [actions.deriveKey.toString()]: (_state: {key: string | null}, action: any) => ( { key: action.payload } ), - [actions.resetKey.toString()]: (state: {key: string | null}, action: any) => ( + [actions.resetKey.toString()]: (_state: {key: string | null}, _action: any) => ( { key: null } ), - [actions.logout.toString()]: (state: {key: string | null}, action: any) => { + [actions.logout.toString()]: (_state: {key: string | null}, _action: any) => { return { out: true, key: null }; }, }, @@ -97,7 +97,7 @@ export const encryptionKeyReducer = handleActions( export const credentials = handleActions( { [actions.fetchCredentials.toString()]: ( - state: CredentialsTypeRemote, action: any, extend = false) => { + _state: CredentialsTypeRemote, action: any) => { if (action.error) { return { value: null, @@ -118,7 +118,7 @@ export const credentials = handleActions( }; } }, - [actions.logout.toString()]: (state: CredentialsTypeRemote, action: any) => { + [actions.logout.toString()]: (_state: CredentialsTypeRemote, _action: any) => { return { out: true, value: null }; }, }, @@ -229,7 +229,7 @@ export const userInfo = handleAction( actions.fetchUserInfo, actions.createUserInfo ), - (state: Record> = fetchTypeRecord()(), action: any, extend = false) => { + (state: Record> = fetchTypeRecord()(), action: any) => { if (action.error) { return state.set('error', action.payload); } else { @@ -284,7 +284,7 @@ export interface SettingsType { export const settingsReducer = handleActions( { - [actions.setSettings.toString()]: (state: {key: string | null}, action: any) => ( + [actions.setSettings.toString()]: (_state: {key: string | null}, action: any) => ( { ...action.payload } ), },