Skip to content

Commit

Permalink
👕: config linters similarly, related updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KylePDavis committed Jun 20, 2015
1 parent 57d3950 commit 8ff23cd
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 105 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
// Stylistic Issues
"brace-style": [2, "1tbs"],
"camelcase": [2, {"properties": "always"}],
"no-underscore-dangle": 0,

// ECMAScript 6
//
Expand Down
8 changes: 5 additions & 3 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
// disallowSpacesInNamedFunctionExpression
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideBrackets": true,
"disallowSpacesInsideObjectBrackets": true,
// disallowSpacesInsideObjectBrackets
"disallowSpacesInsideParentheses": true,
// disallowTrailingComma
"disallowTrailingWhitespace": true,
Expand Down Expand Up @@ -100,7 +100,7 @@
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
// requireSpaceBeforeBlockStatements
// requireSpaceBeforeKeywords
// requireSpaceBeforeObjectValues
"requireSpaceBeforeObjectValues": true,
// requireSpaceBeforePostfixUnaryOperators
// requireSpaceBetweenArguments
// requireSpacesInAnonymousFunctionExpression
Expand All @@ -120,7 +120,9 @@
// requireSpacesInNamedFunctionExpression
// requireSpacesInsideArrayBrackets
// requireSpacesInsideBrackets
// requireSpacesInsideObjectBrackets
"requireSpacesInsideObjectBrackets": {
"allExcept": [")"]
},
// requireSpacesInsideParentheses
"requireTrailingComma": {
"ignoreSingleLine": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"main": "src/app/main.js",
"scripts": {
"postinstall": "bower install",
"test": "jshint src/ && jscs src/app/ src/web/{*.js,components,pages}",
"test": "eslint src/ && jshint src/ && jscs src/app/ src/web/{*.js,components,pages}",
"start": "electron ."
},
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/app/AppMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ module.exports = class AppMenu extends EventEmitter {
/**
* Get copy of template and replace click strings with click handler functions that emit event
* @method _getTemplateWithClickHandlers
* @param {Object} tmpl The menu template Object
* @private
* @return {Object} The results of the menu template Object with click handler functions
*/
_getTemplateWithClickHandlers(tmpl) {
let self = this;
return JSON.parse(JSON.stringify(tmpl), (k, v) => {
if (k === "click" && typeof v === "string")
if (k === "click" && typeof v === "string") {
return () => self.emit(v);
}
return v;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/AppWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = class AppWindow extends EventEmitter {
constructor(pkg) {
super();
let mousePos = screen.getCursorScreenPoint(),
winSize = {w:800, h:600},
winSize = { w: 800, h: 600 },
winOpts = {
x: mousePos.x - (winSize.w / 2),
y: mousePos.y - (winSize.h / 2),
Expand Down
3 changes: 2 additions & 1 deletion src/app/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ module.exports = class Application {
this.windows = new Set();

app.on("window-all-closed", () => {
if (process.platform !== "darwin")
if (process.platform !== "darwin") {
app.quit();
}
});

this.openWindow();
Expand Down
86 changes: 43 additions & 43 deletions src/app/menus/darwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,59 @@ module.exports = function(pkg) {
{
label: `${pkg.productName}`,
submenu: [
{label:`About ${pkg.productName}`, selector:"orderFrontStandardAboutPanel:"},
//TODO: {label:"Restart and Install Update", click:"application:install-update", visible:false},
//TODO: {label:"Check for Update", click:"application:check-for-update", visible:false},
//TODO: {label:"Downloading Update", enabled:false, visible:false},
{type:"separator"},
//TODO: {label:"Preferences...", accelerator:"Cmd+,", click:"application:show-settings"},
{type:"separator"},
{label:"Services", submenu:[]},
{type:"separator"},
{label:`Hide ${pkg.productName}`, accelerator:"Cmd+H", selector:"hide:"},
{label:"Hide Others", accelerator:"Cmd+Shift+H", selector:"hideOtherApplications:"},
{label:"Show All", selector:"unhideAllApplications:"},
{type:"separator"},
{label:"Quit", accelerator:"Cmd+Q", click:"application:quit"},
{ label: `About ${pkg.productName}`, selector: "orderFrontStandardAboutPanel:" },
//TODO: { label: "Restart and Install Update", click: "application:install-update", visible: false },
//TODO: { label: "Check for Update", click: "application:check-for-update", visible: false },
//TODO: { label: "Downloading Update", enabled: false, visible: false },
{ type: "separator" },
//TODO: { label: "Preferences...", accelerator: "Cmd+,", click: "application:show-settings" },
{ type: "separator" },
{ label: "Services", submenu: [] },
{ type: "separator" },
{ label: `Hide ${pkg.productName}`, accelerator: "Cmd+H", selector: "hide:" },
{ label: "Hide Others", accelerator: "Cmd+Shift+H", selector: "hideOtherApplications:" },
{ label: "Show All", selector: "unhideAllApplications:" },
{ type: "separator" },
{ label: "Quit", accelerator: "Cmd+Q", click: "application:quit" },
],
},

{
label: "File",
submenu: [
{label:"New Window", accelerator:"Cmd+Shift+N", click:"file:new-window"},
//{label:"New", accelerator:"Cmd+N", click:"file:new"},
{label:"Close", accelerator:"Cmd+W", selector:"performClose:"},
{ label: "New Window", accelerator: "Cmd+Shift+N", click: "file:new-window" },
// { label: "New", accelerator: "Cmd+N", click: "file:new" },
{ label: "Close", accelerator: "Cmd+W", selector: "performClose:" },
],
},

{
label: "Edit",
submenu: [
{label:"Undo", accelerator:"Cmd+Z", selector:"undo:"},
{label:"Redo", accelerator:"Shift+Cmd+Z", selector:"redo:"},
{type:"separator"},
{label:"Cut", accelerator:"Cmd+X", selector:"cut:"},
{label:"Copy", accelerator:"Cmd+C", selector:"copy:"},
{label:"Paste", accelerator:"Cmd+V", selector:"paste:"},
{label:"Select All", accelerator:"Cmd+A", selector:"selectAll:"},
{ label: "Undo", accelerator: "Cmd+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+Cmd+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "Cmd+X", selector: "cut:" },
{ label: "Copy", accelerator: "Cmd+C", selector: "copy:" },
{ label: "Paste", accelerator: "Cmd+V", selector: "paste:" },
{ label: "Select All", accelerator: "Cmd+A", selector: "selectAll:" },
],
},

{
label: "View",
submenu: [
{label:"Server", accelerator:"Cmd+1", click:"view:server"},
{label:"Database", accelerator:"Cmd+2", click:"view:database"},
{label:"Collection", accelerator:"Cmd+3", click:"view:collection"},
{type:"separator"},
{label:"Reload", accelerator:"Command+R", click:"window:reload"},
{label:"Toggle Full Screen", accelerator:"Cmd+Ctrl+F", click:"window:toggle-full-screen"},
{ label: "Server", accelerator: "Cmd+1", click: "view:server" },
{ label: "Database", accelerator: "Cmd+2", click: "view:database" },
{ label: "Collection", accelerator: "Cmd+3", click: "view:collection" },
{ type: "separator" },
{ label: "Reload", accelerator: "Command+R", click: "window:reload" },
{ label: "Toggle Full Screen", accelerator: "Cmd+Ctrl+F", click: "window:toggle-full-screen" },
{
label: "Developer",
submenu: [
//TODO: {label:"Run Tests...", accelerator:"Alt+Cmd+T", click:"application:run-specs"},
{label:"Toggle DevTools", accelerator:"Alt+Cmd+I", click:"window:toggle-dev-tools"},
//TODO: { label: "Run Tests...", accelerator: "Alt+Cmd+T", click: "application:run-specs" },
{ label: "Toggle DevTools", accelerator: "Alt+Cmd+I", click: "window:toggle-dev-tools" },
],
},
],
Expand All @@ -68,23 +68,23 @@ module.exports = function(pkg) {
{
label: "Window",
submenu: [
{label:"Minimize", accelerator:"Cmd+M", selector:"performMiniaturize:"},
{label:"Zoom", selector:"performZoom:"},
{type:"separator"},
//TODO: {label:"Show Previous Tab", accelerator:"Shift+Cmd+[", click:"window:show-previous-tab"},
//TODO: {label:"Show Next Tab", accelerator:"Shift+Cmd+]", click:"window:show-next-tab"},
//TODO: {label:"Show Previous Lower Tab", accelerator:"Cmd+[", click:"window:show-previous-lower-tab"},
//TODO: {label:"Show Next Lower Tab", accelerator:"Cmd+]", click:"window:show-next-lower-tab"},
{type:"separator"},
{label:"Bring All to Front", selector:"arrangeInFront:"},
{ label: "Minimize", accelerator: "Cmd+M", selector: "performMiniaturize:" },
{ label: "Zoom", selector: "performZoom:" },
{ type: "separator" },
//TODO: { label: "Show Previous Tab", accelerator: "Shift+Cmd+[", click: "window:show-previous-tab" },
//TODO: { label: "Show Next Tab", accelerator: "Shift+Cmd+]", click: "window:show-next-tab" },
//TODO: { label: "Show Previous Lower Tab", accelerator: "Cmd+[", click: "window:show-previous-lower-tab" },
//TODO: { label: "Show Next Lower Tab", accelerator: "Cmd+]", click: "window:show-next-lower-tab" },
{ type: "separator" },
{ label: "Bring All to Front", selector: "arrangeInFront:" },
],
},

{
label: "Help",
submenu: [
{label:"Web Site", click:"application:website"},
{label:"Report Issue", click:"application:report-issue"},
{ label: "Web Site", click: "application:website" },
{ label: "Report Issue", click: "application:report-issue" },
],
},

Expand Down
28 changes: 14 additions & 14 deletions src/app/menus/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ module.exports = function(pkg) {
{
label: "&File",
submenu: [
{label:"&Preferences", click:"application:show-settings"},
{label:"Quit", accelerator:"Ctrl+Q", click:"application:quit"},
{ label: "&Preferences", click: "application:show-settings" },
{ label: "Quit", accelerator: "Ctrl+Q", click: "application:quit" },
],
},

{
label: "&Edit",
submenu: [
{label:"&Undo", accelerator:"Ctrl+Z", click:"core:undo"},
{label:"&Redo", accelerator:"Ctrl+Y", click:"core:redo"},
{type:"separator"},
{label:"&Cut", accelerator:"Ctrl+X", click:"core:cut"},
{label:"C&opy", accelerator:"Ctrl+C", click:"core:copy"},
{label:"&Paste", accelerator:"Ctrl+V", click:"core:paste"},
{label:"Select &All", accelerator:"Ctrl+A", click:"core:select-all"},
{ label: "&Undo", accelerator: "Ctrl+Z", click: "core:undo" },
{ label: "&Redo", accelerator: "Ctrl+Y", click: "core:redo" },
{ type: "separator" },
{ label: "&Cut", accelerator: "Ctrl+X", click: "core:cut" },
{ label: "C&opy", accelerator: "Ctrl+C", click: "core:copy" },
{ label: "&Paste", accelerator: "Ctrl+V", click: "core:paste" },
{ label: "Select &All", accelerator: "Ctrl+A", click: "core:select-all" },
],
},

{
label: "&View",
submenu: [
{label:"&Reload", accelerator:"Ctrl+R", click:"window:reload"},
{label:"Toggle &Full Screen", accelerator:"Ctrl+Shift+F", click:"window:toggle-full-screen"},
{ label: "&Reload", accelerator: "Ctrl+R", click: "window:reload" },
{ label: "Toggle &Full Screen", accelerator: "Ctrl+Shift+F", click: "window:toggle-full-screen" },
{
label: "Developer",
submenu: [
//TODO: {label:"Run Tests...", accelerator:"Ctrl+Shift+T", click:"application:run-specs"},
{label:"Toggle Developer &Tools", accelerator:"Ctrl+Shift+I", click:"window:toggle-dev-tools"},
//TODO: { label: "Run Tests...", accelerator: "Ctrl+Shift+T", click: "application:run-specs" },
{ label: "Toggle Developer &Tools", accelerator: "Ctrl+Shift+I", click: "window:toggle-dev-tools" },
],
},
],
Expand All @@ -43,7 +43,7 @@ module.exports = function(pkg) {
{
label: "&Help",
submenu: [
{label:`About ${pkg.productName}`, click:"application:about"},
{ label: `About ${pkg.productName}`, click: "application:about" },
],
},

Expand Down
30 changes: 15 additions & 15 deletions src/app/menus/win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ module.exports = function(pkg) {
{
label: "&File",
submenu: [
{label:"&Options", click:"application:show-settings"},
{type:"separator"},
{label:"E&xit", accelerator:"Alt+F4", click:"application:quit"},
{ label: "&Options", click: "application:show-settings" },
{ type: "separator" },
{ label: "E&xit", accelerator: "Alt+F4", click: "application:quit" },
],
},

{
label: "&Edit",
submenu: [
{label:"&Undo", accelerator:"Ctrl+Z", click:"core:undo"},
{label:"&Redo", accelerator:"Ctrl+Y", click:"core:redo"},
{type:"separator"},
{label:"&Cut", accelerator:"Ctrl+X", click:"core:cut"},
{label:"C&opy", accelerator:"Ctrl+C", click:"core:copy"},
{label:"&Paste", accelerator:"Ctrl+V", click:"core:paste"},
{label:"Select &All", accelerator:"Ctrl+A", click:"core:select-all"},
{ label: "&Undo", accelerator: "Ctrl+Z", click: "core:undo" },
{ label: "&Redo", accelerator: "Ctrl+Y", click: "core:redo" },
{ type: "separator" },
{ label: "&Cut", accelerator: "Ctrl+X", click: "core:cut" },
{ label: "C&opy", accelerator: "Ctrl+C", click: "core:copy" },
{ label: "&Paste", accelerator: "Ctrl+V", click: "core:paste" },
{ label: "Select &All", accelerator: "Ctrl+A", click: "core:select-all" },
],
},

{
label: "&View",
submenu: [
{label:"&Reload", accelerator:"Ctrl+R", click:"window:reload"},
{label:"Toggle &Full Screen", accelerator:"Ctrl+Shift+F", click:"window:toggle-full-screen"},
{ label: "&Reload", accelerator: "Ctrl+R", click: "window:reload" },
{ label: "Toggle &Full Screen", accelerator: "Ctrl+Shift+F", click: "window:toggle-full-screen" },
{
label: "Developer",
submenu: [
//TODO: {label:"Run Tests...", accelerator:"Ctrl+Shift+T", click:"application:run-specs"},
{label:"Toggle Developer &Tools", accelerator:"Ctrl+Shift+I", click:"window:toggle-dev-tools"},
//TODO: { label: "Run Tests...", accelerator: "Ctrl+Shift+T", click: "application:run-specs" },
{ label: "Toggle Developer &Tools", accelerator: "Ctrl+Shift+I", click: "window:toggle-dev-tools" },
],
},
],
Expand All @@ -44,7 +44,7 @@ module.exports = function(pkg) {
{
label: "&Help",
submenu: [
{label:`About ${pkg.productName}`, click:"application:about"},
{ label: `About ${pkg.productName}`, click: "application:about" },
],
},

Expand Down
2 changes: 1 addition & 1 deletion src/web/components/data/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ angular.module("mw.components.data.json", [
//TODO: `JSON.parse` support (the below `parse` is good but probably unreasonably heavy in some scenarios)

Number.prototype.toJSON = function toJSON() { //eslint-disable-line no-extend-native
return isNaN(this) ? {$nan: 1} : this;
return isNaN(this) ? { $nan: 1 } : this;
};
parsersByKeys.$nan = Number.parseJSON = function parseJSON(obj) {
return obj.$nan ? NaN : obj;
Expand Down
4 changes: 2 additions & 2 deletions src/web/components/data/mongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ angular.module("mw.components.data.mongo", [
},


update: function update(dbUrl, collectionName, selector, update, options) {
update: function update(dbUrl, collectionName, selector, updates, options) {
return $q(function(resolve, reject) {
if (typeof dbUrl !== "string") dbUrl = MongoSvc.getDbUrl(dbUrl);
if (!collectionName) return reject(new Error("required `collectionName`"));
Expand All @@ -206,7 +206,7 @@ angular.module("mw.components.data.mongo", [
mongodb.MongoClient.connect(dbUrl, function(err, db) {
if (err) return reject(err);
var collection = db.collection(collectionName);
collection.update(selector, update, options, function(err2, results) {
collection.update(selector, updates, options, function(err2, results) {
if (err2) return reject(err2);
return resolve({
result: results.result,
Expand Down
15 changes: 4 additions & 11 deletions src/web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ angular.module("mw", [
])


.controller("IndexCtrl",
["$scope",
function($scope) {


if (typeof global === "undefined") window.global = window;
.controller("IndexCtrl", function($scope) {


$scope.ctrl = {};
Expand All @@ -29,16 +24,15 @@ function($scope) {
database: {},
collection: {},
};
$scope.model = angular.extend({}, modelDefaults, $scope.model || {}, global.model || {});
global.model = $scope.model; // persist global app state between refreshes
$scope.model = angular.extend({}, modelDefaults, $scope.model || {});


$scope.viewModel = {
tabs: {},
};


$scope.$watch("model.tabName", function(tabName, oldTabName) {
$scope.$watch("model.tabName", function(tabName) {
if (!tabName) return;
var tabs = {};
tabs[tabName] = true;
Expand Down Expand Up @@ -66,5 +60,4 @@ function($scope) {
}
});

},
]);
});
Loading

0 comments on commit 8ff23cd

Please sign in to comment.