0
0
Fork 0

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

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

View file

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

View file

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

View file

@ -26,7 +26,7 @@ ColumnLink.propTypes = {
to: PropTypes.string,
href: PropTypes.string,
method: PropTypes.string,
hideOnMobile: PropTypes.bool
hideOnMobile: PropTypes.bool,
};
export default ColumnLink;

View file

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
class ColumnsArea extends React.PureComponent {
static propTypes = {
children: PropTypes.node
children: PropTypes.node,
};
render () {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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