From 84ecffa4d9d0965f46bdef8a074f44475d8d79a2 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Fri, 5 Apr 2019 13:07:43 +0530 Subject: [PATCH] Added recommended ESLinter checks. Fixes #4142 --- docs/en_US/release_notes_4_5.rst | 1 + web/.eslintrc.js | 5 +++++ .../databases/schemas/tables/columns/static/js/column.js | 1 - web/pgadmin/browser/static/js/browser.js | 1 - web/pgadmin/help/static/js/help.js | 2 +- web/pgadmin/static/js/pgadmin.js | 7 ++++++- 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/en_US/release_notes_4_5.rst b/docs/en_US/release_notes_4_5.rst index d6d9b1661..8d6a7531f 100644 --- a/docs/en_US/release_notes_4_5.rst +++ b/docs/en_US/release_notes_4_5.rst @@ -16,3 +16,4 @@ Bug fixes ********* | `Bug #4131 `_ - Relabel the Save button on the datagrid text editor to avoid confusion with the actual Save button that updates the database. +| `Bug #4142 `_ - Added recommended ESLinter checks. \ No newline at end of file diff --git a/web/.eslintrc.js b/web/.eslintrc.js index 03b8dcabb..a9d7437fd 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -14,6 +14,9 @@ module.exports = { 'amd': true, 'jasmine': true, }, + 'extends': [ + 'eslint:recommended', + ], 'parserOptions': { 'ecmaVersion': 2018, 'sourceType': 'module', @@ -43,5 +46,7 @@ module.exports = { 'always-multiline' ], 'no-console': ["error", { allow: ["warn", "error"] }], + // We need to exclude below for RegEx case + "no-useless-escape": 0, }, }; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js index 64ce44811..a5bd7804f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js @@ -240,7 +240,6 @@ define('pgadmin.node.column', [ return false; }, editable: function(m) { - var name = m.get('name'); // If HeaderCell then allow True if(m instanceof Backbone.Collection) { return true; diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index 8774277f5..3ba7a3180 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -1070,7 +1070,6 @@ define('pgadmin.browser', [ var loaded = this.t.wasLoad(parent), onLoad = function() { self.i = parent; - self.d = self.d; self.pathOfTreeItems.push({coll: false, item: parent, d: self.d}); self.success(); return; diff --git a/web/pgadmin/help/static/js/help.js b/web/pgadmin/help/static/js/help.js index 3e8f35de0..32257ab11 100644 --- a/web/pgadmin/help/static/js/help.js +++ b/web/pgadmin/help/static/js/help.js @@ -24,4 +24,4 @@ export function getHelpUrl(base_path, file, version) { } return url + file; -}; +} diff --git a/web/pgadmin/static/js/pgadmin.js b/web/pgadmin/static/js/pgadmin.js index 54c734c0e..d44bccf16 100644 --- a/web/pgadmin/static/js/pgadmin.js +++ b/web/pgadmin/static/js/pgadmin.js @@ -38,7 +38,12 @@ define([], function() { var o, n, i, l, d, c = /^top|bottom/, f = ['paddingTop', 'paddingBottom', 'borderTop', 'borderBottom'], u = 4; - if (o = m ? m(t)[e] : (n = t.style['pixel' + e.charAt(0).toUpperCase() + e.slice(1)]) ? n + 'px' : 'fontSize' === e ? r(t, '1em', 'left', 1) + 'px' : t.currentStyle[e], i = (o.match(s) || [])[2], '%' === i && p) + + n = t.style['pixel' + e.charAt(0).toUpperCase() + e.slice(1)]; + o = m ? m(t)[e] : (n) ? n + 'px' : 'fontSize' === e ? r(t, '1em', 'left', 1) + 'px' : t.currentStyle[e]; + i = (o.match(s) || [])[2]; + + if ('%' === i && p) if (c.test(e)) { for (l = (d = t.parentNode || t).offsetHeight; u--;) l -= parseFloat(a(d, f[u])); o = parseFloat(o) / 100 * l + 'px';