Skip to content

Commit

Permalink
Added custom jshint & jscs and validated all JS - Before theme restru…
Browse files Browse the repository at this point in the history
…cturing
  • Loading branch information
kurtommy committed Oct 4, 2015
1 parent 274d0e0 commit f59961e
Show file tree
Hide file tree
Showing 44 changed files with 618 additions and 196 deletions.
83 changes: 83 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"esnext": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"maximumLineLength": {
"value": 120,
"allowComments": true,
"allowRegex": true
},
"validateIndentation": 2,
"validateQuoteMarks": "'",
"validateParameterSeparator": ", ",

"disallowMultipleLineStrings": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpacesInCallExpression": true,
"disallowPaddingNewlinesInBlocks": true,
"requireCommaBeforeLineBreak": true,
"requireCapitalizedConstructors": true,

"disallowKeywordsOnNewLine": ["else", "catch", "finally"],

"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"switch",
"return",
"try"
],
"requireSpaceBeforeBinaryOperators": [
"=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
"&=", "|=", "^=", "+=",
"+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
"|", "^", "&&", "||", "===", "==", ">=",
"<=", "<", ">", "!=", "!=="
],
"requireSpaceAfterBinaryOperators": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeBlockStatements": true,
"requireLineFeedAtFileEnd": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideObjectBrackets": "nested",
"disallowSpacesInsideArrayBrackets": "nested",
"disallowSpacesInsideParentheses": true,
"disallowSpaceAfterObjectKeys": true,
"requireSpaceBeforeObjectValues": true,

"disallowNewlineBeforeBlockStatements": true,

"fileExtensions": [ ".js", "jscs", ".es6" ],

"requireSpaceBetweenArguments": true,
"requireParenthesesAroundIIFE": true,

"disallowKeywords": ["with"],
"disallowImplicitTypeConversion": ["string"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],

"safeContextKeyword": "_this",
"requireBlocksOnNewline": 1,
"requireLineBreakAfterVariableAssignment": true,
"requireMultipleVarDecl": "onevar",

"excludeFiles": [
]
}
97 changes: 82 additions & 15 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,90 @@
{
"passfail": false,
"maxerr": 100,
"browser": true,
"node": true,
"rhino": false,
"couch": false,
"wsh": true,
"jquery": true,
"prototypejs": false,
"mootools": false,
"dojo": false,
"debug": true,
"devel": true,
"strict": false,
"globalstrict": false,
"esnext": true,
"bitwise": true,
"asi": false,
"laxbreak": false,
"bitwise": false,
"boss": false,
"curly": true,
"eqeqeq": true,
"eqnull": false,
"evil": false,
"expr": true,
"forin": false,
"immed": true,
"latedef": false,
"loopfunc": false,
"noarg": true,
"regexp": true,
"regexdash": false,
"scripturl": true,
"shadow": true,
"supernew": false,
"undef": true,
"unused": true,
"validthis": true,
"jasmine": true,
"globals": {
"angular": false,
"inject": false,
"module": false,
"io": true,
"socket": true,
"toastr": true
},
"devel": {
"console": true
}
"funcscope": false,
"iterator": false,
"lastsemic": false,
"laxcomma": false,
"nonstandard": true,
"onecase": false,
"proto": false,
"smarttabs": false,
"validthis": false,
"unused": false,
"newcap": true,
"noempty": false,
"nonew": true,
"nomen": false,
"onevar": false,
"plusplus": false,
"sub": true,
"trailing": true,
"white": true,
"indent": 2,
"predef": [
"define",
"describe",
"beforeEach",
"afterEach",
"beforeAll",
"afterAll",
"expect",
"it",
"xit",
"IScroll",
"moment",
"inject",
"jasmine",
"xdescribe",
"Snap",
"mina",
"TestElement",
"TestUtils",
"sprintf",
"angular",
"_",
"wrapGenerator",
"bouncefix",
"spyOn",
"google",
"d3",
"_satellite",
"picturefill",
"io",
"socket"
]
}
23 changes: 23 additions & 0 deletions .jshintrc_
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"esnext": true,
"bitwise": true,
"curly": true,
"eqeqeq": true,
"latedef": false,
"noarg": true,
"undef": true,
"unused": true,
"validthis": true,
"jasmine": true,
"globals": {
"angular": false,
"inject": false,
"module": false,
"io": true,
"socket": true,
"toastr": true
},
"devel": {
"console": true
}
}
Binary file removed dist/favicon.ico
Binary file not shown.
Binary file added dist/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!doctype html><html ng-app="volumio"><head><meta charset="utf-8"><title>Volumio</title><meta name="description" content=""><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><link rel="stylesheet" href="styles/vendor-cd4f69ac82.css"><link rel="stylesheet" href="styles/app-2fc5dea85d.css"></head><body><!--[if lt IE 10]>
<!doctype html><html ng-app="volumio"><head><meta charset="utf-8"><title>Axiom air</title><meta name="description" content=""><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><link rel="shortcut icon" type="image/png" href="favicon.png"><link rel="stylesheet" href="styles/vendor-cd4f69ac82.css"><link rel="stylesheet" href="styles/app-83f16077a4.css"></head><body><!--[if lt IE 10]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]--><div ui-view="layout"></div><script src="scripts/vendor-f1865dec62.js"></script><script src="scripts/app-47a349f7e2.js"></script></body></html>
<![endif]--><div ui-view="layout"></div><script src="scripts/vendor-f1865dec62.js"></script><script src="scripts/app-5feaddcfe9.js"></script></body></html>
5 changes: 0 additions & 5 deletions dist/scripts/app-47a349f7e2.js

This file was deleted.

5 changes: 5 additions & 0 deletions dist/scripts/app-5feaddcfe9.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/styles/app-2fc5dea85d.css

This file was deleted.

1 change: 1 addition & 0 deletions dist/styles/app-83f16077a4.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions gulp/build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// jshint ignore: start
// jscs:disable
'use strict';

var path = require('path');
Expand Down
2 changes: 2 additions & 0 deletions gulp/scripts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// jshint ignore: start
// jscs:disable
'use strict';

var path = require('path');
Expand Down
2 changes: 2 additions & 0 deletions gulp/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// jshint ignore: start
// jscs:disable
'use strict';

var path = require('path');
Expand Down
2 changes: 2 additions & 0 deletions gulp/styles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// jshint ignore: start
// jscs:disable
'use strict';

var path = require('path');
Expand Down
6 changes: 3 additions & 3 deletions src/app/browse/browse.controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class BrowseController {
constructor (browseService, playQueueService, playlistService, socketService, $modal) {
constructor(browseService, playQueueService, playlistService, socketService, $modal) {
'ngInject';
this.browseService = browseService;
this.playQueueService = playQueueService;
Expand Down Expand Up @@ -62,12 +62,12 @@ class BrowseController {
modalInstance.result.then(() => {}, () => {});
}

deletePlaylist(item){
deletePlaylist(item) {
console.log('browse - deletePlaylist', item);
this.playlistService.deletePlaylist(item.title);
}

addToFavourites(item){
addToFavourites(item) {
console.log('browse - addToFavourites', item);
this.playlistService.addToFavourites(item);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/browse/browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<img ng-if="item.image" ng-src="{{item.albumart}}" alt="" style="height:80px;"/>
<i ng-if="item.icon" class="{{item.icon}}"></i>
</td>
<td>{{item.title}} - {{item.type}}</td>
<td>{{item.title}}</td>
<td>{{item.album}}</td>
<td>{{item.artist}}</td>
<td>
Expand Down
52 changes: 27 additions & 25 deletions src/app/browse/components/modal/modal-playlist.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<div class="modal-header">
<h3 class="modal-title">{{modalPlaylist.params.title}}</h3>
</div>
<div class="modal-body">
<ul class="list-group">
<li class="list-group-item">
<input type="text" ng-model="modalPlaylist.customPlaylist">
<button type="button" ng-click="modalPlaylist.addToCustomPlaylist()">New</button>
</li>
<li class="list-group-item"
ng-click="modalPlaylist.addToFavourite()"
>
Favourites
</li>
<li ng-repeat="playlist in modalPlaylist.params.playlists track by $index"
class="list-group-item"
ng-click="modalPlaylist.addToPlaylist(playlist)"
>
{{playlist}}
</li>
</ul>
</div>
<div class="modal-footer">
<!-- <button class="btn btn-primary" ng-click="modalPlaylist.ok()">Add</button> -->
<button class="btn btn-warning" ng-click="modalPlaylist.cancel()">Cancel</button>
<div id="modalPlaylist">
<div class="modal-header">
<h3 class="modal-title">{{modalPlaylist.params.title}}</h3>
</div>
<div class="modal-body">
<input type="text" ng-model="modalPlaylist.customPlaylist">
<button type="button" ng-click="modalPlaylist.addToCustomPlaylist()">
New
</button>
<ul class="list-group">
<li class="list-group-item"
ng-click="modalPlaylist.addToFavourite()">
Favourites
</li>
<li ng-repeat="playlist in modalPlaylist.params.playlists track by $index"
class="list-group-item"
ng-click="modalPlaylist.addToPlaylist(playlist)">
{{playlist}}
</li>
</ul>
</div>
<div class="modal-footer">
<!-- <button class="btn btn-primary" ng-click="modalPlaylist.ok()">Add</button> -->
<button class="btn btn-warning" ng-click="modalPlaylist.cancel()">
Cancel
</button>
</div>
</div>
5 changes: 2 additions & 3 deletions src/app/components/player-buttons/player-buttons.directive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class PlayerButtonsDirective {
constructor () {
constructor() {
'ngInject';

let directive = {
Expand All @@ -10,13 +10,12 @@ class PlayerButtonsDirective {
controllerAs: 'playerButtons',
bindToController: true
};

return directive;
}
}

class PlayerButtonsController {
constructor (playerService) {
constructor(playerService) {
'ngInject';
this.playerService = playerService;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class ModalAlarmClockController {
constructor ($modalInstance, socketService, params) {
'ngInject';
this.$modalInstance = $modalInstance;
this.socketService = socketService;
this.params = params;
console.log(params);
this.init();
}

cancel() {
this.$modalInstance.dismiss('cancel');
}

init() {
this.registerListner();
this.initService();
}

registerListner() {
// this.socketService.on('pushSleep', (data) => {
// console.warn('pushSleep', data);
// //this.menuItems = data;
// });
}

initService() {
//this.socketService.emit('getSleep');
}
}

export default ModalAlarmClockController;
Loading

0 comments on commit f59961e

Please sign in to comment.