From 2e112e240666b62b8c3d4fa201fb24b841f6c92b Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 21 May 2017 00:31:47 +0900 Subject: Improve eslint rules (#3147) * Add semi to ESLint rules * Add padded-blocks to ESLint rules * Add comma-dangle to ESLint rules * add config/webpack and storyboard * add streaming/ * yarn test:lint -- --fix --- app/javascript/mastodon/reducers/accounts.js | 18 +++++++++--------- .../mastodon/reducers/accounts_counters.js | 18 +++++++++--------- app/javascript/mastodon/reducers/alerts.js | 4 ++-- app/javascript/mastodon/reducers/compose.js | 4 ++-- app/javascript/mastodon/reducers/index.js | 2 +- app/javascript/mastodon/reducers/meta.js | 2 +- app/javascript/mastodon/reducers/modal.js | 2 +- app/javascript/mastodon/reducers/notifications.js | 6 +++--- app/javascript/mastodon/reducers/relationships.js | 4 ++-- app/javascript/mastodon/reducers/reports.js | 6 +++--- app/javascript/mastodon/reducers/search.js | 20 ++++++++++---------- app/javascript/mastodon/reducers/settings.js | 16 ++++++++-------- app/javascript/mastodon/reducers/status_lists.js | 6 +++--- app/javascript/mastodon/reducers/statuses.js | 12 ++++++------ app/javascript/mastodon/reducers/timelines.js | 18 +++++++++--------- app/javascript/mastodon/reducers/user_lists.js | 12 ++++++------ 16 files changed, 75 insertions(+), 75 deletions(-) (limited to 'app/javascript/mastodon/reducers') diff --git a/app/javascript/mastodon/reducers/accounts.js b/app/javascript/mastodon/reducers/accounts.js index b3c2b6d88..d4d9ad62e 100644 --- a/app/javascript/mastodon/reducers/accounts.js +++ b/app/javascript/mastodon/reducers/accounts.js @@ -7,15 +7,15 @@ import { ACCOUNT_TIMELINE_FETCH_SUCCESS, ACCOUNT_TIMELINE_EXPAND_SUCCESS, FOLLOW_REQUESTS_FETCH_SUCCESS, - FOLLOW_REQUESTS_EXPAND_SUCCESS + FOLLOW_REQUESTS_EXPAND_SUCCESS, } from '../actions/accounts'; import { BLOCKS_FETCH_SUCCESS, - BLOCKS_EXPAND_SUCCESS + BLOCKS_EXPAND_SUCCESS, } from '../actions/blocks'; import { MUTES_FETCH_SUCCESS, - MUTES_EXPAND_SUCCESS + MUTES_EXPAND_SUCCESS, } from '../actions/mutes'; import { COMPOSE_SUGGESTIONS_READY } from '../actions/compose'; import { @@ -24,26 +24,26 @@ import { FAVOURITE_SUCCESS, UNFAVOURITE_SUCCESS, REBLOGS_FETCH_SUCCESS, - FAVOURITES_FETCH_SUCCESS + FAVOURITES_FETCH_SUCCESS, } from '../actions/interactions'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, - TIMELINE_EXPAND_SUCCESS + TIMELINE_EXPAND_SUCCESS, } from '../actions/timelines'; import { STATUS_FETCH_SUCCESS, - CONTEXT_FETCH_SUCCESS + CONTEXT_FETCH_SUCCESS, } from '../actions/statuses'; import { SEARCH_FETCH_SUCCESS } from '../actions/search'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, - NOTIFICATIONS_EXPAND_SUCCESS + NOTIFICATIONS_EXPAND_SUCCESS, } from '../actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import { STORE_HYDRATE } from '../actions/store'; import Immutable from 'immutable'; @@ -55,7 +55,7 @@ const normalizeAccount = (state, account) => { delete account.following_count; delete account.statuses_count; - return state.set(account.id, Immutable.fromJS(account)) + return state.set(account.id, Immutable.fromJS(account)); }; const normalizeAccounts = (state, accounts) => { diff --git a/app/javascript/mastodon/reducers/accounts_counters.js b/app/javascript/mastodon/reducers/accounts_counters.js index f0433c48c..ea631ceca 100644 --- a/app/javascript/mastodon/reducers/accounts_counters.js +++ b/app/javascript/mastodon/reducers/accounts_counters.js @@ -9,15 +9,15 @@ import { FOLLOW_REQUESTS_FETCH_SUCCESS, FOLLOW_REQUESTS_EXPAND_SUCCESS, ACCOUNT_FOLLOW_SUCCESS, - ACCOUNT_UNFOLLOW_SUCCESS + ACCOUNT_UNFOLLOW_SUCCESS, } from '../actions/accounts'; import { BLOCKS_FETCH_SUCCESS, - BLOCKS_EXPAND_SUCCESS + BLOCKS_EXPAND_SUCCESS, } from '../actions/blocks'; import { MUTES_FETCH_SUCCESS, - MUTES_EXPAND_SUCCESS + MUTES_EXPAND_SUCCESS, } from '../actions/mutes'; import { COMPOSE_SUGGESTIONS_READY } from '../actions/compose'; import { @@ -26,26 +26,26 @@ import { FAVOURITE_SUCCESS, UNFAVOURITE_SUCCESS, REBLOGS_FETCH_SUCCESS, - FAVOURITES_FETCH_SUCCESS + FAVOURITES_FETCH_SUCCESS, } from '../actions/interactions'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, - TIMELINE_EXPAND_SUCCESS + TIMELINE_EXPAND_SUCCESS, } from '../actions/timelines'; import { STATUS_FETCH_SUCCESS, - CONTEXT_FETCH_SUCCESS + CONTEXT_FETCH_SUCCESS, } from '../actions/statuses'; import { SEARCH_FETCH_SUCCESS } from '../actions/search'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, - NOTIFICATIONS_EXPAND_SUCCESS + NOTIFICATIONS_EXPAND_SUCCESS, } from '../actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import { STORE_HYDRATE } from '../actions/store'; import Immutable from 'immutable'; @@ -90,7 +90,7 @@ export default function accountsCounters(state = initialState, action) { return state.merge(action.state.get('accounts').map(item => Immutable.fromJS({ followers_count: item.get('followers_count'), following_count: item.get('following_count'), - statuses_count: item.get('statuses_count') + statuses_count: item.get('statuses_count'), }))); case ACCOUNT_FETCH_SUCCESS: case NOTIFICATIONS_UPDATE: diff --git a/app/javascript/mastodon/reducers/alerts.js b/app/javascript/mastodon/reducers/alerts.js index dc0145824..aaea9775f 100644 --- a/app/javascript/mastodon/reducers/alerts.js +++ b/app/javascript/mastodon/reducers/alerts.js @@ -1,7 +1,7 @@ import { ALERT_SHOW, ALERT_DISMISS, - ALERT_CLEAR + ALERT_CLEAR, } from '../actions/alerts'; import Immutable from 'immutable'; @@ -13,7 +13,7 @@ export default function alerts(state = initialState, action) { return state.push(Immutable.Map({ key: state.size > 0 ? state.last().get('key') + 1 : 0, title: action.title, - message: action.message + message: action.message, })); case ALERT_DISMISS: return state.filterNot(item => item.get('key') === action.alert.key); diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index c87384780..2413df9e2 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -21,7 +21,7 @@ import { COMPOSE_SPOILER_TEXT_CHANGE, COMPOSE_VISIBILITY_CHANGE, COMPOSE_LISTABILITY_CHANGE, - COMPOSE_EMOJI_INSERT + COMPOSE_EMOJI_INSERT, } from '../actions/compose'; import { TIMELINE_DELETE } from '../actions/timelines'; import { STORE_HYDRATE } from '../actions/store'; @@ -47,7 +47,7 @@ const initialState = Immutable.Map({ me: null, default_privacy: 'public', resetFileKey: Math.floor((Math.random() * 0x10000)), - idempotencyKey: null + idempotencyKey: null, }); function statusToTextMentions(state, status) { diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js index 0665f494b..c4fe28ea7 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.js @@ -36,5 +36,5 @@ export default combineReducers({ notifications, settings, cards, - reports + reports, }); diff --git a/app/javascript/mastodon/reducers/meta.js b/app/javascript/mastodon/reducers/meta.js index acf6d4be1..1551228ec 100644 --- a/app/javascript/mastodon/reducers/meta.js +++ b/app/javascript/mastodon/reducers/meta.js @@ -4,7 +4,7 @@ import Immutable from 'immutable'; const initialState = Immutable.Map({ streaming_api_base_url: null, access_token: null, - me: null + me: null, }); export default function meta(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/modal.js b/app/javascript/mastodon/reducers/modal.js index 3566820ef..8fd9a69cd 100644 --- a/app/javascript/mastodon/reducers/modal.js +++ b/app/javascript/mastodon/reducers/modal.js @@ -3,7 +3,7 @@ import Immutable from 'immutable'; const initialState = { modalType: null, - modalProps: {} + modalProps: {}, }; export default function modal(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index ae06b8267..0c1cf5b0f 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -7,7 +7,7 @@ import { NOTIFICATIONS_REFRESH_FAIL, NOTIFICATIONS_EXPAND_FAIL, NOTIFICATIONS_CLEAR, - NOTIFICATIONS_SCROLL_TOP + NOTIFICATIONS_SCROLL_TOP, } from '../actions/notifications'; import { ACCOUNT_BLOCK_SUCCESS } from '../actions/accounts'; import { TIMELINE_DELETE } from '../actions/timelines'; @@ -19,14 +19,14 @@ const initialState = Immutable.Map({ top: true, unread: 0, loaded: false, - isLoading: true + isLoading: true, }); const notificationToMap = notification => Immutable.Map({ id: notification.id, type: notification.type, account: notification.account.id, - status: notification.status ? notification.status.id : null + status: notification.status ? notification.status.id : null, }); const normalizeNotification = (state, notification) => { diff --git a/app/javascript/mastodon/reducers/relationships.js b/app/javascript/mastodon/reducers/relationships.js index f25c0b55a..b6607860c 100644 --- a/app/javascript/mastodon/reducers/relationships.js +++ b/app/javascript/mastodon/reducers/relationships.js @@ -5,11 +5,11 @@ import { ACCOUNT_UNBLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, ACCOUNT_UNMUTE_SUCCESS, - RELATIONSHIPS_FETCH_SUCCESS + RELATIONSHIPS_FETCH_SUCCESS, } from '../actions/accounts'; import { DOMAIN_BLOCK_SUCCESS, - DOMAIN_UNBLOCK_SUCCESS + DOMAIN_UNBLOCK_SUCCESS, } from '../actions/domain_blocks'; import Immutable from 'immutable'; diff --git a/app/javascript/mastodon/reducers/reports.js b/app/javascript/mastodon/reducers/reports.js index eab004377..ad35eaa05 100644 --- a/app/javascript/mastodon/reducers/reports.js +++ b/app/javascript/mastodon/reducers/reports.js @@ -5,7 +5,7 @@ import { REPORT_SUBMIT_FAIL, REPORT_CANCEL, REPORT_STATUS_TOGGLE, - REPORT_COMMENT_CHANGE + REPORT_COMMENT_CHANGE, } from '../actions/reports'; import Immutable from 'immutable'; @@ -14,8 +14,8 @@ const initialState = Immutable.Map({ isSubmitting: false, account_id: null, status_ids: Immutable.Set(), - comment: '' - }) + comment: '', + }), }); export default function reports(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/search.js b/app/javascript/mastodon/reducers/search.js index b3fe6c7be..ed395427e 100644 --- a/app/javascript/mastodon/reducers/search.js +++ b/app/javascript/mastodon/reducers/search.js @@ -2,7 +2,7 @@ import { SEARCH_CHANGE, SEARCH_CLEAR, SEARCH_FETCH_SUCCESS, - SEARCH_SHOW + SEARCH_SHOW, } from '../actions/search'; import { COMPOSE_MENTION, COMPOSE_REPLY } from '../actions/compose'; import Immutable from 'immutable'; @@ -11,7 +11,7 @@ const initialState = Immutable.Map({ value: '', submitted: false, hidden: false, - results: Immutable.Map() + results: Immutable.Map(), }); const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { @@ -23,8 +23,8 @@ const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { items: accounts.map(item => ({ type: 'account', id: item.id, - value: item.acct - })) + value: item.acct, + })), }); } @@ -32,21 +32,21 @@ const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { let hashtagItems = hashtags.map(item => ({ type: 'hashtag', id: item, - value: `#${item}` + value: `#${item}`, })); if (value.indexOf('@') === -1 && value.indexOf(' ') === -1 && !value.startsWith('http://') && !value.startsWith('https://') && hashtags.indexOf(value) === -1) { hashtagItems.unshift({ type: 'hashtag', id: value, - value: `#${value}` + value: `#${value}`, }); } if (hashtagItems.length > 0) { newSuggestions.push({ title: 'hashtag', - items: hashtagItems + items: hashtagItems, }); } } @@ -57,8 +57,8 @@ const normalizeSuggestions = (state, value, accounts, hashtags, statuses) => { items: statuses.map(item => ({ type: 'status', id: item.id, - value: item.id - })) + value: item.id, + })), }); } @@ -88,7 +88,7 @@ export default function search(state = initialState, action) { return state.set('results', Immutable.Map({ accounts: Immutable.List(action.results.accounts.map(item => item.id)), statuses: Immutable.List(action.results.statuses.map(item => item.id)), - hashtags: Immutable.List(action.results.hashtags) + hashtags: Immutable.List(action.results.hashtags), })).set('submitted', true); default: return state; diff --git a/app/javascript/mastodon/reducers/settings.js b/app/javascript/mastodon/reducers/settings.js index b255aabc4..ababd4983 100644 --- a/app/javascript/mastodon/reducers/settings.js +++ b/app/javascript/mastodon/reducers/settings.js @@ -8,12 +8,12 @@ const initialState = Immutable.Map({ home: Immutable.Map({ shows: Immutable.Map({ reblog: true, - reply: true + reply: true, }), regex: Immutable.Map({ - body: '' - }) + body: '', + }), }), notifications: Immutable.Map({ @@ -21,23 +21,23 @@ const initialState = Immutable.Map({ follow: true, favourite: true, reblog: true, - mention: true + mention: true, }), shows: Immutable.Map({ follow: true, favourite: true, reblog: true, - mention: true + mention: true, }), sounds: Immutable.Map({ follow: true, favourite: true, reblog: true, - mention: true - }) - }) + mention: true, + }), + }), }); export default function settings(state = initialState, action) { diff --git a/app/javascript/mastodon/reducers/status_lists.js b/app/javascript/mastodon/reducers/status_lists.js index fd463cd63..7d00f6d30 100644 --- a/app/javascript/mastodon/reducers/status_lists.js +++ b/app/javascript/mastodon/reducers/status_lists.js @@ -1,6 +1,6 @@ import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import Immutable from 'immutable'; @@ -8,8 +8,8 @@ const initialState = Immutable.Map({ favourites: Immutable.Map({ next: null, loaded: false, - items: Immutable.List() - }) + items: Immutable.List(), + }), }); const normalizeList = (state, listType, statuses, next) => { diff --git a/app/javascript/mastodon/reducers/statuses.js b/app/javascript/mastodon/reducers/statuses.js index 6d38d905d..7bc3710c4 100644 --- a/app/javascript/mastodon/reducers/statuses.js +++ b/app/javascript/mastodon/reducers/statuses.js @@ -6,35 +6,35 @@ import { FAVOURITE_REQUEST, FAVOURITE_SUCCESS, FAVOURITE_FAIL, - UNFAVOURITE_SUCCESS + UNFAVOURITE_SUCCESS, } from '../actions/interactions'; import { STATUS_FETCH_SUCCESS, CONTEXT_FETCH_SUCCESS, STATUS_MUTE_SUCCESS, - STATUS_UNMUTE_SUCCESS + STATUS_UNMUTE_SUCCESS, } from '../actions/statuses'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, TIMELINE_DELETE, - TIMELINE_EXPAND_SUCCESS + TIMELINE_EXPAND_SUCCESS, } from '../actions/timelines'; import { ACCOUNT_TIMELINE_FETCH_SUCCESS, ACCOUNT_TIMELINE_EXPAND_SUCCESS, ACCOUNT_MEDIA_TIMELINE_FETCH_SUCCESS, ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS, - ACCOUNT_BLOCK_SUCCESS + ACCOUNT_BLOCK_SUCCESS, } from '../actions/accounts'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, - NOTIFICATIONS_EXPAND_SUCCESS + NOTIFICATIONS_EXPAND_SUCCESS, } from '../actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, - FAVOURITED_STATUSES_EXPAND_SUCCESS + FAVOURITED_STATUSES_EXPAND_SUCCESS, } from '../actions/favourites'; import { SEARCH_FETCH_SUCCESS } from '../actions/search'; import Immutable from 'immutable'; diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js index 5c37b0dcb..2e95d645e 100644 --- a/app/javascript/mastodon/reducers/timelines.js +++ b/app/javascript/mastodon/reducers/timelines.js @@ -9,13 +9,13 @@ import { TIMELINE_EXPAND_FAIL, TIMELINE_SCROLL_TOP, TIMELINE_CONNECT, - TIMELINE_DISCONNECT + TIMELINE_DISCONNECT, } from '../actions/timelines'; import { REBLOG_SUCCESS, UNREBLOG_SUCCESS, FAVOURITE_SUCCESS, - UNFAVOURITE_SUCCESS + UNFAVOURITE_SUCCESS, } from '../actions/interactions'; import { ACCOUNT_TIMELINE_FETCH_REQUEST, @@ -31,10 +31,10 @@ import { ACCOUNT_MEDIA_TIMELINE_EXPAND_SUCCESS, ACCOUNT_MEDIA_TIMELINE_EXPAND_FAIL, ACCOUNT_BLOCK_SUCCESS, - ACCOUNT_MUTE_SUCCESS + ACCOUNT_MUTE_SUCCESS, } from '../actions/accounts'; import { - CONTEXT_FETCH_SUCCESS + CONTEXT_FETCH_SUCCESS, } from '../actions/statuses'; import Immutable from 'immutable'; @@ -47,7 +47,7 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), public: Immutable.Map({ @@ -58,7 +58,7 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), community: Immutable.Map({ @@ -70,7 +70,7 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), tag: Immutable.Map({ @@ -81,13 +81,13 @@ const initialState = Immutable.Map({ loaded: false, top: true, unread: 0, - items: Immutable.List() + items: Immutable.List(), }), accounts_timelines: Immutable.Map(), accounts_media_timelines: Immutable.Map(), ancestors: Immutable.Map(), - descendants: Immutable.Map() + descendants: Immutable.Map(), }); const normalizeStatus = (state, status) => { diff --git a/app/javascript/mastodon/reducers/user_lists.js b/app/javascript/mastodon/reducers/user_lists.js index af9492119..83bf1be1b 100644 --- a/app/javascript/mastodon/reducers/user_lists.js +++ b/app/javascript/mastodon/reducers/user_lists.js @@ -6,19 +6,19 @@ import { FOLLOW_REQUESTS_FETCH_SUCCESS, FOLLOW_REQUESTS_EXPAND_SUCCESS, FOLLOW_REQUEST_AUTHORIZE_SUCCESS, - FOLLOW_REQUEST_REJECT_SUCCESS + FOLLOW_REQUEST_REJECT_SUCCESS, } from '../actions/accounts'; import { REBLOGS_FETCH_SUCCESS, - FAVOURITES_FETCH_SUCCESS + FAVOURITES_FETCH_SUCCESS, } from '../actions/interactions'; import { BLOCKS_FETCH_SUCCESS, - BLOCKS_EXPAND_SUCCESS + BLOCKS_EXPAND_SUCCESS, } from '../actions/blocks'; import { MUTES_FETCH_SUCCESS, - MUTES_EXPAND_SUCCESS + MUTES_EXPAND_SUCCESS, } from '../actions/mutes'; import Immutable from 'immutable'; @@ -29,13 +29,13 @@ const initialState = Immutable.Map({ favourited_by: Immutable.Map(), follow_requests: Immutable.Map(), blocks: Immutable.Map(), - mutes: Immutable.Map() + mutes: Immutable.Map(), }); const normalizeList = (state, type, id, accounts, next) => { return state.setIn([type, id], Immutable.Map({ next, - items: Immutable.List(accounts.map(item => item.id)) + items: Immutable.List(accounts.map(item => item.id)), })); }; -- cgit