Coding style cleanup (Gruntfile, lib)
- Gruntfile: add `jshint` and `jscs` as deps of `grunt test` - Gruntfile: temporarily disable checks of `test` scripts - .jscsrc: relax jsdoc validation - .jshintrc: relax the rule for property access via dot notation - lib: fix remaining style issues
This commit is contained in:
parent
33096dafa7
commit
48d4ed28d3
5
.jscsrc
5
.jscsrc
|
@ -13,5 +13,10 @@
|
|||
"value": 150,
|
||||
"allowComments": true,
|
||||
"allowRegex": true
|
||||
},
|
||||
"validateJSDoc": {
|
||||
"checkParamNames": false,
|
||||
"checkRedundantParams": true,
|
||||
"requireParamTypes": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"trailing": true,
|
||||
"newcap": true,
|
||||
"nonew": true,
|
||||
"sub": true,
|
||||
"laxcomma": true,
|
||||
"laxbreak": true
|
||||
}
|
||||
|
|
18
Gruntfile.js
18
Gruntfile.js
|
@ -33,12 +33,16 @@ module.exports = function(grunt) {
|
|||
lib: {
|
||||
src: ['lib/**/*.js']
|
||||
},
|
||||
test: {
|
||||
src: ['test/**/*.js']
|
||||
}
|
||||
// TODO(bajtos) - common/**/*.js
|
||||
// TODO tests don't pass yet
|
||||
// test: {
|
||||
// src: ['test/**/*.js']
|
||||
// }
|
||||
},
|
||||
jscs: {
|
||||
src: ['lib/**/*.js', 'test/**/*.js']
|
||||
gruntfile: 'Gruntfile.js',
|
||||
lib: ['lib/**/*.js']
|
||||
// TODO(bajtos) - common/**/*.js
|
||||
},
|
||||
watch: {
|
||||
gruntfile: {
|
||||
|
@ -83,7 +87,7 @@ module.exports = function(grunt) {
|
|||
karma: {
|
||||
'unit-once': {
|
||||
configFile: 'test/karma.conf.js',
|
||||
browsers: [ 'PhantomJS' ],
|
||||
browsers: ['PhantomJS'],
|
||||
singleRun: true,
|
||||
reporters: ['dots', 'junit'],
|
||||
|
||||
|
@ -185,7 +189,7 @@ module.exports = function(grunt) {
|
|||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks("grunt-jscs");
|
||||
grunt.loadNpmTasks('grunt-jscs');
|
||||
grunt.loadNpmTasks('grunt-karma');
|
||||
|
||||
grunt.registerTask('e2e-server', function() {
|
||||
|
@ -200,6 +204,8 @@ module.exports = function(grunt) {
|
|||
grunt.registerTask('default', ['browserify']);
|
||||
|
||||
grunt.registerTask('test', [
|
||||
'jscs',
|
||||
'jshint',
|
||||
process.env.JENKINS_HOME ? 'mochaTest:unit-xml' : 'mochaTest:unit',
|
||||
'karma:unit-once']);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ function App() {
|
|||
* Export the app prototype.
|
||||
*/
|
||||
|
||||
var app = exports = module.exports = {};
|
||||
var app = module.exports = {};
|
||||
|
||||
/**
|
||||
* Lazily load a set of [remote objects](http://apidocs.strongloop.com/strong-remoting/#remoteobjectsoptions).
|
||||
|
|
|
@ -28,7 +28,7 @@ var assert = require('assert');
|
|||
* @header loopback
|
||||
*/
|
||||
|
||||
var loopback = exports = module.exports = createApplication;
|
||||
var loopback = module.exports = createApplication;
|
||||
|
||||
/*!
|
||||
* Framework version.
|
||||
|
|
10
lib/model.js
10
lib/model.js
|
@ -593,10 +593,12 @@ Model.nestRemoting = function(relationName, options, cb) {
|
|||
var paramName = options.paramName || 'nk';
|
||||
|
||||
var http = [].concat(sharedToClass.http || [])[0];
|
||||
var httpPath;
|
||||
var acceptArgs;
|
||||
|
||||
if (relation.multiple) {
|
||||
var httpPath = pathName + '/:' + paramName;
|
||||
var acceptArgs = [
|
||||
httpPath = pathName + '/:' + paramName;
|
||||
acceptArgs = [
|
||||
{
|
||||
arg: paramName, type: 'any', http: { source: 'path' },
|
||||
description: 'Foreign key for ' + relation.name,
|
||||
|
@ -604,8 +606,8 @@ Model.nestRemoting = function(relationName, options, cb) {
|
|||
}
|
||||
];
|
||||
} else {
|
||||
var httpPath = pathName;
|
||||
var acceptArgs = [];
|
||||
httpPath = pathName;
|
||||
acceptArgs = [];
|
||||
}
|
||||
|
||||
// A method should return the method name to use, if it is to be
|
||||
|
|
|
@ -850,7 +850,7 @@ PersistedModel.replicate = function(since, targetModel, options, callback) {
|
|||
sourceModel.emit('conflicts', conflicts);
|
||||
}
|
||||
|
||||
callback && callback(null, conflicts);
|
||||
if (callback) callback(null, conflicts);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -869,7 +869,7 @@ PersistedModel.createUpdates = function(deltas, cb) {
|
|||
var tasks = [];
|
||||
|
||||
deltas.forEach(function(change) {
|
||||
var change = new Change(change);
|
||||
change = new Change(change);
|
||||
var type = change.type();
|
||||
var update = {type: type, change: change};
|
||||
switch (type) {
|
||||
|
@ -1011,6 +1011,7 @@ PersistedModel.enableChangeTracking = function() {
|
|||
|
||||
// cleanup
|
||||
setInterval(cleanup, cleanupInterval);
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
Model.rectifyAllChanges(function(err) {
|
||||
|
@ -1020,7 +1021,6 @@ PersistedModel.enableChangeTracking = function() {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PersistedModel._defineChangeModel = function() {
|
||||
|
@ -1028,12 +1028,14 @@ PersistedModel._defineChangeModel = function() {
|
|||
assert(BaseChangeModel,
|
||||
'Change model must be defined before enabling change replication');
|
||||
|
||||
return this.Change = BaseChangeModel.extend(this.modelName + '-change',
|
||||
this.Change = BaseChangeModel.extend(this.modelName + '-change',
|
||||
{},
|
||||
{
|
||||
trackModel: this
|
||||
}
|
||||
);
|
||||
|
||||
return this.Change;
|
||||
};
|
||||
|
||||
PersistedModel.rectifyAllChanges = function(callback) {
|
||||
|
|
Loading…
Reference in New Issue