Download:
child 141:135b4e1d4257
parent 139:d9d73b9d111e
140:2e975ca4302e
Anton Shestakov <av6@dwimlabs.net>, Sat, 01 Jul 2017 00:45:09 +0800
ui: use more jshint checks

5 файлов изменено, 12 вставок(+), 4 удалений(-) [+]
.jshintrc file | annotate | diff | comparison | revisions
static/js/backbone.shard.js file | annotate | diff | comparison | revisions
static/js/framework/models.js file | annotate | diff | comparison | revisions
static/js/framework/views/base.js file | annotate | diff | comparison | revisions
static/js/ui.js file | annotate | diff | comparison | revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.jshintrc Sat Jul 01 00:45:09 2017 +0800
@@ -0,0 +1,8 @@
+{
+ // Enforcing
+ "curly" : true, // true: Require {} for every new block or scope
+ "eqeqeq" : true, // true: Require triple equals (===) for comparison
+
+ // Custom Globals
+ "globals" : {"_": false, "Backbone": false}
+}
--- a/static/js/backbone.shard.js Sat Jul 01 00:34:05 2017 +0800
+++ b/static/js/backbone.shard.js Sat Jul 01 00:45:09 2017 +0800
@@ -16,7 +16,7 @@
this._collection
.on('all', function(event, model) {
- if (event == 'change') {
+ if (event === 'change') {
if (this._filter(model) && _(this.models).contains(model)) {
this.trigger.apply(this, arguments);
}
--- a/static/js/framework/models.js Sat Jul 01 00:34:05 2017 +0800
+++ b/static/js/framework/models.js Sat Jul 01 00:45:09 2017 +0800
@@ -1,7 +1,7 @@
var Model = Backbone.Model.extend({
url: function() {
var url = Backbone.Model.prototype.url.call(this);
- return url[url.length - 1] == '/' ? url : url + '/';
+ return url[url.length - 1] === '/' ? url : url + '/';
},
adhoc: function(data) {
--- a/static/js/framework/views/base.js Sat Jul 01 00:34:05 2017 +0800
+++ b/static/js/framework/views/base.js Sat Jul 01 00:45:09 2017 +0800
@@ -39,7 +39,7 @@
initialize: function(options) {
if ('plurals' in options) {
this.makeTitle = function(n) {
- return n + ' ' + options.plurals[n == 1 ? 0 : 1];
+ return n + ' ' + options.plurals[n === 1 ? 0 : 1];
};
}
this.bindCollection();
--- a/static/js/ui.js Sat Jul 01 00:34:05 2017 +0800
+++ b/static/js/ui.js Sat Jul 01 00:45:09 2017 +0800
@@ -8,7 +8,7 @@
fruitbar.xhrs = [];
fruitbar.xhrs.done = function() {
return _(this).all(function(xhr) {
- return xhr.readyState == 4;
+ return xhr.readyState === 4;
});
};
fruitbar.xhrs.abort = function() {