diff --git a/.eslintrc.js b/.eslintrc.js index e39e5ba2..2951d0c6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,9 @@ module.exports = { "commonjs": true, "node": true }, + "globals": { + "Promise": true + }, "extends": "eslint:recommended", "rules": { "accessor-pairs": "error", @@ -67,7 +70,7 @@ module.exports = { "keyword-spacing": "off", "linebreak-style": [ "error", - "windows" + "unix" ], "lines-around-comment": "error", "max-depth": "off", @@ -134,6 +137,7 @@ module.exports = { "no-process-env": "error", "no-process-exit": "error", "no-proto": "error", + "no-redeclare": "off", "no-restricted-globals": "error", "no-restricted-imports": "error", "no-restricted-modules": "error", @@ -161,6 +165,12 @@ module.exports = { "no-unneeded-ternary": "error", "no-unsafe-finally": "error", "no-unused-expressions": "off", + "no-unused-vars": [ + "error", + { + "varsIgnorePattern": "module" + } + ], "no-use-before-define": "off", "no-useless-call": "error", "no-useless-computed-key": "error", diff --git a/.gitignore b/.gitignore index ff22e95c..e5eb442c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ coverage node_modules jsconfig.json .vscode +npm-debug.log diff --git a/api/throttle.js b/api/throttle.js index a1e18328..edc2e4bc 100644 --- a/api/throttle.js +++ b/api/throttle.js @@ -2,12 +2,11 @@ module.exports = function(callback) { //60fps translates to 16.6ms, round it down since setTimeout requires int - var time = 16 + var time = 16 var last = 0, pending = null var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout return function(synchronous) { var now = new Date().getTime() - var diff = now - last if (synchronous === true || last === 0 || now - last >= time) { last = now callback() diff --git a/module/module.js b/module/module.js index 44ee4764..661b65d0 100644 --- a/module/module.js +++ b/module/module.js @@ -8,7 +8,6 @@ require.$$current = function() { var pathnameEnd = searchIndex > -1 ? searchIndex : hashIndex > -1 ? hashIndex : href.length try {throw new Error} catch (e) {var error = e} var src = error.stack.match(/^(?:(?!^Error|\/module\/module\.js).)*$/m).toString().match(/((?:file|https|http):\/\/.+)(?::\d+){2}/)[1] || href.slice(0, pathnameEnd) - var base = href.slice(0, href.lastIndexOf("/", pathnameEnd) + 1) return src.replace(/\.js$/, "") } @@ -26,4 +25,4 @@ function require(name) { while (dotdot.test(absolute)) absolute = absolute.replace(dotdot, "") if (absolute in require.$$modules) return require.$$modules[absolute] else throw new Error("Module does not exist: " + absolute) -} \ No newline at end of file +} diff --git a/request/request.js b/request/request.js index d5b9aa01..54266d12 100644 --- a/request/request.js +++ b/request/request.js @@ -67,7 +67,7 @@ module.exports = function($window, Promise) { resolve(data) $window[callbackKey] = undefined } - script.onerror = function(e) { + script.onerror = function() { script.parentNode.removeChild(script) reject(new Error("JSONP request failed")) $window[callbackKey] = undefined @@ -111,4 +111,4 @@ module.exports = function($window, Promise) { function extract(xhr) {return xhr.responseText} return {ajax: ajax, jsonp: jsonp} -} \ No newline at end of file +}