Skip to content

Commit

Permalink
Fix some eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxa committed Feb 17, 2019
1 parent 2d74661 commit 77e5e76
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 35 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ lib/alertify.js
lib/dominate.js
views/cache.js
ts.js
lib/sql_splitter.js

public/**/*
tests/**/*
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = {
"hljs": true
},
"rules": {
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false }],
"no-console": "off",
"accessor-pairs": "error",
"array-bracket-newline": "off",
Expand Down
3 changes: 3 additions & 0 deletions app/login_components/login_postgres_url_form.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @ts-ignore
var url = require('url');

class LoginPostgresUrlForm {
/*::
loginForm: LoginScreen
Expand Down
3 changes: 0 additions & 3 deletions app/login_screen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// @ts-ignore
const url = require('url');

class LoginScreen {

/*::
Expand Down
2 changes: 1 addition & 1 deletion app/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Index extends ModelBase {
}

columns () {
var str = this.pg_get_indexdef.match(/ON [^\(]+\((.+)\)/)[1];
var str = this.pg_get_indexdef.match(/ON [^(]+\((.+)\)/)[1];
return str.split(/,\s+/).map(col => { return col.replace(/^"(.+)"$/, '$1'); });
}
}
Expand Down
4 changes: 1 addition & 3 deletions app/top_menu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var remote = require('electron').remote;
var Menu = remote.Menu;
var MenuItem = remote.MenuItem;
var webFrame = require('electron').webFrame;

var UpdatesController = require('./controllers/updates_controller');
var ExportController = require('./controllers/export_controller');
Expand Down Expand Up @@ -224,7 +222,7 @@ if (process.platform == 'darwin') {
{
label: "Check For Updates...",
click: () => {
(new global.UpdatesController).checkUpdates({showLoading: true, showAlreadyLatest: true});
(new UpdatesController).checkUpdates({showLoading: true, showAlreadyLatest: true});
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/view_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ var helpers = global.ViewHelpers = {
},

icon: function(name, title, height = 20, width = 20) {
title = title === undefined ? name.replace(/[\-_]/g, ' ') : title;
title = title === undefined ? name.replace(/[-_]/g, ' ') : title;
return `<img src="./public/icons/${name}.png" width="${width}" height="${height}" class="app-icon" title="${title}"/>`;
},

Expand Down
2 changes: 1 addition & 1 deletion app/views/dialogs/new_column.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class NewColumn extends Dialog {
}

groupTypes (types) {
var types = types.slice(0);
types = types.slice(0);
var grouped = {};
var groupName;

Expand Down
2 changes: 1 addition & 1 deletion app/views/dialogs/new_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class NewTable extends Dialog {

async onSubmit (data) {
try {
var data = await this.handler.createTable(data);
data = await this.handler.createTable(data);
this.defaultServerResponse(data);
} catch (error) {
this.defaultServerResponse(null, error);
Expand Down
8 changes: 4 additions & 4 deletions app/views/panes/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ var filterMatchers = (() => {
return type == 'integer';
};

var isString = (type) => {
return type.match(/^character varying.*/);
};
//var isString = (type) => {
// return type.match(/^character varying.*/);
//};

var basicValidation = (type, v) => {
if (v === '') return "Value is required";
Expand Down Expand Up @@ -490,7 +490,7 @@ class Content extends Pane {
async viewForeign (schema, table, column, value) {
var foreign = await this.handler.loadForeignRows(schema, table, column, value);

var dialog = new Dialog.RelatedRecords(this.handler, foreign, {
new Dialog.RelatedRecords(this.handler, foreign, {
schema: schema,
table: table,
column: column,
Expand Down
9 changes: 6 additions & 3 deletions app/views/panes/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ class Extensions extends Pane {
renderTab (rows) {
var scrollOffset = [0, 0];
var selecredRow = null;

// save selected row and scroll possition
if (this.content && this.handler.currentTab == 'extensions') {
var table = this.content.find('.rescol-content-wrapper')[0];
scrollOffset = table ? [table.scrollTop, table.scrollLeft] : [0, 0];
var selectedCells = $u(table).find('tr.selected td');
var oldTable = this.content.find('.rescol-content-wrapper')[0];
scrollOffset = oldTable ? [oldTable.scrollTop, oldTable.scrollLeft] : [0, 0];
var selectedCells = $u(oldTable).find('tr.selected td');
selecredRow = selectedCells.length && selectedCells[0].innerHTML;
}

this.renderViewToPane('extensions', 'extensions_tab', {rows: rows});

// restore selected row and scroll position
if (scrollOffset[0] != 0 && scrollOffset[1] != 0) {
var table = this.content.find('.rescol-content-wrapper table');
if (table[0]) {
Expand Down
6 changes: 3 additions & 3 deletions app/views/panes/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Procedures extends Pane {
}
}

async editProc (poid, procName) {
async editProc (poid) {
var proc = await Model.Procedure.find(poid);

var dialog = new Dialog.EditProcedure(this.handler, proc, async (updated) => {
Expand All @@ -42,7 +42,7 @@ class Procedures extends Pane {
return Model.Procedure.update(poid, newSource);
}

async removeProc (poid, procName) {
async removeProc (poid) {
var proc = await Model.Procedure.find(poid);

if (await $u.confirm(`Delete procedure ${proc.name}(${proc.arg_list})?`)) {
Expand All @@ -53,7 +53,7 @@ class Procedures extends Pane {
}
}

async procDefinition (poid, name) {
async procDefinition (poid) {
var proc = await Model.Procedure.find(poid);
var data = await proc.getDefinition();
new Dialog.DefProcedure(this.handler, proc, data.source);
Expand Down
2 changes: 1 addition & 1 deletion app/views/panes/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var csvGenerate = require('csv-stringify');

class Query extends Pane {

renderTab (rows) {
renderTab () {
if (this.content) return;

this.renderViewToPane('query', 'query_tab');
Expand Down
3 changes: 1 addition & 2 deletions build_package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const builder = require("electron-builder")
const Platform = builder.Platform
const builder = require("electron-builder");

var packageJson = require('./package.json');
var childProcess = require('child_process');
Expand Down
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ global.$dom = function(tags) { return global.DOMinate(tags)[0]; };

require('./app/utils');

// eslint-disable-next-line
function reloadCss() {
var queryString = '?reload=' + new Date().getTime();
global.$u('link[rel="stylesheet"]').each(function () {
Expand All @@ -97,19 +98,19 @@ electron.ipcRenderer.on('open-url', function(event, url) {
});
});

$(window).on('window-ready', (event) => {
$(window).on('window-ready', () => {
electron.ipcRenderer.send('main-window-ready', {});
});

require('./app/top_menu');

var arguments = electron.remote.process.argv;
if (arguments.length > 2) {
var connectionStr = arguments[2];
var cliArgs = electron.remote.process.argv;
if (cliArgs.length > 2) {
var connectionStr = cliArgs[2];
if (connectionStr.startsWith("postgres://")) {
App.cliConnectString = connectionStr;
} else {
window.alert(`Can't recognize argument ${arguments[2]}\nExpected postgres://user@server/dbname`);
window.alert(`Can't recognize argument ${cliArgs[2]}\nExpected postgres://user@server/dbname`);
}
}

Expand Down Expand Up @@ -147,7 +148,7 @@ $(document).ready(function() {

setTimeout(function () {
console.log("Checking updates info");
(new global.UpdatesController).checkUpdates();
(new UpdatesController).checkUpdates();
}, 10000);

/*
Expand Down
8 changes: 4 additions & 4 deletions lib/cli_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var CliUtil = {
checkFiles(url, workingDir, callback) {
var joinedPath = path.join(workingDir, url.replace('postgres://', ''));
console.log("ckecking if exist", joinedPath);
fs.access(joinedPath, 'r', (err, fd) => {
fs.access(joinedPath, 'r', (err) => {
if (err) {
console.log(joinedPath, 'not exists');
callback(url);
Expand All @@ -39,7 +39,7 @@ var CliUtil = {
tryFindConfig(folder, callback) {
var file = path.join(folder, '.postbird');
console.log("ckecking if exist", file);
fs.access(file, 'r', (err, fd) => {
fs.access(file, 'r', (err) => {
if (err) {
callback(false);
} else {
Expand All @@ -53,10 +53,10 @@ var CliUtil = {
if (err) throw err;
var fileData = data.toString().trim();
if (fileData[0] == "{") {
var data = JSON.parse(fileData);
data = JSON.parse(fileData);
callback(data.default);
} else {
var data = require(path);
data = require(path);
callback(data.default);
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib/error_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var errorReporter = module.exports = function errorReporter(exception, showError

if (process.platform == "darwin") {
var exec = child_process.exec;
exec('sw_vers -productVersion', function (err, stdout, stderr) {
exec('sw_vers -productVersion', function (err, stdout) {
extra.system = stdout;
sender();
});
Expand Down
2 changes: 1 addition & 1 deletion lib/query_tab_resizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QueryTabResizer {
});
}

waitingForMouseUp (doc) {
waitingForMouseUp () {
this.doc.one('mouseup touchend', (e) => {
e.preventDefault();
this.following = false;
Expand Down

0 comments on commit 77e5e76

Please sign in to comment.