Skip to content

Commit

Permalink
Fix JSHint and linting errors
Browse files Browse the repository at this point in the history
JSHint wasn’t running on any files, so this fixes that and fixes all the linting errors.
  • Loading branch information
Chasen Le Hara authored and chasenlehara committed Sep 5, 2019
1 parent 74780ab commit 4981ca0
Show file tree
Hide file tree
Showing 38 changed files with 195 additions and 266 deletions.
2 changes: 1 addition & 1 deletion base/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = behavior("base",function(baseConnection){
} else if(this.idProp) {
return instance[this.idProp];
} else {
throw new Error("can-connect/base/base - Please add a queryLogic option.")
throw new Error("can-connect/base/base - Please add a queryLogic option.");
}
},

Expand Down
2 changes: 0 additions & 2 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";
var stealTools = require("steal-tools");
var path = require("path");
var fs = require("fs");

var modules = [];

Expand Down
5 changes: 2 additions & 3 deletions cache-requests/cache-requests_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ QUnit.test("Incrementally load data", function(assert) {

var behavior = cacheRequests( {
getListData: function(params){
console.log("gld", params)
assert.equal(params.start, count * 10 + 1, "start is right "+params.start);
count++;
assert.equal(params.end, count * 10, "end is right "+params.end);
Expand Down Expand Up @@ -160,7 +159,7 @@ QUnit.test("Filters are preserved for different pagination", function(assert) {
type: "a"
});
}
isSecondRun = true
isSecondRun = true;
return Promise.resolve({data: items});
},
queryLogic: queryLogic,
Expand Down Expand Up @@ -217,7 +216,7 @@ QUnit.test("QueryLogic usage example", function(assert) {
var done = assert.async();

todoConnection.getListData({filter: {status: "critical"}}).then(function(){
return todoConnection.getListData({})
return todoConnection.getListData({});
}).then(function(){
done();
});
Expand Down
1 change: 0 additions & 1 deletion can/base-map/base-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var canMap = require("../map/map");
var canRef = require("../ref/ref");
var constructorStore = require("../../constructor/store/store");
var dataCallbacks = require("../../data/callbacks/callbacks");
var callbacksCache = require("../../data/callbacks-cache/callbacks-cache");
var dataParse = require("../../data/parse/parse");
var dataUrl = require("../../data/url/url");
var realTime = require("../../real-time/real-time");
Expand Down
2 changes: 1 addition & 1 deletion can/base-map/base-map_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ QUnit.test("uses idProp", function(assert) {
});


QUnit.skip("creates map if none is provided (#8)", function(){
QUnit.skip("creates map if none is provided (#8)", function(assert){

var connection = baseMap({
url: "/api/restaurants",
Expand Down
4 changes: 2 additions & 2 deletions can/constructor-hydrate/constructor-hydrate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QUnit.test("basics", function(assert) {
var myPage = new (DefineMap.extend({
hub: { Type: Hub },
hub2: { Type: Hub },
}));
}))();

myPage.hub = {id: 1, name: 'One'};
HubConnection.addInstanceReference(myPage.hub);
Expand All @@ -51,6 +51,6 @@ QUnit.test("Two objects with no id", function(assert) {
var hub1 = new Hub({name: 'One'});
HubConnection.addInstanceReference(hub1);
assert.ok(!HubConnection.instanceStore.has(undefined), 'The instanceStore should not have an "undefined" key item');
var hub2 = new Hub({name: 'One'});
new Hub({name: 'One'});
assert.ok(true, 'Should allow to create two instances without an id (no Max Call Stack error)');
});
2 changes: 1 addition & 1 deletion can/constructor-hydrate/constructor-hydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ var constructorHydrateBehavior = connect.behavior("can-connect/can/construct-hyd
};
baseConnect.init.apply(this, arguments);
}
}
};
});

module.exports = constructorHydrateBehavior;
Expand Down
11 changes: 5 additions & 6 deletions can/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var isPlainObject = canReflect.isPlainObject;

var queues = require("can-queues");
var eventQueue = require("can-event-queue/map/map");
var ObservationRecorder = require("can-observation-recorder");
var canSymbol = require("can-symbol");
var QueryLogic = require("can-query-logic");

Expand Down Expand Up @@ -54,7 +53,7 @@ var canMapBehavior = behavior("can/map",function(baseConnection){
} else {
return "Connection{}";
}
}
};
}

this.List = this.List || this.Map.List;
Expand Down Expand Up @@ -87,7 +86,7 @@ var canMapBehavior = behavior("can/map",function(baseConnection){
if(connection[method]) {
connection[method](instance);
}
}
};
//!steal-remove-start
Object.defineProperty(canConnectMap_onMapBoundChange, "name", {
value: canReflect.getName(this.Map) + " boundChange",
Expand All @@ -106,7 +105,7 @@ var canMapBehavior = behavior("can/map",function(baseConnection){
if(connection[method]) {
connection[method](list);
}
}
};
//!steal-remove-start
Object.defineProperty(canConnectMap_onListBoundChange, "name", {
value: canReflect.getName(this.List) + " boundChange",
Expand All @@ -129,7 +128,7 @@ var canMapBehavior = behavior("can/map",function(baseConnection){
connection.addInstanceReference(instance);
}
});
})
});
} else {
console.warn("can-connect/can/map is unable to listen to onInstancePatches on the Map type");
}
Expand Down Expand Up @@ -724,7 +723,7 @@ var mapOverwrites = {
*/
return function () {
return connection.isNew(this);
}
};
},

isSaving: function (base, connection) {
Expand Down
29 changes: 11 additions & 18 deletions can/map/map_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ var map = [].map;

var later = testHelpers.later;

var logErrorAndStart = function(e){
assert.ok(false,"Error "+e);
done();
return Promise.reject(e);

};

constructorStore.requestCleanupDelay = 1;
var queues = require("can-queues");

Expand Down Expand Up @@ -93,7 +86,9 @@ QUnit.test("real-time super model", function(assert) {
var firstItems = [ {id: 0, type: "important"}, {id: 1, type: "important"} ];
var secondItems = [ {id: 2, due: "today"}, {id: 3, due: "today"} ];

var state = testHelpers.makeStateChecker(assert, [
var done = assert.async();

var state = testHelpers.makeStateChecker(assert, done, [
"getListData-important",
"getListData-today",
"createData-today+important",
Expand All @@ -103,8 +98,6 @@ QUnit.test("real-time super model", function(assert) {
"getListData-today-2"
]);

var done = assert.async();

fixture({
"GET /services/todos": function(){

Expand Down Expand Up @@ -178,7 +171,7 @@ QUnit.test("real-time super model", function(assert) {

setTimeout(createImportantToday,1);

}, logErrorAndStart);
}, testHelpers.logErrorAndStart(assert, done));

var created;
function createImportantToday() {
Expand All @@ -189,7 +182,7 @@ QUnit.test("real-time super model", function(assert) {
})).then( function(task){
created = task;
setTimeout(checkLists, 1);
}, logErrorAndStart);
}, testHelpers.logErrorAndStart(assert, done));
}


Expand Down Expand Up @@ -230,7 +223,7 @@ QUnit.test("real-time super model", function(assert) {

function update1() {
created.removeAttr("due");
connection.save(created).then(later(checkLists2), logErrorAndStart);
connection.save(created).then(later(checkLists2), testHelpers.logErrorAndStart(assert, done));
}
function checkLists2() {
assert.ok( importantList.indexOf(created) >= 0, "still in important");
Expand All @@ -241,7 +234,7 @@ QUnit.test("real-time super model", function(assert) {
function update2() {
created.removeAttr("type");
created.attr("due","today");
connection.save(created).then(later(checkLists3), logErrorAndStart);
connection.save(created).then(later(checkLists3), testHelpers.logErrorAndStart(assert, done));
}
function checkLists3() {
assert.equal( importantList.indexOf(created), -1, "removed from important");
Expand Down Expand Up @@ -274,7 +267,7 @@ QUnit.test("real-time super model", function(assert) {
firstImportant = importantList[0];

connection.destroy(firstImportant)
.then(later(checkLists4),logErrorAndStart);
.then(later(checkLists4), testHelpers.logErrorAndStart(assert, done));
}

function checkLists4(){
Expand Down Expand Up @@ -516,7 +509,7 @@ QUnit.test("additional properties are included in getList responses", function(a

QUnit.test("should batch model events", function(assert) {
var eventOrder = [];
var Type = Map.extend({})
var Type = Map.extend({});
var instance = new Type();

instance.on("updated", function() {
Expand All @@ -530,10 +523,10 @@ QUnit.test("should batch model events", function(assert) {
queues.batch.start();
queues.notifyQueue.enqueue(function() {
eventOrder.push(1);
})
});
queues.deriveQueue.enqueue(function() {
eventOrder.push(4);
})
});
canMap.callbackInstanceEvents("updated", instance);
queues.batch.stop();

Expand Down
3 changes: 1 addition & 2 deletions can/map/observable-object-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var realTime = require("../../real-time/real-time");
var connect = require("../../can-connect");

var QUnit = require("steal-qunit");
var fixture = require("can-fixture");



Expand Down Expand Up @@ -87,4 +86,4 @@ QUnit.module("can-connect/can/map/map with can-observable-object",{

require("./test-real-time-super-model")(function(){
return {Todo: this.Todo, TodoList: this.TodoList};
});
});
27 changes: 9 additions & 18 deletions can/map/test-real-time-super-model.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
"use strict";
var QUnit = require("steal-qunit");

var canLog = require("can-log");
var canReflect = require("can-reflect");
var fixture = require("can-fixture");
// load connections
var testHelpers = require("../../test-helpers");
var assign = canReflect.assignMap;
var map = [].map;
var later = testHelpers.later;
var queues = require("can-queues");
var makeRealTimeSuperModel = require("./make-real-time-super-model");
var constructorStore = require("../../constructor/store/store");
constructorStore.requestCleanupDelay = 1;

var logErrorAndStart = function(e){
assert.ok(false,"Error "+e);
setTimeout(function(){
throw e;
},1);
done();
};
var cleanUndefineds = function(obj) {
if(Array.isArray(obj)) {
return obj.map(cleanUndefineds);
Expand Down Expand Up @@ -48,7 +39,9 @@ module.exports = function(makeTypes){
var firstItems = [ {id: 0, type: "important"}, {id: 1, type: "important"} ];
var secondItems = [ {id: 2, due: "today"}, {id: 3, due: "today"} ];

var state = testHelpers.makeStateChecker(assert, [
var done = assert.async();

var state = testHelpers.makeStateChecker(assert, done, [
"getListData-important",
"getListData-today",
"createData-today+important",
Expand All @@ -58,8 +51,6 @@ module.exports = function(makeTypes){
"getListData-today-2"
]);

var done = assert.async();

fixture({
"GET /services/todos": function(){
if(state.get() === "getListData-important") {
Expand Down Expand Up @@ -113,7 +104,7 @@ module.exports = function(makeTypes){
var importantList,
todayList,
bindFunc = function(){
//canLog.log("length changing");
// console.log("length changing");
};

Promise.all([connection.getList({type: "important"}), connection.getList({due: "today"})])
Expand All @@ -127,7 +118,7 @@ module.exports = function(makeTypes){

setTimeout(createImportantToday,1);

}, logErrorAndStart);
}, testHelpers.logErrorAndStart(assert, done));

var created;
function createImportantToday() {
Expand All @@ -139,7 +130,7 @@ module.exports = function(makeTypes){
created = task;
canReflect.onKeyValue( task,"type",bindFunc);
setTimeout(checkLists, 1);
}, logErrorAndStart);
}, testHelpers.logErrorAndStart(assert, done));
}


Expand Down Expand Up @@ -181,7 +172,7 @@ module.exports = function(makeTypes){
// remove due from created
function update1() {
created.due = undefined;
connection.save(created).then(later(checkLists2), logErrorAndStart);
connection.save(created).then(later(checkLists2), testHelpers.logErrorAndStart(assert, done));
}
function checkLists2() {
assert.ok( importantList.indexOf(created) >= 0, "still in important");
Expand All @@ -192,7 +183,7 @@ module.exports = function(makeTypes){
function update2() {
created.type = undefined;
created.due = "today";
connection.save(created).then(later(checkLists3), logErrorAndStart);
connection.save(created).then(later(checkLists3), testHelpers.logErrorAndStart(assert, done));
}
function checkLists3() {
assert.equal( importantList.indexOf(created), -1, "removed from important");
Expand Down Expand Up @@ -225,7 +216,7 @@ module.exports = function(makeTypes){
firstImportant = importantList[0];

connection.destroy(firstImportant)
.then(later(checkLists4),logErrorAndStart);
.then(later(checkLists4), testHelpers.logErrorAndStart(assert, done));
}

function checkLists4(){
Expand Down
1 change: 0 additions & 1 deletion can/merge/merge-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ QUnit.test("basics", function(assert) {
setTimeout(function(){
throw err;
},1);
debugger;
done();
});

Expand Down
2 changes: 1 addition & 1 deletion can/ref/ref-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ QUnit.test("serialize-able", function(assert) {
constructorStore.requests.one("end", function(){
assert.deepEqual( canReflect.serialize(game), {id: "123", teamRefA: "321", teamRefB: "321"} );
done();
})
});

constructorStore.requests.decrement();

Expand Down
2 changes: 1 addition & 1 deletion can/ref/ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ var makeRef = function(connection) {
"can.getName": function(){
return canReflect.getName(this.constructor)+"{"+this[idProp]+"}";
}
})
});

var baseEventSetup = Ref.prototype._eventSetup;
Ref.prototype._eventSetup = function() {
Expand Down
2 changes: 1 addition & 1 deletion can/super-map/super-map_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QUnit.test("uses idProp", function(assert) {
});


QUnit.skip("creates map if none is provided (#8)", function(){
QUnit.skip("creates map if none is provided (#8)", function(assert){

var connection = superMap({
url: "/api/restaurants",
Expand Down
1 change: 0 additions & 1 deletion connect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var assign = require("can-reflect").assignMap;
var behavior = require("./behavior");

/**
Expand Down
Loading

0 comments on commit 4981ca0

Please sign in to comment.