Skip to content
This repository has been archived by the owner on Oct 13, 2018. It is now read-only.

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Jan 9, 2015
1 parent 4b6930b commit 2217c40
Show file tree
Hide file tree
Showing 22 changed files with 104 additions and 75 deletions.
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
charset = "utf8"


[*.css]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true


[*.js]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
quote_type = double


[*.json]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
33 changes: 33 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"laxbreak": false,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"plusplus": true,
"sub": true,
"undef": true,
"quotmark": "double",
"unused": true,
"indent": 4,
"eqnull": true,
"node": true,
"strict": false,
"mocha": true,
"jasmine": true,
"globals": {
"window": false,
"browser": false,
"sinon": false,
"___browserSync___": false,
"assert": false,
"by": false,
"element": false,
"protractor": false,
"assert": false,
"inject": false,
"angular": false
}
}
11 changes: 4 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ var gulp = require("gulp");
var jshint = require("gulp-jshint");
var contribs = require("gulp-contribs");
var sass = require("gulp-sass");
var fs = require("fs");
var autoprefix = require("gulp-autoprefixer");
var browserify = require("gulp-browserify");
var rename = require("gulp-rename");
var filter = require("gulp-filter");
var sprites = require("gulp-svg-sprites");
var browserSync = require("browser-sync");
var crossbow = require("crossbow/plugins/stream");
var reload = browserSync.reload;

/**
* Lint all JS files
Expand All @@ -24,10 +22,10 @@ gulp.task("lint", function () {
"server/*.js",
"gulpfile.js",
])
.pipe(require("no-abs")());
//.pipe(jshint("test/.jshintrc"))
//.pipe(jshint.reporter("default"))
//.pipe(jshint.reporter("fail"));
.pipe(require("no-abs")())
.pipe(jshint(".jshintrc"))
.pipe(jshint.reporter("default"))
.pipe(jshint.reporter("fail"));
});

/**
Expand Down Expand Up @@ -150,4 +148,3 @@ gulp.task("dev", ["browserify"], function () {
gulp.watch("lib/scss/**/*.scss", ["sass"]);
gulp.watch("lib/js/scripts/**/*.js", ["browserify"]);
});

6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";

var path = require("path");

var EE = require("easy-extender");

var async = require("./server/async");
Expand Down Expand Up @@ -48,7 +46,7 @@ var ControlPanel = function (opts, bs, emitter) {
ControlPanel.prototype.getServer = function (cb) {
var cp = this;
if (!cp.server) {
this.events.on("cp:running", function (out) {
this.events.on("cp:running", function () {
cb(null, cp.server);
});
}
Expand Down Expand Up @@ -110,7 +108,7 @@ ControlPanel.prototype.init = function () {
cp.logger.debug("{green:Step Complete: " + item.step);
cb();
});
}, function (err) {
}, function () {
cp.events.emit("cp:running", {instance: cp, options: cp.opts});
cp.logger.info("Running at: {cyan:http://localhost:%s", cp.opts.get("port"));
});
Expand Down
10 changes: 5 additions & 5 deletions lib/js/dist/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function MainCtrl ($$scope, $rootScope, $location, Socket, $injector) {
/**
* @param options
*/
connection: function (options, socket) {
connection: function (options) {

// TODO: Add socket tracking.
//if (socket) {
Expand All @@ -84,7 +84,7 @@ function MainCtrl ($$scope, $rootScope, $location, Socket, $injector) {
/**
*
*/
disconnect: function (data) {
disconnect: function () {
$scope.ui.disconnected = true;
}
};
Expand Down Expand Up @@ -226,7 +226,7 @@ module.directive("markable", function () {
return {
scope: {},
restrict: "A",
link: function (scope, elem, attrs) {
link: function () {
//var click = function (evt) {
// elem.toggleClass("active");
//};
Expand Down Expand Up @@ -257,14 +257,14 @@ module.exports = app;
* Custom Notify module for Global notifications
*
*/
angular.module('Disconnect', [])
angular.module("Disconnect", [])

.directive("disconnectElem", function () {

return {
restrict: "E",
scope: {},
template: '<section bs-Overlay ng-class="{\'active\': ui.visible}"><p><i bs-Icon="block" bs-Icon-Size="jumbo"></i></p><h1 bs-Weight="light">{{ui.heading}} {{ui.message}}</h1><p>Possible reasons are:</p><ul bs-List><li>1. Your process was exited by another tool</li></ul></section>',
template: '<section bs-Overlay ng-class="{\'active\': ui.visible}"><p><i bs-Icon="block" bs-Icon-Size="jumbo"></i></p><h1 bs-Weight="light">{{ui.heading}} {{ui.message}}</h1><p>Possible reasons are:</p><ul bs-List><li>1. Your process was exited by another tool</li></ul></section>', // jshint:ignore
controller: ["$scope", "$rootScope", "$window", disconnectController]
};
});
Expand Down
4 changes: 2 additions & 2 deletions lib/js/scripts/MainCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function MainCtrl ($$scope, $rootScope, $location, Socket, $injector) {
/**
* @param options
*/
connection: function (options, socket) {
connection: function (options) {

// TODO: Add socket tracking.
//if (socket) {
Expand All @@ -83,7 +83,7 @@ function MainCtrl ($$scope, $rootScope, $location, Socket, $injector) {
/**
*
*/
disconnect: function (data) {
disconnect: function () {
$scope.ui.disconnected = true;
}
};
Expand Down
2 changes: 1 addition & 1 deletion lib/js/scripts/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.directive("markable", function () {
return {
scope: {},
restrict: "A",
link: function (scope, elem, attrs) {
link: function () {
//var click = function (evt) {
// elem.toggleClass("active");
//};
Expand Down
4 changes: 2 additions & 2 deletions lib/js/scripts/modules/disconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* Custom Notify module for Global notifications
*
*/
angular.module('Disconnect', [])
angular.module("Disconnect", [])

.directive("disconnectElem", function () {

return {
restrict: "E",
scope: {},
template: '<section bs-Overlay ng-class="{\'active\': ui.visible}"><p><i bs-Icon="block" bs-Icon-Size="jumbo"></i></p><h1 bs-Weight="light">{{ui.heading}} {{ui.message}}</h1><p>Possible reasons are:</p><ul bs-List><li>1. Your process was exited by another tool</li></ul></section>',
template: '<section bs-Overlay ng-class="{\'active\': ui.visible}"><p><i bs-Icon="block" bs-Icon-Size="jumbo"></i></p><h1 bs-Weight="light">{{ui.heading}} {{ui.message}}</h1><p>Possible reasons are:</p><ul bs-List><li>1. Your process was exited by another tool</li></ul></section>', // jshint:ignore
controller: ["$scope", "$rootScope", "$window", disconnectController]
};
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@
},
"keywords": []
}

5 changes: 2 additions & 3 deletions server/hooks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var _ = require("lodash");
var fs = require("fs");
var path = require("path");
var tmpl = fs.readFileSync(__dirname + "/templates/plugin.tmpl", "utf-8");
Expand Down Expand Up @@ -40,7 +39,7 @@ module.exports = {
return configTmpl.replace("%when%", items)
.replace("%pages%", JSON.stringify(pagesConfig, null, 4));
},
"markup": function (hooks, initial) {
"markup": function (hooks) {
var out = hooks.reduce(function (combined, item) {
return [combined, tmpl.replace("%markup%", item)].join("\n");
}, "");
Expand All @@ -49,7 +48,7 @@ module.exports = {
"client:js": function (hooks) {
return hooks.join(";");
},
"templates": function (hooks, cb) {
"templates": function (hooks) {

var inlineTemplates = createInlineTemplates(hooks);
return inlineTemplates;
Expand Down
22 changes: 11 additions & 11 deletions server/opts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var Immutable = require("immutable");
var transforms = require("./transforms");
//var transforms = require("./transforms");

var defaults = Immutable.Map({
port: 3001
Expand All @@ -17,13 +17,13 @@ module.exports.merge = function (obj) {
* @param {Immutable.Map} obj
* @returns {*}
*/
function transformOptions(obj) {

var out;

Object.keys(transforms).forEach(function (key) {
out = obj.set(key, transforms[key](obj));
});

return out;
}
//function transformOptions(obj) {
//
// var out;
//
// Object.keys(transforms).forEach(function (key) {
// out = obj.set(key, transforms[key](obj));
// });
//
// return out;
//}
2 changes: 0 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var _ = require("lodash");
var connect = require("connect");
var through = require("through");
var path = require("path");
var http = require("http");
var fs = require("fs");
var serveStatic = require("serve-static");
Expand Down
1 change: 0 additions & 1 deletion server/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var path = require("path");
var url = require("url");
var http = require("http");

Expand Down
1 change: 1 addition & 0 deletions test/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"eqnull": true,
"node": true,
"validthis": true,
"mocha": true,
"globals": {
"describe" : false,
"it" : false,
Expand Down
4 changes: 2 additions & 2 deletions test/client/specs/directives/snippet-info.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe("Directive: Snippet info", function () {
});

it("Should be shown be default", function () {
var localScope = scope.$$childHead;
// assert.equal(localScope.ui.snippet, true);
//var localScope = scope.$$childHead;
//assert.equal(localScope.ui.snippet, true);
});
});
});
4 changes: 1 addition & 3 deletions test/client/specs/modules/disconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ describe("When using the disconnect element", function () {

var scope, element, compile;

var $window;

beforeEach(module("BrowserSync"));
beforeEach(module("test.templates"));

// Initialize the controller and a mock scope
beforeEach(inject(function ($compile, $rootScope, _$window_) {
beforeEach(inject(function ($compile, $rootScope) {
scope = $rootScope;
compile = $compile;
}));
Expand Down
4 changes: 1 addition & 3 deletions test/client/specs/modules/history.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
describe("Module: History", function () {

var scope, element, compile, clock;

beforeEach(module("BrowserSync"));
beforeEach(module("test.templates"));

describe("When using the history module", function () {

var Location, rootScope, isolatedScope, Socket;
var Location, rootScope, Socket;
beforeEach(inject(function (_Location_, $rootScope, _Socket_, $q) {
Location = _Location_;
Socket = _Socket_;
Expand Down
2 changes: 1 addition & 1 deletion test/client/specs/services/ContentSectionsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Content Sections Value/Service", function () {
values = $injector.get("contentSections");
}));
it("should be able to transform a value", function () {
var transformed = sections.transform(values["history"], function (item) {
sections.transform(values["history"], function (item) {
item.title = "Shane";
return item;
});
Expand Down
7 changes: 4 additions & 3 deletions test/server/history.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/*jshint -W079 */
var Immutable = require("immutable");
var history = require("../../server/plugins/history/history");
var assert = require("chai").assert;

describe("Saving history", function () {
it("Adding a new path", function () {
var imm = Immutable.OrderedSet('/');
var imm = Immutable.OrderedSet("/");
var out = history.addPath(imm, "http://localhost/shane");
assert.deepEqual(out.toJS(), ["/", "/shane"]);
});
it("Adding a dupe path", function () {
var imm = Immutable.OrderedSet('/');
var imm = Immutable.OrderedSet("/");
var out = history.addPath(imm, "http://localhost/");
assert.deepEqual(out.toJS(), ["/"]);
});
it("Can remove a path", function () {
var imm = Immutable.OrderedSet(['/', "/shane"]);
var imm = Immutable.OrderedSet(["/", "/shane"]);
var out = history.removePath(imm, "http://localhost/");
assert.deepEqual(out.toJS(), ["/shane"]);
});
Expand Down
6 changes: 3 additions & 3 deletions test/server/init.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*jshint -W079 */
var browserSync = require("browser-sync");
var cp = require("../../index");
var assert = require("chai").assert;
var sinon = require("sinon");
var config = require("../../server/config");
var request = require("supertest");

Expand Down Expand Up @@ -35,7 +35,7 @@ describe("Can be started with browserSync instance", function() {
request(controlPanel.server)
.get("/")
.expect(200)
.end(function (err, res, req) {
.end(function (err, res) {
assert.include(res.text, "Browser Sync - Control Panel");
done();
});
Expand All @@ -54,7 +54,7 @@ describe("Can be started with browserSync instance", function() {
request(controlPanel.server)
.get(config.defaults.appJs)
.expect(200, function (err, res) {
assert.include(res.text, 'angular');
assert.include(res.text, "angular");
done();
});
});
Expand Down
Loading

0 comments on commit 2217c40

Please sign in to comment.