diff --git a/.eslintrc.json b/.eslintrc.json index 65be1bab6..f27e2a1bc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -37,6 +37,10 @@ "object-curly-spacing": [1], "space-infix-ops": ["error"], "space-in-parens": ["error", "never"], + "space-unary-ops": ["error", { + "words": true, + "nonwords": false + }], "no-const-assign": [2], "no-duplicate-imports": [2], "prefer-template": [1], diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index a7f7b760a..715d5b954 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -427,16 +427,16 @@ export default Comment; // return whether the comment is editable function commentIsStillEditable (comment) { const editing = comment && comment.editing; - if (! editing) {return false;} + if (!editing) {return false;} const editableUntil = getEditableUntilDate(comment); const editWindowExpired = (editableUntil - new Date) < 0; - return ! editWindowExpired; + return !editWindowExpired; } // return number of milliseconds before edit window expires function editWindowRemainingMs (comment) { const editableUntil = getEditableUntilDate(comment); - if (! editableUntil) {return;} + if (!editableUntil) {return;} const now = new Date(); const editWindowRemainingMs = (editableUntil - now); return editWindowRemainingMs; diff --git a/client/coral-embed-stream/src/components/EditableCommentContent.js b/client/coral-embed-stream/src/components/EditableCommentContent.js index 03b61edce..052da8e48 100644 --- a/client/coral-embed-stream/src/components/EditableCommentContent.js +++ b/client/coral-embed-stream/src/components/EditableCommentContent.js @@ -113,7 +113,7 @@ export class EditableCommentContent extends React.Component { // should be disabled if user hasn't actually changed their // original comment - return (comment.body !== originalBody) && ! editWindowExpired; + return (comment.body !== originalBody) && !editWindowExpired; }} saveComment={this.editComment} bodyLabel={lang.t('editComment.bodyInputLabel')} diff --git a/client/coral-embed-stream/src/components/TopRightMenu.js b/client/coral-embed-stream/src/components/TopRightMenu.js index e6b264c27..84d64f061 100644 --- a/client/coral-embed-stream/src/components/TopRightMenu.js +++ b/client/coral-embed-stream/src/components/TopRightMenu.js @@ -72,7 +72,7 @@ class Toggleable extends React.Component { }; } toggle() { - this.setState({isOpen: ! this.state.isOpen}); + this.setState({isOpen: !this.state.isOpen}); } close() { this.setState({isOpen: false}); diff --git a/client/coral-embed-stream/src/containers/Embed.js b/client/coral-embed-stream/src/containers/Embed.js index 3cc84a097..dcf531fa7 100644 --- a/client/coral-embed-stream/src/containers/Embed.js +++ b/client/coral-embed-stream/src/containers/Embed.js @@ -124,7 +124,7 @@ export default compose( * producing a new queryStream result where asset.comments reflects the edit */ function reduceEditCommentActionsToUpdateStreamQuery(previousResult, action) { - if (! (action.type === 'APOLLO_MUTATION_RESULT' && action.operationName === 'editComment')) { + if (!(action.type === 'APOLLO_MUTATION_RESULT' && action.operationName === 'editComment')) { return previousResult; } const resultHasErrors = (result) => { @@ -151,7 +151,7 @@ function reduceEditCommentActionsToUpdateStreamQuery(previousResult, action) { return editedComment; }; const commentIsStillVisible = (comment) => { - return ! ((id === comment.id) && (['PREMOD', 'REJECTED'].includes(status))); + return !((id === comment.id) && (['PREMOD', 'REJECTED'].includes(status))); }; const resultReflectingEdit = update(previousResult, { asset: { diff --git a/client/coral-plugin-best/BestButton.js b/client/coral-plugin-best/BestButton.js index df20bf53d..43bea7624 100644 --- a/client/coral-plugin-best/BestButton.js +++ b/client/coral-plugin-best/BestButton.js @@ -29,7 +29,7 @@ export const BestIndicator = ({children = }) => ( * Component that only renders children if the provided user prop can modify best tags */ export const IfUserCanModifyBest = ({user, children}) => { - if (! (user && canModifyBestTag(user))) {return null;} + if (!(user && canModifyBestTag(user))) {return null;} return children; }; @@ -63,7 +63,7 @@ export class BestButton extends Component { async onClickAddBest(e) { e.preventDefault(); const {addBest} = this.props; - if (! addBest) { + if (!addBest) { console.warn('BestButton#onClickAddBest called even though there is no addBest prop. doing nothing'); return; } @@ -78,7 +78,7 @@ export class BestButton extends Component { async onClickRemoveBest(e) { e.preventDefault(); const {removeBest} = this.props; - if (! removeBest) { + if (!removeBest) { console.warn('BestButton#onClickAddBest called even though there is no removeBest prop. doing nothing'); return; } @@ -93,7 +93,7 @@ export class BestButton extends Component { render() { const {isBest, addBest, removeBest} = this.props; const {isSaving} = this.state; - const disabled = isSaving || ! (isBest ? removeBest : addBest); + const disabled = isSaving || !(isBest ? removeBest : addBest); return (