chore: minor warning fixes

This commit is contained in:
EnixCoda 2018-06-17 20:44:23 +08:00
parent 108d59d7ac
commit 57f4f2b5ea
6 changed files with 10 additions and 10 deletions

View file

@ -69,10 +69,12 @@ function getSVGIconComponent(type) {
}
}
const iconStyle = { width: '100%', height: '100%' }
export default function Icon({ type, className, ...otherProps }) {
return (
<div className={cx('octicon-wrapper', className)} {...otherProps}>
{React.createElement(getSVGIconComponent(type), { width: '100%', height: '100%' })}
{React.createElement(getSVGIconComponent(type), iconStyle)}
</div>
)
}

View file

@ -1,10 +1,8 @@
import React from 'react'
import PJAX from 'pjax'
import Icon from './Icon'
import cx from '../utils/cx'
import general from '../utils/general'
import DOMHelper from '../utils/DOMHelper'
function getIconType(node) {
@ -31,7 +29,7 @@ export default class Node extends React.PureComponent {
}
render() {
const { node, depth, expanded, focused, pjax } = this.props
const { node, depth, expanded, focused } = this.props
const { name, path } = node
return (
<div className={cx(`node-item-row`, { focused })} title={path}>

View file

@ -2,7 +2,7 @@ import React from 'react'
import Icon from './Icon'
export default class ResizeHandler extends React.Component {
export default class ResizeHandler extends React.PureComponent {
pointerDown = false
startX = 0
delta = 0

View file

@ -37,7 +37,7 @@ function friendlyFormatShortcut(shortcut) {
}
}
export default class SettingsBar extends React.Component {
export default class SettingsBar extends React.PureComponent {
state = {
accessTokenHint: null,
accessToken: '',

View file

@ -35,7 +35,7 @@ const TYPES = {
}
function isInCodePage(metaData = {}) {
const { userName, repoName, type, branchName } = { ...parseRaw(), ...metaData }
return (
return Boolean(
userName &&
!RESERVED_NAME.find(_ => _ === userName) &&
repoName &&

View file

@ -12,15 +12,15 @@ const nodeTemplate = {
function sortFoldersToFront(root) {
const isFolder = node => node.type === 'tree'
const isNotFolder = (...args) => !isFolder(...args)
function DFS(root) {
function depthFirstSearch(root) {
const nodes = root.contents
if (nodes) {
nodes.splice(0, Infinity, ...nodes.filter(isFolder), ...nodes.filter(isNotFolder))
nodes.forEach(DFS)
nodes.forEach(depthFirstSearch)
}
return root
}
return DFS(root)
return depthFirstSearch(root)
}
function setParentNode(root, parent = null) {