diff --git a/.eslintrc.json b/.eslintrc.json index ff58ea3..0bba253 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -79,7 +79,7 @@ "newline-per-chained-call": "error", "no-alert": "error", "no-array-constructor": "error", - "no-bitwise": "error", + "no-bitwise": "off", "no-caller": "error", "no-console": "off", "no-catch-shadow": "error", @@ -164,7 +164,7 @@ "no-unneeded-ternary": "error", "no-unsafe-finally": "error", "no-unused-expressions": "error", - "no-use-before-define": "error", + "no-use-before-define": "off", "no-useless-call": "error", "no-useless-computed-key": "error", "no-useless-concat": "off", @@ -173,7 +173,7 @@ "no-useless-rename": "error", "no-var": "off", "no-void": "error", - "no-warning-comments": "error", + "no-warning-comments": "off", "no-whitespace-before-property": "error", "no-with": "error", "object-curly-spacing": [ @@ -259,6 +259,9 @@ "marked": true, "jade": true, "loadJS": true, + "esprima": true, + "escodegen": true, + "utils": true, "Promise": true } -} \ No newline at end of file +} diff --git a/src/notifications.js b/src/notifications.js index 10eb002..e73d8ed 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -3,7 +3,7 @@ var noticationContainerEL = $('#js-alerts-container'); function addNotification(msg) { - var n = document.createElement('div'); + //var n = document.createElement('div'); // div.textContent = msg; // noticationContainerEL.appendChild(n); noticationContainerEL.textContent = msg; @@ -17,4 +17,4 @@ window.alertsService = { add: addNotification } -})(); \ No newline at end of file +})(); diff --git a/src/script.js b/src/script.js index 01f0171..e5196f1 100644 --- a/src/script.js +++ b/src/script.js @@ -1,5 +1,5 @@ /* eslint-disable no-extra-semi */ -;(function () { +;(function (alertsService) { /* eslint-enable no-extra-semi */ var editur = window.editur || {}; @@ -154,12 +154,8 @@ }); } - function populateItem(items) { - // currentItem = savedItems[]; - refreshEditor(); - } function populateItemsInSavedPane(items) { - if (!items || !items.length) return; + if (!items || !items.length) { return; } var html = ''; // TODO: sort desc. by updation date items.sort(function (a, b) { @@ -282,9 +278,11 @@ editur.cm.js.setOption('mode', modes[value].cmMode); CodeMirror.autoLoadMode(editur.cm.js, modes[value].cmMode); // FIXME: Will be saved as part of global settings - /*chrome.storage.sync.set({ + /* + chrome.storage.sync.set({ jsMode: value - }, function () {});*/ + }, function () {}); + */ } // computeHtml, computeCss & computeJs evaluate the final code according @@ -340,7 +338,7 @@ tolerant: true }); } catch(e) { - showErrors('js', [ { lineNumber: e.lineNumber-1, message: e.description } ]); + showErrors('js', [ { lineNumber: e.lineNumber - 1, message: e.description } ]); } finally { utils.addInfiniteLoopProtection(ast); d.resolve(escodegen.generate(ast)); @@ -364,7 +362,7 @@ tolerant: true }); } catch(e) { - showErrors('js', [ { lineNumber: e.lineNumber-1, message: e.description } ]); + showErrors('js', [ { lineNumber: e.lineNumber - 1, message: e.description } ]); } finally { utils.addInfiniteLoopProtection(ast); d.resolve(Babel.transform(escodegen.generate(ast), { presets: ['es2015'] }).code); @@ -639,9 +637,9 @@ }, function syncGetCallback(result) { if (result.preserveLastCode && lastCode) { if (lastCode.id) { - chrome.storage.local.get(lastCode.id, function (result) { + chrome.storage.local.get(lastCode.id, function (itemResult) { utils.log('Load item ', lastCode.id) - currentItem = result[lastCode.id]; + currentItem = itemResult[lastCode.id]; refreshEditor(); }); } else { @@ -671,4 +669,4 @@ init(); -})(); \ No newline at end of file +})(window.alertsService); diff --git a/src/utils.js b/src/utils.js index cdf4534..b6c7535 100644 --- a/src/utils.js +++ b/src/utils.js @@ -50,6 +50,7 @@ inside: ast2.body[0].body.body[0] } } + /** * Add timed limit on the loops found in the passed AST body * @param {ASTBody} Body of an AST generated by esprima or any ES compliant AST