Add ESLint rule (object-curly-spacing) (#3498)

This commit is contained in:
Yamagishi Kazutoshi 2017-06-02 00:25:10 +09:00 committed by Eugen Rochko
parent cb7ee4698f
commit fda5c699c2
9 changed files with 19 additions and 16 deletions

View file

@ -54,6 +54,9 @@ rules:
comma-dangle: comma-dangle:
- error - error
- always-multiline - always-multiline
object-curly-spacing:
- error
- always
react/jsx-wrap-multilines: error react/jsx-wrap-multilines: error
react/jsx-no-bind: error react/jsx-no-bind: error

View file

@ -9,7 +9,7 @@ class AvatarOverlay extends React.PureComponent {
}; };
render() { render() {
const {staticSrc, overlaySrc} = this.props; const { staticSrc, overlaySrc } = this.props;
const baseStyle = { const baseStyle = {
backgroundImage: `url(${staticSrc})`, backgroundImage: `url(${staticSrc})`,

View file

@ -46,21 +46,21 @@ class EmojiPickerDropdown extends React.PureComponent {
} }
onShowDropdown = () => { onShowDropdown = () => {
this.setState({active: true}); this.setState({ active: true });
if (!EmojiPicker) { if (!EmojiPicker) {
this.setState({loading: true}); this.setState({ loading: true });
import(/* webpackChunkName: "emojione_picker" */ 'emojione-picker').then(TheEmojiPicker => { import(/* webpackChunkName: "emojione_picker" */ 'emojione-picker').then(TheEmojiPicker => {
EmojiPicker = TheEmojiPicker.default; EmojiPicker = TheEmojiPicker.default;
this.setState({loading: false}); this.setState({ loading: false });
}).catch(err => { }).catch(err => {
// TODO: show the user an error? // TODO: show the user an error?
this.setState({loading: false}); this.setState({ loading: false });
}); });
} }
} }
onHideDropdown = () => { onHideDropdown = () => {
this.setState({active: false}); this.setState({ active: false });
} }
render () { render () {

View file

@ -12,8 +12,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
const messages = defineMessages({ const messages = defineMessages({
heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' }, public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
navigation_subheading: { id: 'column_subheading.navigation', defaultMessage: 'Navigation'}, navigation_subheading: { id: 'column_subheading.navigation', defaultMessage: 'Navigation' },
settings_subheading: { id: 'column_subheading.settings', defaultMessage: 'Settings'}, settings_subheading: { id: 'column_subheading.settings', defaultMessage: 'Settings' },
community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' }, community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },

View file

@ -22,11 +22,11 @@ class ImageLoader extends React.PureComponent {
loadImage(src) { loadImage(src) {
const image = new Image(); const image = new Image();
image.onerror = () => this.setState({loading: false, error: true}); image.onerror = () => this.setState({ loading: false, error: true });
image.onload = () => this.setState({loading: false, error: false}); image.onload = () => this.setState({ loading: false, error: false });
image.src = src; image.src = src;
this.lastSrc = src; this.lastSrc = src;
this.setState({loading: true}); this.setState({ loading: true });
} }
render() { render() {

View file

@ -26,11 +26,11 @@ class MediaModal extends ImmutablePureComponent {
}; };
handleNextClick = () => { handleNextClick = () => {
this.setState({ index: (this.getIndex() + 1) % this.props.media.size}); this.setState({ index: (this.getIndex() + 1) % this.props.media.size });
} }
handlePrevClick = () => { handlePrevClick = () => {
this.setState({ index: (this.getIndex() - 1) % this.props.media.size}); this.setState({ index: (this.getIndex() - 1) % this.props.media.size });
} }
handleKeyUp = (e) => { handleKeyUp = (e) => {

View file

@ -139,7 +139,7 @@ const PageSix = ({ admin, domain }) => {
<p> <p>
<FormattedMessage id='onboarding.page_six.admin' defaultMessage="Your instance's admin is {admin}." values={{ admin: <Permalink href={admin.get('url')} to={`/accounts/${admin.get('id')}`}>@{admin.get('acct')}</Permalink> }} /> <FormattedMessage id='onboarding.page_six.admin' defaultMessage="Your instance's admin is {admin}." values={{ admin: <Permalink href={admin.get('url')} to={`/accounts/${admin.get('id')}`}>@{admin.get('acct')}</Permalink> }} />
<br /> <br />
<FormattedMessage id='onboarding.page_six.read_guidelines' defaultMessage="Please read {domain}'s {guidelines}!" values={{domain, guidelines: <a href='/about/more' target='_blank'><FormattedMessage id='onboarding.page_six.guidelines' defaultMessage='community guidelines' /></a> }}/> <FormattedMessage id='onboarding.page_six.read_guidelines' defaultMessage="Please read {domain}'s {guidelines}!" values={{ domain, guidelines: <a href='/about/more' target='_blank'><FormattedMessage id='onboarding.page_six.guidelines' defaultMessage='community guidelines' /></a> }}/>
</p> </p>
); );
} }

View file

@ -56,7 +56,7 @@ const mapDispatchToProps = (dispatch, { type, id }) => ({
onScrollToBottom: debounce(() => { onScrollToBottom: debounce(() => {
dispatch(scrollTopTimeline(type, false)); dispatch(scrollTopTimeline(type, false));
dispatch(expandTimeline(type, id)); dispatch(expandTimeline(type, id));
}, 300, {leading: true}), }, 300, { leading: true }),
onScrollToTop: debounce(() => { onScrollToTop: debounce(() => {
dispatch(scrollTopTimeline(type, true)); dispatch(scrollTopTimeline(type, true));

View file

@ -35,7 +35,7 @@ const validateLanguages = function (languages, validators) {
if (invalidLanguages.length > 0) { if (invalidLanguages.length > 0) {
console.log(`\nError: Specified invalid LANGUAGES:`); console.log(`\nError: Specified invalid LANGUAGES:`);
for (let {language, error} of invalidLanguages) { for (let { language, error } of invalidLanguages) {
console.error(`* ${language}: ${error}`); console.error(`* ${language}: ${error}`);
} }
console.log(`\nUse yarn "manage:translations -- --help" for usage information\n`); console.log(`\nUse yarn "manage:translations -- --help" for usage information\n`);