From 4e04f06142c78da1c41635adf65f1a2557890648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 24 Nov 2021 18:28:35 +0100 Subject: [PATCH] eslint: add key-spacing and space-unary-ops rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .eslintrc.js | 11 +++++++++++ app/soapbox/actions/lists.js | 2 +- app/soapbox/features/account/components/header.js | 2 +- .../features/conversations/components/conversation.js | 2 +- app/soapbox/features/ui/components/accordion.js | 2 +- app/soapbox/features/ui/components/columns_area.js | 2 +- app/soapbox/features/ui/components/modal_root.js | 2 +- .../features/ui/components/profile_dropdown.js | 2 +- webpack/translationRunner.js | 2 +- 9 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index aac5995fa..27134414f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -69,6 +69,10 @@ module.exports = { eqeqeq: 'error', indent: ['error', 2], 'jsx-quotes': ['error', 'prefer-single'], + 'key-spacing': [ + 'error', + { mode: 'minimum' }, + ], 'no-catch-shadow': 'error', 'no-cond-assign': 'error', 'no-console': [ @@ -111,6 +115,13 @@ module.exports = { 'prefer-const': 'error', quotes: ['error', 'single'], semi: 'error', + 'space-unary-ops': [ + 'error', + { + words: true, + nonwords: false, + }, + ], strict: 'off', 'valid-typeof': 'error', diff --git a/app/soapbox/actions/lists.js b/app/soapbox/actions/lists.js index 68171cbe3..a04bbc6f1 100644 --- a/app/soapbox/actions/lists.js +++ b/app/soapbox/actions/lists.js @@ -367,7 +367,7 @@ export const fetchAccountLists = accountId => (dispatch, getState) => { }; export const fetchAccountListsRequest = id => ({ - type:LIST_ADDER_LISTS_FETCH_REQUEST, + type: LIST_ADDER_LISTS_FETCH_REQUEST, id, }); diff --git a/app/soapbox/features/account/components/header.js b/app/soapbox/features/account/components/header.js index 949b3801f..5334c9784 100644 --- a/app/soapbox/features/account/components/header.js +++ b/app/soapbox/features/account/components/header.js @@ -235,7 +235,7 @@ class Header extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.direct, { name: account.get('username') }), action: this.props.onDirect, - icon:require('@tabler/icons/icons/mail.svg'), + icon: require('@tabler/icons/icons/mail.svg'), }); } diff --git a/app/soapbox/features/conversations/components/conversation.js b/app/soapbox/features/conversations/components/conversation.js index a543a6f21..7589f725c 100644 --- a/app/soapbox/features/conversations/components/conversation.js +++ b/app/soapbox/features/conversations/components/conversation.js @@ -14,7 +14,7 @@ export default class Conversation extends ImmutablePureComponent { conversationId: PropTypes.string.isRequired, accounts: ImmutablePropTypes.list.isRequired, lastStatusId: PropTypes.string, - unread:PropTypes.bool.isRequired, + unread: PropTypes.bool.isRequired, onMoveUp: PropTypes.func, onMoveDown: PropTypes.func, markRead: PropTypes.func.isRequired, diff --git a/app/soapbox/features/ui/components/accordion.js b/app/soapbox/features/ui/components/accordion.js index 2697ee558..579871481 100644 --- a/app/soapbox/features/ui/components/accordion.js +++ b/app/soapbox/features/ui/components/accordion.js @@ -34,7 +34,7 @@ export default @injectIntl class Accordion extends React.PureComponent { const { headline, children, menu, expanded, intl } = this.props; return ( -
+
{menu && (
diff --git a/app/soapbox/features/ui/components/columns_area.js b/app/soapbox/features/ui/components/columns_area.js index 57f1cd75f..3f74e19d6 100644 --- a/app/soapbox/features/ui/components/columns_area.js +++ b/app/soapbox/features/ui/components/columns_area.js @@ -16,7 +16,7 @@ class ColumnsArea extends ImmutablePureComponent { render() { const { children } = this.props; - const layout = this.props.layout || { LEFT:null, RIGHT:null }; + const layout = this.props.layout || { LEFT: null, RIGHT: null }; return (
diff --git a/app/soapbox/features/ui/components/modal_root.js b/app/soapbox/features/ui/components/modal_root.js index eed1278aa..70e7df99c 100644 --- a/app/soapbox/features/ui/components/modal_root.js +++ b/app/soapbox/features/ui/components/modal_root.js @@ -38,7 +38,7 @@ const MODAL_COMPONENTS = { 'EMBED': EmbedModal, 'LIST_EDITOR': ListEditor, 'FOCAL_POINT': FocalPointModal, - 'LIST_ADDER':ListAdder, + 'LIST_ADDER': ListAdder, 'HOTKEYS': HotkeysModal, 'COMPOSE': ComposeModal, 'UNAUTHORIZED': UnauthorizedModal, diff --git a/app/soapbox/features/ui/components/profile_dropdown.js b/app/soapbox/features/ui/components/profile_dropdown.js index b5a29856a..355e4f226 100644 --- a/app/soapbox/features/ui/components/profile_dropdown.js +++ b/app/soapbox/features/ui/components/profile_dropdown.js @@ -127,7 +127,7 @@ class ProfileDropdown extends React.PureComponent { }); return ( -
+
diff --git a/webpack/translationRunner.js b/webpack/translationRunner.js index 5f75ee757..739d7a307 100644 --- a/webpack/translationRunner.js +++ b/webpack/translationRunner.js @@ -152,7 +152,7 @@ const extractedMessages = extractedMessagesFiles.reduce((acc, messageFile) => { const translations = languages.map((language) => { return { language: language, - data : JSON.parse(fs.readFileSync(path.join(translationsDirectory, language + '.json'), 'utf8')), + data: JSON.parse(fs.readFileSync(path.join(translationsDirectory, language + '.json'), 'utf8')), }; });