fix: bug fixes from linters (#1524)

This commit is contained in:
Caleb 2018-07-27 09:13:52 -06:00 committed by Shawn Erquhart
parent 34c8c2ad70
commit 6632e5d152
11 changed files with 16 additions and 14 deletions

View File

@ -8,7 +8,7 @@ function isVisible(field) {
} }
const PreviewContainer = styled.div` const PreviewContainer = styled.div`
fontFamily: Roboto, "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; font-family: Roboto, "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif;
` `
/** /**

View File

@ -273,7 +273,7 @@ export default class EditorToolbar extends React.Component {
isNewEntry, isNewEntry,
} = this.props; } = this.props;
if (currentStatus) { if (currentStatus) {
return [ return (<>
<ToolbarDropdown <ToolbarDropdown
dropdownTopOverlap="40px" dropdownTopOverlap="40px"
dropdownWidth="120px" dropdownWidth="120px"
@ -296,7 +296,7 @@ export default class EditorToolbar extends React.Component {
onClick={() => onChangeStatus('PENDING_PUBLISH')} onClick={() => onChangeStatus('PENDING_PUBLISH')}
icon={currentStatus === status.get('PENDING_PUBLISH') && 'check'} icon={currentStatus === status.get('PENDING_PUBLISH') && 'check'}
/> />
</ToolbarDropdown>, </ToolbarDropdown>
<ToolbarDropdown <ToolbarDropdown
dropdownTopOverlap="40px" dropdownTopOverlap="40px"
dropdownWidth="150px" dropdownWidth="150px"
@ -311,7 +311,7 @@ export default class EditorToolbar extends React.Component {
: null : null
} }
</ToolbarDropdown> </ToolbarDropdown>
]; </>);
} }
if (!isNewEntry) { if (!isNewEntry) {

View File

@ -2,7 +2,7 @@ import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
export default function UnknownControl({ field }) { export default function UnknownControl({ field }) {
return <div>No control for widget '{field.get('widget')}'.</div>; return <div>{`No control for widget '${field.get('widget')}'.`}</div>;
} }
UnknownControl.propTypes = { UnknownControl.propTypes = {

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import styled from 'react-emotion' import styled from 'react-emotion'
import Waypoint from 'react-waypoint';
import MediaLibraryCard from './MediaLibraryCard'; import MediaLibraryCard from './MediaLibraryCard';
import { colors } from 'netlify-cms-ui-default'; import { colors } from 'netlify-cms-ui-default';

View File

@ -37,8 +37,8 @@ export class ErrorBoundary extends React.Component {
<div className={styles.errorBoundary}> <div className={styles.errorBoundary}>
<h1 className={styles.errorBoundaryText}>Sorry!</h1> <h1 className={styles.errorBoundaryText}>Sorry!</h1>
<p> <p>
<span>There's been an error - please </span> <span>{"There's been an error - please "}</span>
<a href={ISSUE_URL} target="_blank" className={styles.errorBoundaryText}>report it</a>! <a href={ISSUE_URL} target="_blank" rel="noopener noreferrer" className={styles.errorBoundaryText}>report it</a>!
</p> </p>
<p>{errorMessage}</p> <p>{errorMessage}</p>
</div> </div>

View File

@ -21,7 +21,6 @@ const styles = {
const WorkflowLink = styled(Link)` const WorkflowLink = styled(Link)`
display: block; display: block;
padding: 0 18px 18px; padding: 0 18px 18px;
padding: 0 18px 18px;
height: 200px; height: 200px;
overflow: hidden; overflow: hidden;
` `

View File

@ -8,7 +8,7 @@ import { formatToExtension } from 'Formats/formats';
const collections = (state = null, action) => { const collections = (state = null, action) => {
switch (action.type) { switch (action.type) {
case CONFIG_SUCCESS: case CONFIG_SUCCESS: {
const configCollections = action.payload ? action.payload.get('collections') : List(); const configCollections = action.payload ? action.payload.get('collections') : List();
return configCollections return configCollections
.toOrderedMap() .toOrderedMap()
@ -21,6 +21,7 @@ const collections = (state = null, action) => {
} }
}) })
.mapKeys((key, collection) => collection.get('name')); .mapKeys((key, collection) => collection.get('name'));
}
default: default:
return state; return state;
} }

View File

@ -22,13 +22,14 @@ import { CONFIG_SUCCESS } from 'Actions/config';
const unpublishedEntries = (state = Map(), action) => { const unpublishedEntries = (state = Map(), action) => {
switch (action.type) { switch (action.type) {
case CONFIG_SUCCESS: case CONFIG_SUCCESS: {
const publishMode = action.payload && action.payload.get('publish_mode'); const publishMode = action.payload && action.payload.get('publish_mode');
if (publishMode === EDITORIAL_WORKFLOW) { if (publishMode === EDITORIAL_WORKFLOW) {
// Editorial workflow state is explicetelly initiated after the config. // Editorial workflow state is explicetelly initiated after the config.
return Map({ entities: Map(), pages: Map() }); return Map({ entities: Map(), pages: Map() });
} }
return state; return state;
}
case UNPUBLISHED_ENTRY_REQUEST: case UNPUBLISHED_ENTRY_REQUEST:
return state.setIn(['entities', `${ action.payload.collection }.${ action.payload.slug }`, 'isFetching'], true); return state.setIn(['entities', `${ action.payload.collection }.${ action.payload.slug }`, 'isFetching'], true);

View File

@ -3,7 +3,7 @@ import { CONFIG_SUCCESS } from 'Actions/config';
const integrations = (state = null, action) => { const integrations = (state = null, action) => {
switch (action.type) { switch (action.type) {
case CONFIG_SUCCESS: case CONFIG_SUCCESS: {
const integrations = action.payload.get('integrations', List()).toJS() || []; const integrations = action.payload.get('integrations', List()).toJS() || [];
const newState = integrations.reduce((acc, integration) => { const newState = integrations.reduce((acc, integration) => {
const { hooks, collections, provider, ...providerData } = integration; const { hooks, collections, provider, ...providerData } = integration;
@ -23,6 +23,7 @@ const integrations = (state = null, action) => {
return acc; return acc;
}, { providers:{}, hooks: {} }); }, { providers:{}, hooks: {} });
return fromJS(newState); return fromJS(newState);
}
default: default:
return state; return state;
} }

View File

@ -55,7 +55,7 @@ const ToolbarToggleLabel = styled.span`
export default class Toolbar extends React.Component { export default class Toolbar extends React.Component {
static propTypes = { static propTypes = {
buttons: PropTypes.object, buttons: ImmutablePropTypes.list,
onToggleMode: PropTypes.func.isRequired, onToggleMode: PropTypes.func.isRequired,
rawMode: PropTypes.bool, rawMode: PropTypes.bool,
plugins: ImmutablePropTypes.map, plugins: ImmutablePropTypes.map,
@ -63,7 +63,6 @@ export default class Toolbar extends React.Component {
onAddAsset: PropTypes.func, onAddAsset: PropTypes.func,
getAsset: PropTypes.func, getAsset: PropTypes.func,
disabled: PropTypes.bool, disabled: PropTypes.bool,
buttons: ImmutablePropTypes.list
}; };
constructor(props) { constructor(props) {

View File

@ -45,7 +45,7 @@ export default function remarkShortcodes({ plugins }) {
* included. Otherwise, return the original node. * included. Otherwise, return the original node.
*/ */
return matchIsValid ? createShortcodeNode(text, plugin, match) : node; return matchIsValid ? createShortcodeNode(text, plugin, match) : node;
}; }
/** /**
* Ensure that the node and it's children are acceptable types to contain * Ensure that the node and it's children are acceptable types to contain