chore(lint): cleanup unused variables in code (#1563)
This commit is contained in:
@ -51,7 +51,6 @@ function validateCollection(collection) {
|
||||
format,
|
||||
extension,
|
||||
frontmatter_delimiter: delimiter,
|
||||
fields,
|
||||
} = collection.toJS();
|
||||
|
||||
if (!folder && !files) {
|
||||
|
@ -189,6 +189,7 @@ function unpublishedEntryPublishError(collection, slug, transactionID) {
|
||||
}
|
||||
|
||||
function unpublishedEntryDeleteRequest(collection, slug, transactionID) {
|
||||
// The reducer doesn't handle this action -- it is for `optimist`.
|
||||
return {
|
||||
type: UNPUBLISHED_ENTRY_DELETE_REQUEST,
|
||||
payload: { collection, slug },
|
||||
@ -205,6 +206,7 @@ function unpublishedEntryDeleted(collection, slug, transactionID) {
|
||||
}
|
||||
|
||||
function unpublishedEntryDeleteError(collection, slug, transactionID) {
|
||||
// The reducer doesn't handle this action -- it is for `optimist`.
|
||||
return {
|
||||
type: UNPUBLISHED_ENTRY_DELETE_FAILURE,
|
||||
payload: { collection, slug },
|
||||
|
@ -360,7 +360,6 @@ class Backend {
|
||||
description: entryDraft.getIn(["entry", "data", "description"], "No Description!"),
|
||||
};
|
||||
|
||||
const entryData = entryDraft.getIn(["entry", "data"]).toJS();
|
||||
let entryObj;
|
||||
if (newEntry) {
|
||||
if (!selectAllowNewEntries(collection)) {
|
||||
|
@ -167,7 +167,7 @@ class App extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
function mapStateToProps(state) {
|
||||
const { auth, config, collections, globalUI } = state;
|
||||
const user = auth && auth.get('user');
|
||||
const isFetching = globalUI.get('isFetching');
|
||||
|
@ -110,15 +110,12 @@ export default class Header extends React.Component {
|
||||
const {
|
||||
user,
|
||||
collections,
|
||||
toggleDrawer,
|
||||
onLogoutClick,
|
||||
openMediaLibrary,
|
||||
hasWorkflow,
|
||||
displayUrl,
|
||||
} = this.props;
|
||||
|
||||
const avatarUrl = user.get('avatar_url');
|
||||
|
||||
return (
|
||||
<AppHeaderContainer>
|
||||
<AppHeader>
|
||||
|
@ -8,8 +8,6 @@ const Entries = ({
|
||||
collections,
|
||||
entries,
|
||||
publicFolder,
|
||||
page,
|
||||
onPaginate,
|
||||
isFetching,
|
||||
viewStyle,
|
||||
cursor,
|
||||
|
@ -53,7 +53,7 @@ class EntriesSearch extends React.Component {
|
||||
};
|
||||
|
||||
render () {
|
||||
const { collections, entries, publicFolder, page, isFetching } = this.props;
|
||||
const { collections, entries, publicFolder, isFetching } = this.props;
|
||||
return (
|
||||
<Entries
|
||||
cursor={this.getCursor()}
|
||||
@ -61,8 +61,6 @@ class EntriesSearch extends React.Component {
|
||||
collections={collections}
|
||||
entries={entries}
|
||||
publicFolder={publicFolder}
|
||||
page={page}
|
||||
onPaginate={this.handleLoadMore}
|
||||
isFetching={isFetching}
|
||||
/>
|
||||
);
|
||||
|
@ -66,9 +66,7 @@ class Editor extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
entry,
|
||||
newEntry,
|
||||
entryDraft,
|
||||
collection,
|
||||
slug,
|
||||
loadEntry,
|
||||
@ -179,12 +177,12 @@ class Editor extends React.Component {
|
||||
return;
|
||||
}
|
||||
const newStatus = status.get(newStatusName);
|
||||
this.props.updateUnpublishedEntryStatus(collection.get('name'), slug, currentStatus, newStatus);
|
||||
updateUnpublishedEntryStatus(collection.get('name'), slug, currentStatus, newStatus);
|
||||
}
|
||||
|
||||
handlePersistEntry = async (opts = {}) => {
|
||||
const { createNew = false } = opts;
|
||||
const { persistEntry, collection, entryDraft, newEntry, currentStatus, hasWorkflow, loadEntry, slug, createEmptyDraft } = this.props;
|
||||
const { persistEntry, collection, currentStatus, hasWorkflow, loadEntry, slug, createEmptyDraft } = this.props;
|
||||
|
||||
await persistEntry(collection)
|
||||
|
||||
@ -299,7 +297,6 @@ class Editor extends React.Component {
|
||||
onChangeStatus={this.handleChangeStatus}
|
||||
onPublish={this.handlePublishEntry}
|
||||
showDelete={this.props.showDelete}
|
||||
enableSave={entryDraft.get('hasChanged')}
|
||||
user={user}
|
||||
hasChanged={hasChanged}
|
||||
displayUrl={displayUrl}
|
||||
@ -315,7 +312,7 @@ class Editor extends React.Component {
|
||||
}
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
const { collections, entryDraft, mediaLibrary, auth, config, entries } = state;
|
||||
const { collections, entryDraft, auth, config, entries } = state;
|
||||
const slug = ownProps.match.params.slug;
|
||||
const collection = collections.get(ownProps.match.params.name);
|
||||
const collectionName = collection.get('name');
|
||||
|
@ -195,7 +195,7 @@ class EditorControl extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => ({
|
||||
const mapStateToProps = state => ({
|
||||
mediaPaths: state.mediaLibrary.get('controlMedia'),
|
||||
boundGetAsset: getAsset.bind(null, state),
|
||||
isFetching: state.search.get('isFetching'),
|
||||
|
@ -154,7 +154,6 @@ class EditorInterface extends Component {
|
||||
fieldsErrors,
|
||||
getAsset,
|
||||
onChange,
|
||||
enableSave,
|
||||
showDelete,
|
||||
onDelete,
|
||||
onDeleteUnpublishedChanges,
|
||||
@ -230,7 +229,6 @@ class EditorInterface extends Component {
|
||||
showDelete={showDelete}
|
||||
onPublish={onPublish}
|
||||
onPublishAndNew={() => this.handleOnPublish({ createNew: true })}
|
||||
enableSave={enableSave}
|
||||
user={user}
|
||||
hasChanged={hasChanged}
|
||||
displayUrl={displayUrl}
|
||||
@ -278,7 +276,6 @@ EditorInterface.propTypes = {
|
||||
onChange: PropTypes.func.isRequired,
|
||||
onValidate: PropTypes.func.isRequired,
|
||||
onPersist: PropTypes.func.isRequired,
|
||||
enableSave: PropTypes.bool.isRequired,
|
||||
showDelete: PropTypes.bool.isRequired,
|
||||
onDelete: PropTypes.func.isRequired,
|
||||
onDeleteUnpublishedChanges: PropTypes.func.isRequired,
|
||||
|
@ -116,7 +116,7 @@ export default class PreviewPane extends React.Component {
|
||||
const value = entry.getIn(['data', field.get('name')]);
|
||||
|
||||
if (List.isList(value)) {
|
||||
return value.map((val, index) => {
|
||||
return value.map(val => {
|
||||
const widgets = nestedFields && Map(nestedFields.map((f, i) => [f.get('name'), <div key={i}>{this.getWidget(f, val, this.props)}</div>]));
|
||||
return Map({ data: val, widgets });
|
||||
});
|
||||
|
@ -16,7 +16,6 @@ import {
|
||||
} from 'netlify-cms-ui-default';
|
||||
import { status } from 'Constants/publishModes';
|
||||
import SettingsDropdown from 'UI/SettingsDropdown';
|
||||
import { stripProtocol } from 'Lib/urlHelper';
|
||||
|
||||
const styles = {
|
||||
buttonMargin: css`
|
||||
@ -262,8 +261,6 @@ export default class EditorToolbar extends React.Component {
|
||||
renderWorkflowPublishControls = () => {
|
||||
const {
|
||||
collection,
|
||||
onPersist,
|
||||
onPersistAndNew,
|
||||
isUpdatingStatus,
|
||||
isPublishing,
|
||||
onChangeStatus,
|
||||
@ -323,22 +320,13 @@ export default class EditorToolbar extends React.Component {
|
||||
|
||||
render() {
|
||||
const {
|
||||
isPersisting,
|
||||
onPersist,
|
||||
onPersistAndNew,
|
||||
enableSave,
|
||||
showDelete,
|
||||
onDelete,
|
||||
user,
|
||||
hasChanged,
|
||||
displayUrl,
|
||||
collection,
|
||||
hasWorkflow,
|
||||
hasUnpublishedChanges,
|
||||
onLogoutClick,
|
||||
} = this.props;
|
||||
const disabled = !enableSave || isPersisting;
|
||||
const avatarUrl = user.get('avatar_url');
|
||||
|
||||
return (
|
||||
<ToolbarContainer>
|
||||
|
@ -219,7 +219,6 @@ class MediaLibrary extends React.Component {
|
||||
isPersisting,
|
||||
isDeleting,
|
||||
hasNextPage,
|
||||
page,
|
||||
isPaginating,
|
||||
privateUpload,
|
||||
} = this.props;
|
||||
@ -236,7 +235,6 @@ class MediaLibrary extends React.Component {
|
||||
isPersisting={isPersisting}
|
||||
isDeleting={isDeleting}
|
||||
hasNextPage={hasNextPage}
|
||||
page={page}
|
||||
isPaginating={isPaginating}
|
||||
privateUpload={privateUpload}
|
||||
query={this.state.query}
|
||||
|
@ -37,7 +37,7 @@ const MediaLibraryCardGrid = ({
|
||||
<CardGridContainer innerRef={setScrollContainerRef}>
|
||||
<CardGrid>
|
||||
{
|
||||
mediaItems.map((file, idx) =>
|
||||
mediaItems.map(file =>
|
||||
<MediaLibraryCard
|
||||
key={file.key}
|
||||
isSelected={isSelectedFile(file)}
|
||||
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styled from 'react-emotion';
|
||||
import { isEmpty } from 'lodash';
|
||||
import Waypoint from 'react-waypoint';
|
||||
import { Modal } from 'UI';
|
||||
import MediaLibrarySearch from './MediaLibrarySearch';
|
||||
import MediaLibraryHeader from './MediaLibraryHeader';
|
||||
@ -77,7 +76,6 @@ const MediaLibraryModal = ({
|
||||
isPersisting,
|
||||
isDeleting,
|
||||
hasNextPage,
|
||||
page,
|
||||
isPaginating,
|
||||
privateUpload,
|
||||
query,
|
||||
@ -180,7 +178,6 @@ MediaLibraryModal.propTypes = {
|
||||
isPersisting: PropTypes.bool,
|
||||
isDeleting: PropTypes.bool,
|
||||
hasNextPage: PropTypes.bool,
|
||||
page: PropTypes.number,
|
||||
isPaginating: PropTypes.bool,
|
||||
privateUpload: PropTypes.bool,
|
||||
query: PropTypes.string,
|
||||
|
@ -11,12 +11,12 @@ export const DragSource = ({ namespace, ...props }) => {
|
||||
const DragComponent = ReactDNDDragSource(
|
||||
namespace,
|
||||
{
|
||||
beginDrag({ children, isDragging, connectDragComponent, ...ownProps }) {
|
||||
beginDrag({ children, isDragging, connectDragComponent, ...ownProps }) { // eslint-disable-line no-unused-vars
|
||||
// We return the rest of the props as the ID of the element being dragged.
|
||||
return ownProps;
|
||||
},
|
||||
},
|
||||
(connect, monitor) => ({
|
||||
connect => ({
|
||||
connectDragComponent: connect.dragSource(),
|
||||
}),
|
||||
)(
|
||||
|
@ -98,7 +98,6 @@ const WorkflowCardContainer = styled.div`
|
||||
const WorkflowCard = ({
|
||||
collectionName,
|
||||
title,
|
||||
author,
|
||||
authorLastChange,
|
||||
body,
|
||||
isModification,
|
||||
|
@ -159,8 +159,6 @@ Please drag the card to the "Ready" column to enable publishing.`
|
||||
<div>
|
||||
{
|
||||
entries.map((entry) => {
|
||||
// Look for an "author" field. Fallback to username on backend implementation;
|
||||
const author = entry.getIn(['data', 'author'], entry.getIn(['metaData', 'user']));
|
||||
const timestamp = moment(entry.getIn(['metaData', 'timeStamp'])).format('MMMM D');
|
||||
const editLink = `collections/${ entry.getIn(['metaData', 'collection']) }/entries/${ entry.get('slug') }`;
|
||||
const slug = entry.get('slug');
|
||||
@ -181,7 +179,6 @@ Please drag the card to the "Ready" column to enable publishing.`
|
||||
<WorkflowCard
|
||||
collectionName={collection}
|
||||
title={entry.getIn(['data', 'title'])}
|
||||
author={author}
|
||||
authorLastChange={entry.getIn(['metaData', 'user'])}
|
||||
body={entry.getIn(['data', 'body'])}
|
||||
isModification={isModification}
|
||||
|
@ -14,9 +14,7 @@ import {
|
||||
UNPUBLISHED_ENTRY_PUBLISH_REQUEST,
|
||||
UNPUBLISHED_ENTRY_PUBLISH_SUCCESS,
|
||||
UNPUBLISHED_ENTRY_PUBLISH_FAILURE,
|
||||
UNPUBLISHED_ENTRY_DELETE_REQUEST,
|
||||
UNPUBLISHED_ENTRY_DELETE_SUCCESS,
|
||||
UNPUBLISHED_ENTRY_DELETE_FAILURE,
|
||||
} from 'Actions/editorialWorkflow';
|
||||
import { CONFIG_SUCCESS } from 'Actions/config';
|
||||
|
||||
|
@ -57,7 +57,7 @@ const mediaLibrary = (state = Map({ isVisible: false, controlMedia: Map() }), ac
|
||||
map.set('isPaginating', action.payload.page > 1);
|
||||
});
|
||||
case MEDIA_LOAD_SUCCESS: {
|
||||
const { files = [], page, canPaginate, dynamicSearch, dynamicSearchQuery, privateUpload } = action.payload;
|
||||
const { files = [], page, canPaginate, dynamicSearch, dynamicSearchQuery } = action.payload;
|
||||
|
||||
if (privateUploadChanged) {
|
||||
return state;
|
||||
|
@ -30,7 +30,7 @@ AssetProxy.prototype.toString = function () {
|
||||
};
|
||||
|
||||
AssetProxy.prototype.toBase64 = function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
const fr = new FileReader();
|
||||
fr.onload = (readerEvt) => {
|
||||
const binaryString = readerEvt.target.result;
|
||||
@ -50,7 +50,7 @@ export function createAssetProxy(value, fileObj, uploaded = false, privateUpload
|
||||
response => (
|
||||
new AssetProxy(response.asset.url.replace(/^(https?):/, ''), null, true, response.asset)
|
||||
),
|
||||
error => new AssetProxy(value, fileObj, false)
|
||||
() => new AssetProxy(value, fileObj, false)
|
||||
);
|
||||
} else if (privateUpload) {
|
||||
throw new Error('The Private Upload option is only avaible for Asset Store Integration');
|
||||
|
@ -1,40 +1,19 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Component, Children } from 'react';
|
||||
import { List, Record, fromJS } from 'immutable';
|
||||
import { Record, fromJS } from 'immutable';
|
||||
import { isFunction } from 'lodash';
|
||||
|
||||
const plugins = { editor: List() };
|
||||
|
||||
const catchesNothing = /.^/;
|
||||
/* eslint-disable no-unused-vars */
|
||||
const EditorComponent = Record({
|
||||
id: null,
|
||||
label: 'unnamed component',
|
||||
icon: 'exclamation-triangle',
|
||||
fields: [],
|
||||
pattern: catchesNothing,
|
||||
fromBlock(match) { return {}; },
|
||||
fromBlock(match) { return {}; },
|
||||
toBlock(attributes) { return 'Plugin'; },
|
||||
toPreview(attributes) { return 'Plugin'; },
|
||||
});
|
||||
|
||||
|
||||
class Plugin extends Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.element.isRequired,
|
||||
};
|
||||
|
||||
static childContextTypes = {
|
||||
plugins: PropTypes.object,
|
||||
};
|
||||
|
||||
getChildContext() {
|
||||
return { plugins };
|
||||
}
|
||||
|
||||
render() {
|
||||
return Children.only(this.props.children);
|
||||
}
|
||||
}
|
||||
/* eslint-enable */
|
||||
|
||||
export default function createEditorComponent(config) {
|
||||
const configObj = new EditorComponent({
|
||||
|
@ -1,8 +1,7 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const pkg = require('./package.json');
|
||||
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
|
||||
const { getConfig, rules, plugins } = require('../../scripts/webpack.js');
|
||||
const { getConfig, rules } = require('../../scripts/webpack.js');
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
@ -16,7 +15,7 @@ module.exports = {
|
||||
rules: [
|
||||
...Object.entries(rules)
|
||||
.filter(([ key ]) => key !== 'js')
|
||||
.map(([ _, rule ]) => rule()),
|
||||
.map(([ , rule ]) => rule()),
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
|
Reference in New Issue
Block a user