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:
parent
812fe90eca
commit
2e112e2406
170 changed files with 919 additions and 904 deletions
|
@ -11,20 +11,20 @@ import DisplayName from '../../../components/display_name';
|
|||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
const messages = defineMessages({
|
||||
reblog: { id: 'status.reblog', defaultMessage: 'Boost' }
|
||||
reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
|
||||
});
|
||||
|
||||
class BoostModal extends ImmutablePureComponent {
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object
|
||||
router: PropTypes.object,
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
status: ImmutablePropTypes.map.isRequired,
|
||||
onReblog: PropTypes.func.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
constructor (props, context) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class Column extends React.PureComponent {
|
|||
icon: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
active: PropTypes.bool,
|
||||
hideHeadingOnMobile: PropTypes.bool
|
||||
hideHeadingOnMobile: PropTypes.bool,
|
||||
};
|
||||
|
||||
handleHeaderClick = () => {
|
||||
|
@ -61,11 +61,11 @@ class Column extends React.PureComponent {
|
|||
render () {
|
||||
const { heading, icon, children, active, hideHeadingOnMobile } = this.props;
|
||||
|
||||
let columnHeaderId = null
|
||||
let columnHeaderId = null;
|
||||
let header = '';
|
||||
|
||||
if (heading) {
|
||||
columnHeaderId = heading.replace(/ /g, '-')
|
||||
columnHeaderId = heading.replace(/ /g, '-');
|
||||
header = <ColumnHeader icon={icon} active={active} type={heading} onClick={this.handleHeaderClick} hideOnMobile={hideHeadingOnMobile} columnHeaderId={columnHeaderId}/>;
|
||||
}
|
||||
return (
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types'
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
class ColumnHeader extends React.PureComponent {
|
||||
|
||||
|
@ -9,7 +9,7 @@ class ColumnHeader extends React.PureComponent {
|
|||
active: PropTypes.bool,
|
||||
onClick: PropTypes.func,
|
||||
hideOnMobile: PropTypes.bool,
|
||||
columnHeaderId: PropTypes.string
|
||||
columnHeaderId: PropTypes.string,
|
||||
};
|
||||
|
||||
handleClick = () => {
|
||||
|
|
|
@ -26,7 +26,7 @@ ColumnLink.propTypes = {
|
|||
to: PropTypes.string,
|
||||
href: PropTypes.string,
|
||||
method: PropTypes.string,
|
||||
hideOnMobile: PropTypes.bool
|
||||
hideOnMobile: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default ColumnLink;
|
||||
|
|
|
@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||
class ColumnsArea extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
children: PropTypes.node
|
||||
children: PropTypes.node,
|
||||
};
|
||||
|
||||
render () {
|
||||
|
|
|
@ -10,7 +10,7 @@ class ConfirmationModal extends React.PureComponent {
|
|||
confirm: PropTypes.string.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
onConfirm: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
handleClick = () => {
|
||||
|
|
|
@ -9,7 +9,7 @@ import IconButton from '../../../components/icon_button';
|
|||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
const messages = defineMessages({
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' }
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
});
|
||||
|
||||
class MediaModal extends ImmutablePureComponent {
|
||||
|
@ -18,11 +18,11 @@ class MediaModal extends ImmutablePureComponent {
|
|||
media: ImmutablePropTypes.list.isRequired,
|
||||
index: PropTypes.number.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
state = {
|
||||
index: null
|
||||
index: null,
|
||||
};
|
||||
|
||||
handleNextClick = () => {
|
||||
|
|
|
@ -13,7 +13,7 @@ const MODAL_COMPONENTS = {
|
|||
'ONBOARDING': OnboardingModal,
|
||||
'VIDEO': VideoModal,
|
||||
'BOOST': BoostModal,
|
||||
'CONFIRM': ConfirmationModal
|
||||
'CONFIRM': ConfirmationModal,
|
||||
};
|
||||
|
||||
class ModalRoot extends React.PureComponent {
|
||||
|
@ -21,7 +21,7 @@ class ModalRoot extends React.PureComponent {
|
|||
static propTypes = {
|
||||
type: PropTypes.string,
|
||||
props: PropTypes.object,
|
||||
onClose: PropTypes.func.isRequired
|
||||
onClose: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
handleKeyUp = (e) => {
|
||||
|
@ -56,7 +56,7 @@ class ModalRoot extends React.PureComponent {
|
|||
items.push({
|
||||
key: type,
|
||||
data: { type, props },
|
||||
style: { opacity: spring(1), scale: spring(1, { stiffness: 120, damping: 14 }) }
|
||||
style: { opacity: spring(1), scale: spring(1, { stiffness: 120, damping: 14 }) },
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ const messages = defineMessages({
|
|||
home_title: { id: 'column.home', defaultMessage: 'Home' },
|
||||
notifications_title: { id: 'column.notifications', defaultMessage: 'Notifications' },
|
||||
local_title: { id: 'column.community', defaultMessage: 'Local timeline' },
|
||||
federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' }
|
||||
federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' },
|
||||
});
|
||||
|
||||
const PageOne = ({ acct, domain }) => (
|
||||
|
@ -37,7 +37,7 @@ const PageOne = ({ acct, domain }) => (
|
|||
|
||||
PageOne.propTypes = {
|
||||
acct: PropTypes.string.isRequired,
|
||||
domain: PropTypes.string.isRequired
|
||||
domain: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
const PageTwo = ({ me }) => (
|
||||
|
@ -93,7 +93,7 @@ const PageThree = ({ me, domain }) => (
|
|||
|
||||
PageThree.propTypes = {
|
||||
me: ImmutablePropTypes.map.isRequired,
|
||||
domain: PropTypes.string.isRequired
|
||||
domain: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
const PageFour = ({ domain, intl }) => (
|
||||
|
@ -128,7 +128,7 @@ const PageFour = ({ domain, intl }) => (
|
|||
|
||||
PageFour.propTypes = {
|
||||
domain: PropTypes.string.isRequired,
|
||||
intl: PropTypes.object.isRequired
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
const PageSix = ({ admin, domain }) => {
|
||||
|
@ -157,13 +157,13 @@ const PageSix = ({ admin, domain }) => {
|
|||
|
||||
PageSix.propTypes = {
|
||||
admin: ImmutablePropTypes.map,
|
||||
domain: PropTypes.string.isRequired
|
||||
domain: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
|
||||
admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]),
|
||||
domain: state.getIn(['meta', 'domain'])
|
||||
domain: state.getIn(['meta', 'domain']),
|
||||
});
|
||||
|
||||
class OnboardingModal extends React.PureComponent {
|
||||
|
@ -173,11 +173,11 @@ class OnboardingModal extends React.PureComponent {
|
|||
intl: PropTypes.object.isRequired,
|
||||
me: ImmutablePropTypes.map.isRequired,
|
||||
domain: PropTypes.string.isRequired,
|
||||
admin: ImmutablePropTypes.map
|
||||
admin: ImmutablePropTypes.map,
|
||||
};
|
||||
|
||||
state = {
|
||||
currentIndex: 0
|
||||
currentIndex: 0,
|
||||
};
|
||||
|
||||
handleSkip = (e) => {
|
||||
|
@ -210,7 +210,7 @@ class OnboardingModal extends React.PureComponent {
|
|||
<PageTwo me={me} />,
|
||||
<PageThree me={me} domain={domain} />,
|
||||
<PageFour domain={domain} intl={intl} />,
|
||||
<PageSix admin={admin} domain={domain} />
|
||||
<PageSix admin={admin} domain={domain} />,
|
||||
];
|
||||
|
||||
const { currentIndex } = this.state;
|
||||
|
@ -226,7 +226,7 @@ class OnboardingModal extends React.PureComponent {
|
|||
|
||||
const styles = pages.map((page, i) => ({
|
||||
key: `page-${i}`,
|
||||
style: { opacity: spring(i === currentIndex ? 1 : 0) }
|
||||
style: { opacity: spring(i === currentIndex ? 1 : 0) },
|
||||
}));
|
||||
|
||||
return (
|
||||
|
|
|
@ -8,14 +8,14 @@ class UploadArea extends React.PureComponent {
|
|||
|
||||
static propTypes = {
|
||||
active: PropTypes.bool,
|
||||
onClose: PropTypes.func
|
||||
onClose: PropTypes.func,
|
||||
};
|
||||
|
||||
handleKeyUp = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const keyCode = e.keyCode
|
||||
const keyCode = e.keyCode;
|
||||
if (this.props.active) {
|
||||
switch(keyCode) {
|
||||
case 27:
|
||||
|
|
|
@ -8,7 +8,7 @@ import IconButton from '../../../components/icon_button';
|
|||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
const messages = defineMessages({
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' }
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
});
|
||||
|
||||
class VideoModal extends ImmutablePureComponent {
|
||||
|
@ -17,7 +17,7 @@ class VideoModal extends ImmutablePureComponent {
|
|||
media: ImmutablePropTypes.map.isRequired,
|
||||
time: PropTypes.number,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
render () {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
|||
import LoadingBar from 'react-redux-loading-bar';
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
loading: state.get('loadingBar')
|
||||
loading: state.get('loadingBar'),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(LoadingBar.WrappedComponent);
|
||||
|
|
|
@ -4,7 +4,7 @@ import ModalRoot from '../components/modal_root';
|
|||
|
||||
const mapStateToProps = state => ({
|
||||
type: state.get('modal').modalType,
|
||||
props: state.get('modal').modalProps
|
||||
props: state.get('modal').modalProps,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
|
|
|
@ -2,19 +2,19 @@ import { connect } from 'react-redux';
|
|||
import { NotificationStack } from 'react-notification';
|
||||
import {
|
||||
dismissAlert,
|
||||
clearAlerts
|
||||
clearAlerts,
|
||||
} from '../../../actions/alerts';
|
||||
import { getAlerts } from '../../../selectors';
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
notifications: getAlerts(state)
|
||||
notifications: getAlerts(state),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
onDismiss: alert => {
|
||||
dispatch(dismissAlert(alert));
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ const makeGetStatusIds = () => createSelector([
|
|||
(state, { type }) => state.getIn(['settings', type], Immutable.Map()),
|
||||
(state, { type }) => state.getIn(['timelines', type, 'items'], Immutable.List()),
|
||||
(state) => state.get('statuses'),
|
||||
(state) => state.getIn(['meta', 'me'])
|
||||
(state) => state.getIn(['meta', 'me']),
|
||||
], (columnSettings, statusIds, statuses, me) => statusIds.filter(id => {
|
||||
const statusForId = statuses.get(id);
|
||||
let showStatus = true;
|
||||
|
@ -45,7 +45,7 @@ const makeMapStateToProps = () => {
|
|||
statusIds: getStatusIds(state, props),
|
||||
isLoading: state.getIn(['timelines', props.type, 'isLoading'], true),
|
||||
isUnread: state.getIn(['timelines', props.type, 'unread']) > 0,
|
||||
hasMore: !!state.getIn(['timelines', props.type, 'next'])
|
||||
hasMore: !!state.getIn(['timelines', props.type, 'next']),
|
||||
});
|
||||
|
||||
return mapStateToProps;
|
||||
|
@ -64,7 +64,7 @@ const mapDispatchToProps = (dispatch, { type, id }) => ({
|
|||
|
||||
onScroll: debounce(() => {
|
||||
dispatch(scrollTopTimeline(type, false));
|
||||
}, 100)
|
||||
}, 100),
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ class UI extends React.PureComponent {
|
|||
|
||||
static propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
children: PropTypes.node
|
||||
children: PropTypes.node,
|
||||
};
|
||||
|
||||
state = {
|
||||
width: window.innerWidth,
|
||||
draggingOver: false
|
||||
draggingOver: false,
|
||||
};
|
||||
|
||||
handleResize = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue