Eslint: update rules and adjust code accordingly.

master
Tom Hacohen 5 years ago
parent 416ba70b51
commit ab5495e221

@ -56,8 +56,12 @@ module.exports = {
"beforeClosing": "never" "beforeClosing": "never"
}], }],
"react/jsx-boolean-value": ["error", "never"], "react/jsx-boolean-value": ["error", "never"],
"react/jsx-curly-spacing": ["error", "never"], "react/jsx-curly-spacing": ["error", { "when": "never", "children": true }],
"react/jsx-equals-spacing": ["error", "never"],
"react/jsx-indent-props": ["error", 2],
"react/jsx-curly-brace-presence": ["error", "never"],
"react/jsx-key": ["error", { "checkFragmentShorthand": true }], "react/jsx-key": ["error", { "checkFragmentShorthand": true }],
"react/jsx-indent": ["error", 2, { checkAttributes: true, indentLogicalExpressions: true }],
"quotes": "off", "quotes": "off",
"@typescript-eslint/quotes": ["error", "single", { "allowTemplateLiterals": true, "avoidEscape": true }], "@typescript-eslint/quotes": ["error", "single", { "allowTemplateLiterals": true, "avoidEscape": true }],

@ -70,7 +70,7 @@ class ImportDialog extends React.Component<PropsType> {
> >
<DialogTitle>Import entries from file?</DialogTitle> <DialogTitle>Import entries from file?</DialogTitle>
<DialogContent> <DialogContent>
{ loading ? {loading ?
<LoadingIndicator style={{ display: 'block', margin: 'auto' }} /> <LoadingIndicator style={{ display: 'block', margin: 'auto' }} />
: :
<Dropzone <Dropzone

@ -105,7 +105,7 @@ class Journal extends React.Component<PropsTypeInner> {
return ( return (
<React.Fragment> <React.Fragment>
<AppBarOverride title={collectionInfo.displayName}> <AppBarOverride title={collectionInfo.displayName}>
{ isOwner && {isOwner &&
<> <>
<IconButton <IconButton
component={Link} component={Link}
@ -139,12 +139,12 @@ class Journal extends React.Component<PropsTypeInner> {
<Tab label={itemsTitle} disabled={journalOnly} /> <Tab label={itemsTitle} disabled={journalOnly} />
<Tab label="Journal Entries" /> <Tab label="Journal Entries" />
</Tabs> </Tabs>
{ currentTab === 0 && {currentTab === 0 &&
<Container> <Container>
{itemsView} {itemsView}
</Container> </Container>
} }
{ currentTab === 1 && {currentTab === 1 &&
<Container> <Container>
<JournalEntries journal={journal} entries={syncEntries} /> <JournalEntries journal={journal} entries={syncEntries} />
</Container> </Container>

@ -85,7 +85,7 @@ class JournalMemberAddDialog extends React.PureComponent<PropsType> {
onOk={this.onAddRequest} onOk={this.onAddRequest}
onCancel={onClose} onCancel={onClose}
> >
{ userChosen ? {userChosen ?
<LoadingIndicator /> <LoadingIndicator />
: :
<TextField <TextField

@ -54,7 +54,7 @@ class JournalMembers extends React.PureComponent<PropsTypeInner> {
<> <>
<AppBarOverride title={`${info.displayName} - Members`} /> <AppBarOverride title={`${info.displayName} - Members`} />
<Container style={{ maxWidth: '30rem' }}> <Container style={{ maxWidth: '30rem' }}>
{ members ? {members ?
<List> <List>
<ListItem rightIcon={<IconMemberAdd />} onClick={() => this.setState({ addMemberOpen: true })}> <ListItem rightIcon={<IconMemberAdd />} onClick={() => this.setState({ addMemberOpen: true })}>
Add member Add member
@ -86,7 +86,7 @@ class JournalMembers extends React.PureComponent<PropsTypeInner> {
Please be advised that a malicious user would potentially be able to retain access to encryption keys. Please refer to the FAQ for more information. Please be advised that a malicious user would potentially be able to retain access to encryption keys. Please refer to the FAQ for more information.
</ConfirmationDialog> </ConfirmationDialog>
{ addMemberOpen && {addMemberOpen &&
(sharingAllowed ? (sharingAllowed ?
<JournalMemberAddDialog <JournalMemberAddDialog
etesync={this.props.etesync} etesync={this.props.etesync}

@ -37,7 +37,7 @@ function EncryptionPart(props: { credentials: CredentialsType, onEncryptionFormS
return ( return (
<Container style={{ maxWidth: '30rem' }}> <Container style={{ maxWidth: '30rem' }}>
<h2>Encryption Password</h2> <h2>Encryption Password</h2>
{ (isNewUser) ? {(isNewUser) ?
<div> <div>
<h3>Welcome to EteSync!</h3> <h3>Welcome to EteSync!</h3>
<p> <p>

@ -130,17 +130,17 @@ class PimMain extends React.PureComponent<PropsType> {
</Tabs> </Tabs>
<Container> <Container>
{ tab === 0 && {tab === 0 &&
<SearchableAddressBook entries={this.props.contacts} onItemClick={this.contactClicked} /> <SearchableAddressBook entries={this.props.contacts} onItemClick={this.contactClicked} />
} }
{ tab === 1 && {tab === 1 &&
<PersistCalendar <PersistCalendar
entries={this.props.events} entries={this.props.events}
onItemClick={this.eventClicked} onItemClick={this.eventClicked}
onSlotClick={this.newEvent} onSlotClick={this.newEvent}
/> />
} }
{ tab === 2 && {tab === 2 &&
<TaskList <TaskList
entries={this.props.tasks} entries={this.props.tasks}
onItemClick={this.taskClicked} onItemClick={this.taskClicked}

@ -101,11 +101,9 @@ const ValueTypeComponent = (props: ValueTypeComponentProps) => {
<TypeSelector <TypeSelector
value={props.value.type} value={props.value.type}
types={props.types} types={props.types}
onChange={ onChange={(event: React.ChangeEvent<HTMLSelectElement>) => (
(event: React.ChangeEvent<HTMLSelectElement>) => (
props.onChange(props.name, event.target.value, props.value.value) props.onChange(props.name, event.target.value, props.value.value)
) )}
}
/> />
</React.Fragment> </React.Fragment>
); );

@ -29,10 +29,10 @@ class Task extends React.PureComponent {
return ( return (
<React.Fragment> <React.Fragment>
<PimItemHeader text={this.props.item.summary} backgroundColor={this.props.item.color}> <PimItemHeader text={this.props.item.summary} backgroundColor={this.props.item.color}>
{ item.startDate && {item.startDate &&
<div>Start: {formatDate(item.startDate)} {timezone && <small>({timezone})</small>}</div> <div>Start: {formatDate(item.startDate)} {timezone && <small>({timezone})</small>}</div>
} }
{ item.dueDate && {item.dueDate &&
<div>Due: {formatDate(item.dueDate)} {timezone && <small>({timezone})</small>}</div> <div>Due: {formatDate(item.dueDate)} {timezone && <small>({timezone})</small>}</div>
} }
<br /> <br />

Loading…
Cancel
Save