diff --git a/.eslintrc.json b/.eslintrc.json index 293657679..65be1bab6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,6 +36,7 @@ "no-unneeded-ternary": [1], "object-curly-spacing": [1], "space-infix-ops": ["error"], + "space-in-parens": ["error", "never"], "no-const-assign": [2], "no-duplicate-imports": [2], "prefer-template": [1], diff --git a/client/coral-admin/src/containers/Community/components/User.js b/client/coral-admin/src/containers/Community/components/User.js index 20b599a7a..b6e4a0cc6 100644 --- a/client/coral-admin/src/containers/Community/components/User.js +++ b/client/coral-admin/src/containers/Community/components/User.js @@ -37,7 +37,7 @@ const User = props => {
flag{lang.t('community.flags')}({ user.actions.length }): { user.action_summaries.map( - (action, i ) => { + (action, i) => { return {lang.t(`community.${action.reason}`)} ({action.count}) ; @@ -46,7 +46,7 @@ const User = props => {
{ user.action_summaries.map( - (action_sum, i ) => { + (action_sum, i) => { return
{lang.t(`community.${action_sum.reason}`)} ({action_sum.count}) diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index 13d286296..a7f7b760a 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -427,7 +427,7 @@ 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; @@ -436,7 +436,7 @@ function commentIsStillEditable (comment) { // 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/containers/Embed.js b/client/coral-embed-stream/src/containers/Embed.js index 0d21aac0a..3cc84a097 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) => { diff --git a/client/coral-plugin-best/BestButton.js b/client/coral-plugin-best/BestButton.js index 96ef45f86..df20bf53d 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; } diff --git a/client/coral-plugin-infobox/Markdown.js b/client/coral-plugin-infobox/Markdown.js index 59b63bcb0..b5cf88d22 100644 --- a/client/coral-plugin-infobox/Markdown.js +++ b/client/coral-plugin-infobox/Markdown.js @@ -4,7 +4,7 @@ import marked from 'marked'; const renderer = new marked.Renderer(); // Set link target to `_parent` to work properly in an embed. -renderer.link = ( href, title, text ) => +renderer.link = (href, title, text) => `${text}`; marked.setOptions({renderer}); diff --git a/graph/resolvers/root_query.js b/graph/resolvers/root_query.js index 4dcb7ea11..749660acb 100644 --- a/graph/resolvers/root_query.js +++ b/graph/resolvers/root_query.js @@ -90,7 +90,7 @@ const RootQuery = { // get currentUser again since context.user was out of date when running test/graph/mutations/ignoreUser const currentUser = (await Users.getByQuery({ids: [user.id], limit: 1}))[0]; - if ( ! (currentUser && Array.isArray(currentUser.ignoresUsers) && currentUser.ignoresUsers.length)) { + if (! (currentUser && Array.isArray(currentUser.ignoresUsers) && currentUser.ignoresUsers.length)) { return []; } return await Users.getByQuery({ids: currentUser.ignoresUsers});