Skip to content

Commit eac6992

Browse files
authored
Merge pull request #2536 from benmarten/feature/resolve-warnings
Resolve all Warnings and Deprecated Messages with Default Configuration.
2 parents 665792b + b02f9c2 commit eac6992

File tree

8 files changed

+47
-35
lines changed

8 files changed

+47
-35
lines changed

Diff for: templates/app/.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"no-octal-escape": 0, //disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
8383
"no-octal": 0, //disallow use of octal literals
8484
"no-param-reassign": 0, //disallow reassignment of function parameters
85-
"no-process-env": 1, //disallow use of process.env
85+
"no-process-env": 0, //disallow use of process.env
8686
"no-proto": 2, //disallow usage of __proto__ property
8787
"no-redeclare": 2, //disallow declaring the same variable more than once
8888
"no-return-assign": 2, //disallow use of assignment in return statement

Diff for: templates/app/client/app/app.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ const ngRoute = require('angular-route');<% } %>
1313
import uiRouter from 'angular-ui-router';<% } %>
1414
<%_ if(filters.uibootstrap) { _%>
1515
import uiBootstrap from 'angular-ui-bootstrap';<% } %>
16-
// import ngMessages from 'angular-messages';
1716
<%_ if(filters.auth) { _%>
18-
import ngValidationMatch from 'angular-validation-match';
17+
import 'angular-validation-match';
1918
<% } %>
2019

2120

Diff for: templates/app/client/components/auth(auth)/auth.service.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
'use strict';
2+
3+
import _ from 'lodash';
4+
25
// @flow
36
class _User {
47
_id: string = '';
@@ -185,9 +188,8 @@ export function AuthService($location, $http, $cookies, $q, appConfig, Util, Use
185188
* @param {Function|*} callback - optional, function(is)
186189
* @return {Bool|Promise}
187190
*/
188-
isAdmin() {
189-
return Auth.hasRole
190-
.apply(Auth, [].concat.apply(['admin'], arguments));
191+
isAdmin(...args) {
192+
return Auth.hasRole(...Reflect.apply([].concat, ['admin'], args));
191193
},
192194

193195
/**
@@ -196,6 +198,7 @@ export function AuthService($location, $http, $cookies, $q, appConfig, Util, Use
196198
* @return {Bool}
197199
*/
198200
isAdminSync() {
201+
// eslint-disable-next-line no-sync
199202
return Auth.hasRoleSync('admin');
200203
},
201204

Diff for: templates/app/client/components/modal(uibootstrap)/modal.service.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export function Modal($rootScope, $uibModal) {
3737
* @param {String} name - name or info to show on modal
3838
* @param {All} - any additional args are passed straight to del callback
3939
*/
40-
return function() {
41-
var args = Array.prototype.slice.call(arguments);
42-
var name = args.shift();
40+
return function(...args) {
41+
var slicedArgs = Reflect.apply(Array.prototype.slice, args);
42+
var name = slicedArgs.shift();
4343
var deleteModal;
4444

4545
deleteModal = openModal({
@@ -64,7 +64,7 @@ export function Modal($rootScope, $uibModal) {
6464
}, 'modal-danger');
6565

6666
deleteModal.result.then(function(event) {
67-
del.apply(event, args);
67+
Reflect.apply(del, event, slicedArgs);
6868
});
6969
};
7070
}

Diff for: templates/app/server/api/user(auth)/user.model(mongooseModels).js

+24-19
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ UserSchema
9999
// Validate email is not taken
100100
UserSchema
101101
.path('email')
102-
.validate(function(value, respond) {
102+
.validate(function(value) {
103103
<%_ if(filters.oauth) { -%>
104104
if(authTypes.indexOf(this.provider) !== -1) {
105-
return respond(true);
105+
return true;
106106
}
107107

108108
<%_ } -%>
109109
return this.constructor.findOne({ email: value }).exec()
110110
.then(user => {
111111
if(user) {
112112
if(this.id === user.id) {
113-
return respond(true);
113+
return true;
114114
}
115-
return respond(false);
115+
return false;
116116
}
117-
return respond(true);
117+
return true;
118118
})
119119
.catch(function(err) {
120120
throw err;
@@ -197,14 +197,16 @@ UserSchema.methods = {
197197
* @return {String}
198198
* @api public
199199
*/
200-
makeSalt(byteSize, callback) {
201-
var defaultByteSize = 16;
200+
makeSalt(...args) {
201+
let byteSize;
202+
let callback;
203+
let defaultByteSize = 16;
202204

203-
if(typeof arguments[0] === 'function') {
204-
callback = arguments[0];
205+
if(typeof args[0] === 'function') {
206+
callback = args[0];
205207
byteSize = defaultByteSize;
206-
} else if(typeof arguments[1] === 'function') {
207-
callback = arguments[1];
208+
} else if(typeof args[1] === 'function') {
209+
callback = args[1];
208210
} else {
209211
throw new Error('Missing Callback');
210212
}
@@ -244,17 +246,20 @@ UserSchema.methods = {
244246
var salt = new Buffer(this.salt, 'base64');
245247

246248
if(!callback) {
247-
return crypto.pbkdf2Sync(password, salt, defaultIterations, defaultKeyLength)
249+
// eslint-disable-next-line no-sync
250+
return crypto.pbkdf2Sync(password, salt, defaultIterations,
251+
defaultKeyLength, 'sha1')
248252
.toString('base64');
249253
}
250254

251-
return crypto.pbkdf2(password, salt, defaultIterations, defaultKeyLength, (err, key) => {
252-
if(err) {
253-
return callback(err);
254-
} else {
255-
return callback(null, key.toString('base64'));
256-
}
257-
});
255+
return crypto.pbkdf2(password, salt, defaultIterations, defaultKeyLength,
256+
'sha1', (err, key) => {
257+
if(err) {
258+
return callback(err);
259+
} else {
260+
return callback(null, key.toString('base64'));
261+
}
262+
});
258263
}
259264
};
260265

Diff for: templates/app/server/api/user(auth)/user.model(sequelizeModels).js

+5-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ export default function(sequelize, DataTypes) {
135135
* @return {String}
136136
* @api public
137137
*/
138-
makeSalt(byteSize, callback) {
139-
var defaultByteSize = 16;
138+
makeSalt(...args) {
139+
let byteSize;
140+
let callback;
141+
let defaultByteSize = 16;
140142

141143
if(typeof arguments[0] === 'function') {
142144
callback = arguments[0];
@@ -177,6 +179,7 @@ export default function(sequelize, DataTypes) {
177179
var salt = new Buffer(this.salt, 'base64');
178180

179181
if(!callback) {
182+
// eslint-disable-next-line no-sync
180183
return crypto.pbkdf2Sync(password, salt, defaultIterations, defaultKeyLength)
181184
.toString('base64');
182185
}

Diff for: templates/app/server/config/seed(models).js

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export default function seedDatabaseIfNeeded() {
1717
<% if (filters.mongooseModels) { %>Thing.find({}).remove()<% }
1818
if (filters.sequelizeModels) { %>return Thing.destroy({ where: {} })<% } %>
1919
.then(() => {
20-
<% if (filters.mongooseModels) { %>Thing.create({<% }
21-
if (filters.sequelizeModels) { %>return Thing.bulkCreate([{<% } %>
20+
<% if (filters.mongooseModels) { %>let thing = Thing.create({<% }
21+
if (filters.sequelizeModels) { %>let thing = Thing.bulkCreate([{<% } %>
2222
name: 'Development Tools',
2323
info: 'Integration with popular tools such as Webpack, Gulp, Babel, TypeScript, Karma, '
2424
+ 'Mocha, ESLint, Node Inspector, Livereload, Protractor, Pug, '
@@ -47,6 +47,7 @@ export default function seedDatabaseIfNeeded() {
4747
+ 'and openshift subgenerators'
4848
<% if (filters.mongooseModels) { %>});<% }
4949
if (filters.sequelizeModels) { %>}]);<% } %>
50+
return thing;
5051
})
5152
.then(() => console.log('finished populating things'))
5253
.catch(err => console.log('error populating things', err));

Diff for: templates/endpoint/basename.controller.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function respondWithResult(res, statusCode) {
2727
function patchUpdates(patches) {
2828
return function(entity) {
2929
try {
30+
// eslint-disable-next-line prefer-reflect
3031
jsonpatch.apply(entity, patches, /*validate*/ true);
3132
} catch(err) {
3233
return Promise.reject(err);
@@ -98,7 +99,7 @@ export function create(req, res) {
9899
// Upserts the given <%= classedName %> in the DB at the specified ID
99100
export function upsert(req, res) {
100101
if(req.body._id) {
101-
delete req.body._id;
102+
Reflect.deleteProperty(req.body, '_id');
102103
}
103104
<%_ if(filters.mongooseModels) { -%>
104105
return <%= classedName %>.findOneAndUpdate({_id: req.params.id}, req.body, {new: true, upsert: true, setDefaultsOnInsert: true, runValidators: true}).exec()<% } %>
@@ -115,7 +116,7 @@ export function upsert(req, res) {
115116
// Updates an existing <%= classedName %> in the DB
116117
export function patch(req, res) {
117118
if(req.body._id) {
118-
delete req.body._id;
119+
Reflect.deleteProperty(req.body, '_id');
119120
}
120121
<% if(filters.mongooseModels) { %>return <%= classedName %>.findById(req.params.id).exec()<% }
121122
if(filters.sequelizeModels) { %>return <%= classedName %>.find({

0 commit comments

Comments
 (0)