Skip to content

Commit deb63ff

Browse files
committed
style: auto-fix many lint warnings, plus some spelling
1 parent d6dce8a commit deb63ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+138
-145
lines changed

src/components/paint-editor/paint-editor.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const PaintEditorComponent = props => {
133133

134134
<div className={styles.topAlignRow}>
135135
{/* Modes */}
136-
{props.canvas !== null && isVector(props.format) ? ( // eslint-disable-line no-negated-condition
136+
{props.canvas !== null && isVector(props.format) ? (
137137
<div className={styles.modeSelector}>
138138
<SelectMode
139139
onUpdateImage={props.onUpdateImage}
@@ -166,7 +166,7 @@ const PaintEditorComponent = props => {
166166
</div>
167167
) : null}
168168

169-
{props.canvas !== null && isBitmap(props.format) ? ( // eslint-disable-line no-negated-condition
169+
{props.canvas !== null && isBitmap(props.format) ? (
170170
<div className={styles.modeSelector}>
171171
<BitBrushMode
172172
onUpdateImage={props.onUpdateImage}

src/containers/mode-tools.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class ModeTools extends React.Component {
9797
// Point is end point
9898
// Direction is average of normal at the point and direction to prev point, using the
9999
// normal that points out from the convex side
100-
// Lenth is curve length * HANDLE_RATIO
100+
// Length is curve length * HANDLE_RATIO
101101
const convexity = prev.getCurve().getCurvatureAtTime(.5) < 0 ? -1 : 1;
102102
point.handleIn = (prev.getCurve().getNormalAtTime(1)
103103
.multiply(convexity)
@@ -108,7 +108,7 @@ class ModeTools extends React.Component {
108108
// Point is start point
109109
// Direction is average of normal at the point and direction to prev point, using the
110110
// normal that points out from the convex side
111-
// Lenth is curve length * HANDLE_RATIO
111+
// Length is curve length * HANDLE_RATIO
112112
const convexity = point.getCurve().getCurvatureAtTime(.5) < 0 ? -1 : 1;
113113
point.handleOut = (point.getCurve().getNormalAtTime(0)
114114
.multiply(convexity)
@@ -236,7 +236,7 @@ ModeTools.propTypes = {
236236
onUpdateImage: PropTypes.func.isRequired,
237237
// Listen on selected items to update hasSelectedPoints
238238
selectedItems:
239-
PropTypes.arrayOf(PropTypes.instanceOf(paper.Item)), // eslint-disable-line react/no-unused-prop-types
239+
PropTypes.arrayOf(PropTypes.instanceOf(paper.Item)),
240240
setSelectedItems: PropTypes.func.isRequired
241241
};
242242

src/helper/bit-tools/brush-tool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {forEachLinePoint, getBrushMark} from '../bitmap';
77
*/
88
class BrushTool extends paper.Tool {
99
/**
10-
* @param {!function} onUpdateImage A callback to call when the image visibly changes
10+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
1111
* @param {boolean} isEraser True if brush should erase
1212
*/
1313
constructor (onUpdateImage, isEraser) {

src/helper/bit-tools/fill-tool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const TRANSPARENT = 'rgba(0,0,0,0)';
1010
*/
1111
class FillTool extends paper.Tool {
1212
/**
13-
* @param {!function} onUpdateImage A callback to call when the image visibly changes
13+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
1414
*/
1515
constructor (onUpdateImage) {
1616
super();

src/helper/bit-tools/line-tool.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import {ART_BOARD_WIDTH, ART_BOARD_HEIGHT} from '../view';
88
*/
99
class LineTool extends paper.Tool {
1010
/**
11-
* @param {!function} onUpdateImage A callback to call when the image visibly changes
11+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
1212
*/
1313
constructor (onUpdateImage) {
1414
super();
1515
this.onUpdateImage = onUpdateImage;
16-
16+
1717
// We have to set these functions instead of just declaring them because
1818
// paper.js tools hook up the listeners in the setter functions.
1919
this.onMouseMove = this.handleMouseMove;
@@ -97,7 +97,7 @@ class LineTool extends paper.Tool {
9797
}
9898
handleMouseUp (event) {
9999
if (event.event.button > 0 || !this.active) return; // only first mouse button
100-
100+
101101
this.drawTarget.remove();
102102
this.drawTarget = getRaster();
103103
forEachLinePoint(this.startPoint, event.point, this.draw.bind(this));

src/helper/bit-tools/oval-tool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class OvalTool extends paper.Tool {
1919
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
2020
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
2121
* @param {function} setCursor Callback to set the visible mouse cursor
22-
* @param {!function} onUpdateImage A callback to call when the image visibly changes
22+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
2323
*/
2424
constructor (setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
2525
super();

src/helper/bit-tools/rect-tool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class RectTool extends paper.Tool {
1919
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
2020
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
2121
* @param {function} setCursor Callback to set the visible mouse cursor
22-
* @param {!function} onUpdateImage A callback to call when the image visibly changes
22+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
2323
*/
2424
constructor (setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
2525
super();

src/helper/bit-tools/select-tool.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SelectTool extends paper.Tool {
2424
* @param {function} setSelectedItems Callback to set the set of selected items in the Redux state
2525
* @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state
2626
* @param {function} setCursor Callback to set the visible mouse cursor
27-
* @param {!function} onUpdateImage A callback to call when the image visibly changes
27+
* @param {!Function} onUpdateImage A callback to call when the image visibly changes
2828
*/
2929
constructor (setSelectedItems, clearSelectedItems, setCursor, onUpdateImage) {
3030
super();
@@ -71,7 +71,7 @@ class SelectTool extends paper.Tool {
7171
}
7272
/**
7373
* Returns the hit options to use when conducting hit tests.
74-
* @return {object} See paper.Item.hitTest for definition of options
74+
* @returns {object} See paper.Item.hitTest for definition of options
7575
*/
7676
getHitOptions () {
7777
// Tolerance needs to be scaled when the view is zoomed in in order to represent the same

src/helper/bitmap.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const forEachLinePoint = function (point1, point2, callback) {
3838
* @param {!number} a Coefficient in ax^2 + bx + c = 0
3939
* @param {!number} b Coefficient in ax^2 + bx + c = 0
4040
* @param {!number} c Coefficient in ax^2 + bx + c = 0
41-
* @return {Array<number>} Array of 2 solutions, with the larger solution first
41+
* @returns {Array<number>} Array of 2 solutions, with the larger solution first
4242
*/
4343
const solveQuadratic_ = function (a, b, c) {
4444
const soln1 = (-b + Math.sqrt((b * b) - (4 * a * c))) / 2 / a;
@@ -54,10 +54,10 @@ const solveQuadratic_ = function (a, b, c) {
5454
* @param {!number} options.radiusY minor radius of ellipse
5555
* @param {!number} options.shearSlope slope of the sheared x axis
5656
* @param {?boolean} options.isFilled true if isFilled
57-
* @param {?function} options.drawFn The function called on each point in the outline, used only
57+
* @param {?Function} options.drawFn The function called on each point in the outline, used only
5858
* if isFilled is false.
5959
* @param {!CanvasRenderingContext2D} context for drawing
60-
* @return {boolean} true if anything was drawn, false if not
60+
* @returns {boolean} true if anything was drawn, false if not
6161
*/
6262
const drawShearedEllipse_ = function (options, context) {
6363
const centerX = ~~options.centerX;
@@ -83,8 +83,8 @@ const drawShearedEllipse_ = function (options, context) {
8383
/**
8484
* Vertical stepping portion of ellipse drawing algorithm
8585
* @param {!number} startY y to start drawing from
86-
* @param {!function} conditionFn function which should become true when we should stop stepping
87-
* @return {object} last point drawn to the canvas, or null if no points drawn
86+
* @param {!Function} conditionFn function which should become true when we should stop stepping
87+
* @returns {object} last point drawn to the canvas, or null if no points drawn
8888
*/
8989
const drawEllipseStepVertical_ = function (startY, conditionFn) {
9090
// Points on the ellipse
@@ -114,8 +114,8 @@ const drawShearedEllipse_ = function (options, context) {
114114
/**
115115
* Horizontal stepping portion of ellipse drawing algorithm
116116
* @param {!number} startX x to start drawing from
117-
* @param {!function} conditionFn function which should become false when we should stop stepping
118-
* @return {object} last point drawn to the canvas, or null if no points drawn
117+
* @param {!Function} conditionFn function which should become false when we should stop stepping
118+
* @returns {object} last point drawn to the canvas, or null if no points drawn
119119
*/
120120
const drawEllipseStepHorizontal_ = function (startX, conditionFn) {
121121
// Points on the ellipse
@@ -198,7 +198,7 @@ const drawShearedEllipse_ = function (options, context) {
198198
* @param {!number} size The diameter of the brush
199199
* @param {!string} color The css color of the brush
200200
* @param {?boolean} isEraser True if we want the brush mark for the eraser
201-
* @return {HTMLCanvasElement} a canvas with the brush mark printed on it
201+
* @returns {HTMLCanvasElement} a canvas with the brush mark printed on it
202202
*/
203203
const getBrushMark = function (size, color, isEraser) {
204204
size = ~~size;
@@ -251,7 +251,6 @@ const getBrushMark = function (size, color, isEraser) {
251251
* Draw an ellipse, given the original axis-aligned radii and
252252
* an affine transformation. Returns false if the ellipse could
253253
* not be drawn; for instance, the matrix is non-invertible.
254-
*
255254
* @param {!options} options Parameters for the ellipse
256255
* @param {!paper.Point} options.position Center of ellipse
257256
* @param {!number} options.radiusX x-aligned radius of ellipse
@@ -260,7 +259,7 @@ const getBrushMark = function (size, color, isEraser) {
260259
* @param {?boolean} options.isFilled true if isFilled
261260
* @param {?number} options.thickness Thickness of outline, used only if isFilled is false.
262261
* @param {!CanvasRenderingContext2D} context for drawing
263-
* @return {boolean} true if anything was drawn, false if not
262+
* @returns {boolean} true if anything was drawn, false if not
264263
*/
265264
const drawEllipse = function (options, context) {
266265
const positionX = options.position.x;
@@ -508,7 +507,6 @@ const colorPixel_ = function (x, y, imageData, newColor) {
508507
/**
509508
* Flood fill beginning at the given point.
510509
* Based on http://www.williammalone.com/articles/html5-canvas-javascript-paint-bucket-tool/
511-
*
512510
* @param {!int} x The x coordinate on the context at which to begin
513511
* @param {!int} y The y coordinate on the context at which to begin
514512
* @param {!ImageData} sourceImageData The image data to sample from. This is edited by the function.
@@ -555,7 +553,7 @@ const floodFillInternal_ = function (x, y, sourceImageData, destImageData, newCo
555553
/**
556554
* Given a fill style string, get the color
557555
* @param {string} fillStyleString the fill style
558-
* @return {Array<int>} Color, a length 4 array
556+
* @returns {Array<int>} Color, a length 4 array
559557
*/
560558
const fillStyleToColor_ = function (fillStyleString) {
561559
const tmpCanvas = document.createElement('canvas');
@@ -575,7 +573,7 @@ const fillStyleToColor_ = function (fillStyleString) {
575573
* @param {!HTMLCanvas2DContext} sourceContext The context from which to sample to determine where to flood fill
576574
* @param {!HTMLCanvas2DContext} destContext The context to which to draw. May match sourceContext. Should match
577575
* the size of sourceContext.
578-
* @return {boolean} True if image changed, false otherwise
576+
* @returns {boolean} True if image changed, false otherwise
579577
*/
580578
const floodFill = function (x, y, color, sourceContext, destContext) {
581579
x = ~~x;
@@ -609,7 +607,7 @@ const floodFill = function (x, y, color, sourceContext, destContext) {
609607
* @param {!string} color A color string, which would go into context.fillStyle
610608
* @param {!HTMLCanvas2DContext} sourceContext The context from which to sample to determine where to flood fill
611609
* @param {!HTMLCanvas2DContext} destContext The context to which to draw. May match sourceContext. Should match
612-
* @return {boolean} True if image changed, false otherwise
610+
* @returns {boolean} True if image changed, false otherwise
613611
*/
614612
const floodFillAll = function (x, y, color, sourceContext, destContext) {
615613
x = ~~x;
@@ -887,7 +885,7 @@ const _paperColorToCanvasStyle = function (color, context) {
887885
/**
888886
* @param {paper.Shape.Ellipse} oval Vector oval to convert
889887
* @param {paper.Raster} bitmap raster to draw selection
890-
* @return {bool} true if the oval was drawn
888+
* @returns {bool} true if the oval was drawn
891889
*/
892890
const commitOvalToBitmap = function (oval, bitmap) {
893891
const radiusX = Math.abs(oval.size.width / 2);

src/helper/blob-tools/broad-brush-helper.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import log from '../../log/log';
1010
* Broad brush draws strokes by drawing points equidistant from the mouse event, perpendicular to the
1111
* direction of motion. Shortcomings are that this path can cross itself, and 180 degree turns result
1212
* in a flat edge.
13-
*
1413
* @param {!Tool} tool paper.js mouse object
1514
*/
1615
class BroadBrushHelper {
@@ -180,7 +179,7 @@ class BroadBrushHelper {
180179
* Like paper.Path.unite, but it removes the original 2 paths
181180
* @param {paper.Path} path1 to merge
182181
* @param {paper.Path} path2 to merge
183-
* @return {paper.Path} merged path. Original paths 1 and 2 will be removed from the view.
182+
* @returns {paper.Path} merged path. Original paths 1 and 2 will be removed from the view.
184183
*/
185184
union (path1, path2) {
186185
const temp = path1.unite(path2);

0 commit comments

Comments
 (0)