Fixed ESLint errors and warning that could be fixed with eslint --fix

This commit is contained in:
Andrey Okonetchnikov 2016-09-13 15:30:58 +02:00
parent 09841c05e2
commit eb14200643
19 changed files with 48 additions and 48 deletions

View File

@ -21,9 +21,9 @@ export default class AuthenticationPage extends React.Component {
auth = new Authenticator();
}
auth.authenticate({provider: 'github', scope: 'repo'}, (err, data) => {
auth.authenticate({ provider: 'github', scope: 'repo' }, (err, data) => {
if (err) {
this.setState({loginError: err.toString()});
this.setState({ loginError: err.toString() });
return;
}
this.props.onLogin(data);

View File

@ -14,8 +14,8 @@ export default class AuthenticationPage extends React.Component {
handleLogin(e) {
e.preventDefault();
const {email, password} = this.state;
this.setState({authenticating: true});
const { email, password } = this.state;
this.setState({ authenticating: true });
fetch(`${AuthenticationPage.url}/token`, {
method: 'POST',
body: 'grant_type=client_credentials',
@ -27,18 +27,18 @@ export default class AuthenticationPage extends React.Component {
console.log(response);
if (response.ok) {
return response.json().then((data) => {
this.props.onLogin(Object.assign({email}, data));
this.props.onLogin(Object.assign({ email }, data));
});
}
response.json().then((data) => {
this.setState({loginError: data.msg});
})
})
this.setState({ loginError: data.msg });
});
});
}
handleChange(key) {
return (e) => {
this.setState({[key]: e.target.value});
this.setState({ [key]: e.target.value });
};
}

View File

@ -7,7 +7,7 @@ export default class AuthenticationPage extends React.Component {
constructor(props) {
super(props);
this.state = {email: ''};
this.state = { email: '' };
this.handleLogin = this.handleLogin.bind(this);
this.handleEmailChange = this.handleEmailChange.bind(this);
}
@ -18,7 +18,7 @@ export default class AuthenticationPage extends React.Component {
}
handleEmailChange(e) {
this.setState({email: e.target.value});
this.setState({ email: e.target.value });
}
render() {

View File

@ -27,14 +27,14 @@ export default class EntryEditor extends React.Component {
calculateHeight() {
const height = window.innerHeight - 54;
console.log('setting height to %s', height);
this.setState({height});
this.setState({ height });
}
render() {
const { collection, entry, getMedia, onChange, onAddMedia, onRemoveMedia, onPersist } = this.props;
const {height} = this.state;
const { height } = this.state;
return <div className={styles.entryEditor} style={{height}}>
return <div className={styles.entryEditor} style={{ height }}>
<div className={styles.container}>
<div className={styles.controlPane}>
<ControlPane

View File

@ -55,7 +55,7 @@ export default class PreviewPane extends React.Component {
}
renderPreview() {
const props = Object.assign({}, this.props, {widgetFor: this.widgetFor});
const props = Object.assign({}, this.props, { widgetFor: this.widgetFor });
const component = registry.getPreviewTemplate(props.collection.get('name')) || Preview;
render(React.createElement(component, props), this.previewEl);

View File

@ -6,7 +6,7 @@ const availableIcons = [
'bold', 'italic', 'list', 'font', 'text-height', 'text-width', 'align-left', 'align-center', 'align-right',
'align-justify', 'indent-left', 'indent-right', 'list-bullet', 'list-numbered', 'strike', 'underline', 'table',
'superscript', 'subscript', 'header', 'h1', 'h2', 'paragraph', 'link', 'unlink', 'quote-left', 'quote-right', 'code',
'picture','video',
'picture', 'video',
// Entypo
'note', 'note-beamed',
'music',
@ -199,7 +199,7 @@ const iconPropType = (props, propName) => {
const noop = function() {};
export default function Icon({ style, className = '', type, onClick = noop}) {
export default function Icon({ style, className = '', type, onClick = noop }) {
return <span className={`${styles.root} ${styles[type]} ${className}`} style={style} onClick={onClick} />;
}

View File

@ -2,7 +2,7 @@ import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import moment from 'moment';
import { Card } from './UI';
import { Link } from 'react-router'
import { Link } from 'react-router';
import { statusDescriptions } from '../constants/publishModes';
import styles from './UnpublishedListing.css';

View File

@ -60,7 +60,7 @@ class MarkdownControl extends React.Component {
return (
<div>
{ this.renderEditor() }
{this.renderEditor()}
</div>
);
}

View File

@ -62,4 +62,4 @@ export const SCHEMA = {
borderRadius: '4px'
}
}
}
};

View File

@ -46,7 +46,7 @@ function processEditorPlugins(plugins) {
<div {...props.attributes} className={className}>
<div className="plugin_icon" contentEditable={false}><Icon type={plugin.icon}/></div>
<div className="plugin_fields" contentEditable={false}>
{ plugin.fields.map(field => `${field.label}: “${node.data.get(field.name)}`) }
{plugin.fields.map(field => `${field.label}: “${node.data.get(field.name)}`)}
</div>
</div>
);

View File

@ -39,4 +39,4 @@ storiesOf('Card', module)
<p>header and footer elements are also not subject to margin</p>
<footer style={styles.footer}>&copy; Thousand Cats Corp</footer>
</Card>
))
));

View File

@ -290,7 +290,7 @@ class FindBar extends Component {
let children;
if (!command.search) {
children = (
<span><span dangerouslySetInnerHTML={{__html: command.string}} /></span>
<span><span dangerouslySetInnerHTML={{ __html: command.string }} /></span>
);
} else {
children = (
@ -317,7 +317,7 @@ class FindBar extends Component {
return commands.length === 0 ? null : (
<div className={styles.menu}>
<div className={styles.suggestions}>
{ commands }
{commands}
</div>
<div className={styles.history}>
Your past searches and commands

View File

@ -41,6 +41,6 @@ export default class YAML {
}
toFile(data) {
return yaml.safeDump(data, {schema: OutputSchema});
return yaml.safeDump(data, { schema: OutputSchema });
}
}

View File

@ -1,5 +1,5 @@
import {List} from 'immutable';
import {newEditorPlugin} from '../components/Widgets/MarkdownControlElements/plugins';
import { List } from 'immutable';
import { newEditorPlugin } from '../components/Widgets/MarkdownControlElements/plugins';
const _registry = {
templates: {},

View File

@ -16,15 +16,15 @@ describe('auth', () => {
expect(
auth(undefined, authenticating())
).toEqual(
Immutable.Map({isFetching: true})
Immutable.Map({ isFetching: true })
);
});
it('should handle authentication', () => {
expect(
auth(undefined, authenticate({email: 'joe@example.com'}))
auth(undefined, authenticate({ email: 'joe@example.com' }))
).toEqual(
Immutable.fromJS({user: {email: 'joe@example.com'}})
Immutable.fromJS({ user: { email: 'joe@example.com' } })
);
});

View File

@ -15,39 +15,39 @@ describe('collections', () => {
it('should load the collections from the config', () => {
expect(
collections(undefined, configLoaded({collections: [
{name: 'posts', folder: '_posts', fields: [{name: 'title', widget: 'string'}]}
]}))
collections(undefined, configLoaded({ collections: [
{ name: 'posts', folder: '_posts', fields: [{ name: 'title', widget: 'string' }] }
] }))
).toEqual(
OrderedMap({
posts: fromJS({name: 'posts', folder: '_posts', fields: [{name: 'title', widget: 'string'}]})
posts: fromJS({ name: 'posts', folder: '_posts', fields: [{ name: 'title', widget: 'string' }] })
})
);
});
it('should mark entries as loading', () => {
const state = OrderedMap({
'posts': Map({name: 'posts'})
'posts': Map({ name: 'posts' })
});
expect(
collections(state, entriesLoading(Map({name: 'posts'})))
collections(state, entriesLoading(Map({ name: 'posts' })))
).toEqual(
OrderedMap({
'posts': Map({name: 'posts', isFetching: true})
'posts': Map({ name: 'posts', isFetching: true })
})
);
});
it('should handle loaded entries', () => {
const state = OrderedMap({
'posts': Map({name: 'posts'})
'posts': Map({ name: 'posts' })
});
const entries = [{slug: 'a', path: ''}, {slug: 'b', title: 'B'}];
const entries = [{ slug: 'a', path: '' }, { slug: 'b', title: 'B' }];
expect(
collections(state, entriesLoaded(Map({name: 'posts'}), entries))
collections(state, entriesLoaded(Map({ name: 'posts' }), entries))
).toEqual(
OrderedMap({
'posts': fromJS({name: 'posts', entries: entries})
'posts': fromJS({ name: 'posts', entries: entries })
})
);
});

View File

@ -14,9 +14,9 @@ describe('config', () => {
it('should handle an update', () => {
expect(
config(Immutable.Map({'a': 'b', 'c': 'd'}), configLoaded({'a': 'changed', 'e': 'new'}))
config(Immutable.Map({ 'a': 'b', 'c': 'd' }), configLoaded({ 'a': 'changed', 'e': 'new' }))
).toEqual(
Immutable.Map({'a': 'changed', 'e': 'new'})
Immutable.Map({ 'a': 'changed', 'e': 'new' })
);
});
@ -24,15 +24,15 @@ describe('config', () => {
expect(
config(undefined, configLoading())
).toEqual(
Immutable.Map({isFetching: true})
Immutable.Map({ isFetching: true })
);
});
it('should handle an error', () => {
expect(
config(Immutable.Map({isFetching: true}), configFailed(new Error('Config could not be loaded')))
config(Immutable.Map({ isFetching: true }), configFailed(new Error('Config could not be loaded')))
).toEqual(
Immutable.Map({error: 'Error: Config could not be loaded'})
Immutable.Map({ error: 'Error: Config could not be loaded' })
);
});
});

View File

@ -13,7 +13,7 @@ module.exports = {
{ test: /\.json$/, loader: 'json-loader' },
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style", "css?modules&importLoaders=1&&localIdentName=cms__[name]__[local]!postcss"),
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&&localIdentName=cms__[name]__[local]!postcss'),
},
{
loader: 'babel',