Permalink
Browse files

Ω13: Get jshint going

  • Loading branch information...
1 parent 666c209 commit 91c9f279743b09fc6888c5ae9c1891461ca18de4 @wachunga committed Feb 26, 2012
Showing with 244 additions and 182 deletions.
  1. +3 −0 .jshintignore
  2. +60 −0 .jshintrc
  3. +5 −0 jshint.sh
  4. +1 −1 lib/Issue.js
  5. +20 −27 lib/historyDao.js
  6. +2 −2 lib/issueDao.js
  7. +1 −1 lib/project.js
  8. +117 −125 lib/tracker.js
  9. 0 lint-config.json
  10. +3 −0 package.json
  11. +10 −8 public/js/Tracker.js
  12. +7 −7 public/js/flavour.js
  13. +1 −1 public/js/main.js
  14. +1 −1 public/js/mainProject.js
  15. +3 −3 public/js/omegaEvent.js
  16. +6 −2 public/js/util.js
  17. +4 −4 server.js
View
@@ -0,0 +1,3 @@
+app.build.js
+r.js
+./public/js/require.js
View
@@ -0,0 +1,60 @@
+{
+ // Settings
+ "passfail" : false, // Stop on first error.
+ "maxerr" : 300, // Maximum error before stopping.
+
+ // Predefined globals that JSHint will ignore.
+ "browser" : false, // Standard browser globals e.g. `window`, `document`.
+ "node" : false,
+ "rhino" : false,
+ "couch" : false,
+ "wsh" : false, // Windows Scripting Host.
+
+ "jquery" : false,
+ "prototypejs" : false,
+ "mootools" : false,
+ "dojo" : false,
+
+ // Development
+ "debug" : false, // Allow debugger statements e.g. browser breakpoints.
+ "devel" : false, // Allow developments statements e.g. `console.log();`.
+
+ // EcmaScript 5
+ "es5" : true, // Allow EcmaScript 5 syntax.
+ "strict" : false, // Require `use strict` pragma in every file.
+ "globalstrict" : false, // Allow global "use strict" (also enables 'strict').
+
+
+ // Bug prevention
+ "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
+ "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
+ "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
+ "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
+ "curly" : true, // Require {} for every new block or scope.
+ "eqeqeq" : true, // Require triple equals i.e. `===`.
+ "eqnull" : false, // Tolerate use of `== null`.
+ "evil" : false, // Tolerate use of `eval`.
+ "expr" : false, // Tolerate `ExpressionStatement` as Programs.
+ "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
+ "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
+ "latedef" : false, // Prohipit variable use before definition.
+ "loopfunc" : false, // Allow functions to be defined within loops.
+ "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
+ "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions.
+ "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
+ "scripturl" : true, // Tolerate script-targeted URLs.
+ "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
+ "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
+ "undef" : false, // Require all non-global variables be declared before they are used.
+
+ // Styling preferences
+ "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
+ "noempty" : true, // Prohipit use of empty blocks.
+ "nonew" : true, // Prohibit use of constructors for side-effects.
+ "nomen" : false, // Prohibit use of initial or trailing underbars in names.
+ "onevar" : false, // Allow only one `var` statement per function.
+ "plusplus" : false, // Prohibit use of `++` & `--`.
+ "sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
+ "trailing" : true, // Prohibit trailing whitespaces.
+ "white" : false // Check against strict whitespace rules.
+}
View
@@ -0,0 +1,5 @@
+jshint *.js ./lib/*.js ./public/js/*.js
+
+if [ $? -eq 0 ]; then
+ echo 'Lint-free'
+fi
View
@@ -19,6 +19,6 @@ Issue.applyDefaults = function (issues) {
_.defaults(issue, { critical: false, closer: Issue.UNASSIGNED });
});
return issues;
-}
+};
module.exports = Issue;
View
@@ -1,36 +1,29 @@
-var _ = require('underscore');
-var oe = require('../public/js/omegaEvent');
+var _ = require('underscore'),
+ oe = require('../public/js/omegaEvent');
-var historyDao = (function () {
+var historyDao = module.exports = {};
- var HISTORY_ITEMS_TO_SHOW = 10;
- var MAX_HISTORY_ITEMS = 100;
+var HISTORY_ITEMS_TO_SHOW = 10;
+var MAX_HISTORY_ITEMS = 100;
- var history = {};
+var history = {};
- return {
+historyDao.record = function (type, details, project) {
+ history[project.slug] = history[project.slug] || [];
- record: function (type, details, project) {
- history[project.slug] = history[project.slug] || [];
- var event = new oe.OmegaEvent(type, details);
- history[project.slug].push(event);
-
- if (history[project.slug].length > MAX_HISTORY_ITEMS) {
- history[project.slug] = _.last(history[project.slug], HISTORY_ITEMS_TO_SHOW);
- }
- return event;
- },
-
- load: function (project) {
- return _.last(history[project.slug] || [], HISTORY_ITEMS_TO_SHOW);
- },
-
- reset: function (project) {
- history[project.slug] = [];
- }
+ var event = new oe.OmegaEvent(type, details);
+ history[project.slug].push(event);
+ if (history[project.slug].length > MAX_HISTORY_ITEMS) {
+ history[project.slug] = _.last(history[project.slug], HISTORY_ITEMS_TO_SHOW);
}
+ return event;
+};
-})();
+historyDao.load = function (project) {
+ return _.last(history[project.slug] || [], HISTORY_ITEMS_TO_SHOW);
+};
-module.exports = historyDao;
+historyDao.reset = function (project) {
+ history[project.slug] = [];
+};
View
@@ -40,11 +40,11 @@ issueDao.add = function (issue, project) {
};
issueDao.find = function (id, project) {
- return issues[project.slug][id-1];
+ return issues[project.slug][id - 1];
};
issueDao.update = function (issue, project) {
- issues[project.slug][issue.id-1] = issue;
+ issues[project.slug][issue.id - 1] = issue;
this.write(project); // TODO: only persist updated
};
View
@@ -6,7 +6,7 @@ function Project(name, unlisted) {
this.createdDate = new Date();
this.slug = slugify(name);
- this.url = '/project/'+ this.slug;
+ this.url = '/project/' + this.slug;
this.closed = false;
this.deleted = false;
Oops, something went wrong.

0 comments on commit 91c9f27

Please sign in to comment.