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
This commit is contained in:
Yamagishi Kazutoshi
2017-05-21 00:31:47 +09:00
committed by Eugen Rochko
parent 812fe90eca
commit 2e112e2406
170 changed files with 919 additions and 904 deletions

View File

@ -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) => {

View File

@ -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:

View File

@ -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);

View File

@ -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) {

View File

@ -36,5 +36,5 @@ export default combineReducers({
notifications,
settings,
cards,
reports
reports,
});

View File

@ -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) {

View File

@ -3,7 +3,7 @@ import Immutable from 'immutable';
const initialState = {
modalType: null,
modalProps: {}
modalProps: {},
};
export default function modal(state = initialState, action) {

View File

@ -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) => {

View File

@ -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';

View File

@ -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) {

View File

@ -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;

View File

@ -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) {

View File

@ -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) => {

View File

@ -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';

View File

@ -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) => {

View File

@ -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)),
}));
};