Skip to content
Permalink
Browse files

Add eslint and fix lint errors

  • Loading branch information...
philipwalton committed Jun 10, 2016
1 parent 5f84a64 commit fdcf54e829e0f6e614a37cbe7ddfb22942ddfaa5
Showing with 48 additions and 5 deletions.
  1. +45 −0 polyfill/.eslintrc
  2. +3 −5 polyfill/intersection-observer.js
@@ -0,0 +1,45 @@
{
"env": {
"browser": true,
"node": true,
"mocha": true
},
"globals": {
"expect": false,
"sinon": false
},
"extends": [
"eslint:recommended"
],
"rules": {
// possible errors
"no-cond-assign": 0,
"no-empty": 0,
"valid-jsdoc": [2, {
"prefer": {"return": "return"},
"requireReturn": false
}],
// best practices
"no-extra-bind": 2,
// style
"comma-spacing": [2, {"before": false, "after": true}],
"eol-last": [0],
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
"linebreak-style": [2, "unix"],
"max-len": [2, 80, {"ignoreUrls": true}],
"no-multiple-empty-lines": [2, {"max": 2}],
"no-unused-vars": ["error", {"vars": "all"}],
"no-trailing-spaces": 2,
"object-curly-spacing": [2, "never"],
"quotes": [2, "single"],
"require-jsdoc": [2, {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true
}
}],
"semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
}
}
@@ -45,7 +45,7 @@ function IntersectionObserverEntry(entry) {
var intersectionRect = this.intersectionRect;
var intersectionArea = intersectionRect.width * intersectionRect.height;
this.intersectionRatio = targetArea ? (intersectionArea / targetArea) : 0;
};
}


/**
@@ -85,7 +85,7 @@ function IntersectionObserver(callback, opt_options) {
this.rootMargin = this._rootMarginValues.map(function(margin) {
return margin.value + margin.unit;
}).join(' ');
};
}


/**
@@ -324,8 +324,6 @@ IntersectionObserver.prototype._checkForIntersections = function() {
};




/**
* Accepts a target and root rect computes the intersection between then
* following the algorithm in the spec.
@@ -607,7 +605,7 @@ function getBoundingClientRect(el) {
left: rect.left,
width: rect.right - rect.left,
height: rect.bottom - rect.top
}
};
}
return rect;
}

1 comment on commit fdcf54e

@funnyrule

This comment has been minimized.

Copy link

commented on fdcf54e Jul 25, 2019

nice

Please sign in to comment.
You can’t perform that action at this time.