Fix linting

This commit is contained in:
Paul Kaplan 2017-10-26 18:16:14 -04:00
parent 68c6f69211
commit 433baae5ba
7 changed files with 21 additions and 11 deletions

View file

@ -8,8 +8,9 @@ import noFillIcon from './no-fill.svg';
import mixedFillIcon from './mixed-fill.svg';
import styles from './color-button.css';
const colorToBackground = (color) => {
return color === MIXED || color === null ? 'white' : color
const colorToBackground = color => {
if (color === MIXED || color === null) return 'white';
return color;
};
const ColorButtonComponent = props => (
@ -42,9 +43,9 @@ const ColorButtonComponent = props => (
);
ColorButtonComponent.propTypes = {
outline: PropTypes.bool.isRequired,
color: PropTypes.string,
onClick: PropTypes.func.isRequired
onClick: PropTypes.func.isRequired,
outline: PropTypes.bool.isRequired
};
ColorButtonComponent.defaultProps = {

View file

@ -40,6 +40,7 @@ const FillColorIndicatorComponent = props => (
);
FillColorIndicatorComponent.propTypes = {
disabled: PropTypes.bool.isRequired,
fillColor: PropTypes.string,
fillColorModalVisible: PropTypes.bool.isRequired,
intl: intlShape,

View file

@ -5,16 +5,19 @@ import PropTypes from 'prop-types';
import styles from './input-group.css';
const InputGroup = props => (
<div className={classNames(props.className, styles.inputGroup, {
<div
className={classNames(props.className, styles.inputGroup, {
[styles.disabled]: props.disabled
})}>
})}
>
{props.children}
</div>
);
InputGroup.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string
className: PropTypes.string,
disabled: PropTypes.bool.isRequired
};
export default InputGroup;

View file

@ -41,6 +41,7 @@ const StrokeColorIndicatorComponent = props => (
);
StrokeColorIndicatorComponent.propTypes = {
disabled: PropTypes.bool.isRequired,
intl: intlShape,
onChangeStrokeColor: PropTypes.func.isRequired,
onCloseStrokeColor: PropTypes.func.isRequired,

View file

@ -11,8 +11,8 @@ const BufferedInput = BufferedInputHOC(Input);
const StrokeWidthIndicatorComponent = props => (
<InputGroup disabled={props.disabled}>
<BufferedInput
disabled={props.disabled}
small
disabled={props.disabled}
max={MAX_STROKE_WIDTH}
min="0"
type="number"
@ -23,6 +23,7 @@ const StrokeWidthIndicatorComponent = props => (
);
StrokeWidthIndicatorComponent.propTypes = {
disabled: PropTypes.bool.isRequired,
onChangeStrokeWidth: PropTypes.func.isRequired,
strokeWidth: PropTypes.number
};

View file

@ -59,7 +59,6 @@ class LineMode extends React.Component {
this.props.onChangeStrokeColor(LineMode.DEFAULT_COLOR);
}
// Force a minimum stroke width
console.log(this.props.colorState.strokeWidth)
if (!this.props.colorState.strokeWidth) {
this.props.onChangeStrokeWidth(1);
}
@ -237,6 +236,8 @@ LineMode.propTypes = {
}).isRequired,
handleMouseDown: PropTypes.func.isRequired,
isLineModeActive: PropTypes.bool.isRequired,
onChangeStrokeColor: PropTypes.func.isRequired,
onChangeStrokeWidth: PropTypes.func.isRequired,
onUpdateSvg: PropTypes.func.isRequired
};

View file

@ -51,7 +51,7 @@ class PenMode extends React.Component {
// Force the default pen color if stroke is MIXED or transparent
const {strokeColor} = this.props.colorState;
if (strokeColor === MIXED || strokeColor === null) {
this.props.onChangeStrokeColor(PenMode.DEFAULT_COLOR)
this.props.onChangeStrokeColor(PenMode.DEFAULT_COLOR);
}
// Force a minimum stroke width
if (!this.props.colorState.strokeWidth) {
@ -88,6 +88,8 @@ PenMode.propTypes = {
}).isRequired,
handleMouseDown: PropTypes.func.isRequired,
isPenModeActive: PropTypes.bool.isRequired,
onChangeStrokeColor: PropTypes.func.isRequired,
onChangeStrokeWidth: PropTypes.func.isRequired,
onUpdateSvg: PropTypes.func.isRequired
};