diff --git a/polyfill/.eslintrc b/polyfill/.eslintrc new file mode 100644 index 0000000..3cac2ba --- /dev/null +++ b/polyfill/.eslintrc @@ -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}], + } +} \ No newline at end of file diff --git a/polyfill/intersection-observer.js b/polyfill/intersection-observer.js index 05a4dce..8fda866 100644 --- a/polyfill/intersection-observer.js +++ b/polyfill/intersection-observer.js @@ -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; }