Skip to content

Commit

Permalink
Add JSDoc validation in JSCS. Few style/doc fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kangax committed Jul 16, 2014
1 parent 404c1af commit 69fdc22
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
8 changes: 7 additions & 1 deletion .jscs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@
"validateQuoteMarks": "'",
"validateIndentation": 2,

"safeContextKeyword": "_this"
"safeContextKeyword": "_this",

"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
}
}
2 changes: 1 addition & 1 deletion src/mixins/object_interactivity.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
}
w *= this.scaleX;
h *= this.scaleY;

var wh = fabric.util.transformPoint(new fabric.Point(w, h), vpt, true),
width = wh.x,
height = wh.y,
Expand Down
6 changes: 3 additions & 3 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@

return styles;
}

/**
* @private
*/
Expand Down Expand Up @@ -433,9 +433,9 @@
return function(doc, callback, reviver) {
if (!doc) return;
var startTime = new Date();

parseUseDirectives(doc);

var descendants = fabric.util.toArray(doc.getElementsByTagName('*'));

if (descendants.length === 0 && fabric.isLikelyNode) {
Expand Down
2 changes: 1 addition & 1 deletion src/static_canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@
*/
_draw: function (ctx, object) {
if (!object) return;

ctx.save();
var v = this.viewportTransform;
ctx.transform(v[0], v[1], v[2], v[3], v[4], v[5]);
Expand Down
14 changes: 7 additions & 7 deletions src/util/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
* Rotates `point` around `origin` with `radians`
* @static
* @memberOf fabric.util
* @param {fabric.Point} The point to rotate
* @param {fabric.Point} The origin of the rotation
* @param {Number} The radians of the angle for the rotation
* @param {fabric.Point} point The point to rotate
* @param {fabric.Point} origin The origin of the rotation
* @param {Number} radians The radians of the angle for the rotation
* @return {fabric.Point} The new rotated point
*/
rotatePoint: function(point, origin, radians) {
Expand Down Expand Up @@ -102,19 +102,19 @@
t[2] * p.x + t[3] * p.y + t[5]
);
},

/**
* Invert transformation t
* @static
* @memberOf fabric.util
* @param {Array} t The transform
* @param {Array} t The transform
* @return {Array} The inverted transform
*/
invertTransform: function(t) {
var r = t.slice(),
a = 1 / (t[0] * t[3] - t[1] * t[2]);
r = [a * t[3], -a * t[1], -a * t[2], a * t[0], 0, 0];
var o = fabric.util.transformPoint({x: t[4], y: t[5]}, r);
var o = fabric.util.transformPoint({ x: t[4], y: t[5] }, r);
r[4] = -o.x;
r[5] = -o.y;
return r;
Expand Down Expand Up @@ -223,7 +223,7 @@
* @memberOf fabric.util
* @param {Array} objects Objects to enliven
* @param {Function} callback Callback to invoke when all objects are created
* @param {Function} [reviver] Method for further parsing of object elements,
* @param {Function} Method for further parsing of object elements,
* called after each fabric object created.
*/
enlivenObjects: function(objects, callback, namespace, reviver) {
Expand Down

0 comments on commit 69fdc22

Please sign in to comment.