Skip to content

Resolve all Warnings and Deprecated Messages with Default Configuration. #2536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 10, 2017
Merged

Resolve all Warnings and Deprecated Messages with Default Configuration. #2536

merged 12 commits into from
Apr 10, 2017

Conversation

benmarten
Copy link
Contributor

@benmarten benmarten commented Apr 7, 2017

This PR fixes all warnings and linter errors plus deprecated warnings with the default configuration when installing via yo.

Before:

~/d/test $ gulp serve                                                                                                                          13:51:15
[13:53:48] Requiring external module babel-register
[13:53:50] Using gulpfile ~/dev/test/gulpfile.babel.js
[13:53:50] Starting 'serve'...
[13:53:50] Starting 'clean:tmp'...
[13:53:50] Starting 'lint:scripts'...
[13:53:50] Starting 'lint:scripts:client'...
[13:53:50] Starting 'lint:scripts:server'...
[13:53:50] Starting 'inject'...
[13:53:50] Starting 'inject:scss'...
[13:53:50] Starting 'copy:fonts:dev'...
[13:53:50] Starting 'env:all'...
[13:53:50] Finished 'env:all' after 8.36 ms
[13:53:50] Finished 'clean:tmp' after 52 ms
[13:53:51] gulp-inject 4 files into app.scss.
[13:53:51] Finished 'inject:scss' after 634 ms
[13:53:51] Finished 'inject' after 635 ms
[13:53:53] 
/Users/ben/dev/test/server/index.js
  4:11  warning  Unexpected use of process.env  no-process-env
  4:34  warning  Unexpected use of process.env  no-process-env

/Users/ben/dev/test/server/config/express.js
  67:25  warning  Unexpected use of process.env  no-process-env

/Users/ben/dev/test/server/api/thing/thing.controller.js
   29:7  warning  Avoid using Function.prototype.apply, instead use Reflect.apply     prefer-reflect
   91:5  warning  Avoid using the delete keyword, instead use Reflect.deleteProperty  prefer-reflect
  102:5  warning  Avoid using the delete keyword, instead use Reflect.deleteProperty  prefer-reflect

/Users/ben/dev/test/server/api/user/user.model.js
  163:15  warning  Use the rest parameters instead of 'arguments'  prefer-rest-params
  164:18  warning  Use the rest parameters instead of 'arguments'  prefer-rest-params
  166:22  warning  Use the rest parameters instead of 'arguments'  prefer-rest-params
  167:18  warning  Use the rest parameters instead of 'arguments'  prefer-rest-params
  207:14  warning  Unexpected sync method: 'pbkdf2Sync'            no-sync

✖ 11 problems (0 errors, 11 warnings)

[13:53:53] Finished 'lint:scripts:server' after 2.48 s
[13:53:53] Finished 'copy:fonts:dev' after 2.48 s
[13:53:53] 
/Users/ben/dev/test/client/components/auth/auth.service.js
  118:19  error    '_' is not defined                                               no-undef
  148:20  error    '_' is not defined                                               no-undef
  161:16  error    '_' is not defined                                               no-undef
  174:29  error    '_' is not defined                                               no-undef
  188:22  error    '_' is not defined                                               no-undef
  199:30  warning  Avoid using Function.prototype.apply, instead use Reflect.apply  prefer-reflect
  199:57  warning  Use the rest parameters instead of 'arguments'                   prefer-rest-params
  208:14  warning  Unexpected sync method: 'hasRoleSync'                            no-sync

/Users/ben/dev/test/client/components/modal/modal.service.js
  42:22  warning  Avoid using Function.prototype.call, instead use Reflect.apply   prefer-reflect
  42:49  warning  Use the rest parameters instead of 'arguments'                   prefer-rest-params
  68:13  warning  Avoid using Function.prototype.apply, instead use Reflect.apply  prefer-reflect

✖ 11 problems (5 errors, 6 warnings)

[13:53:53] Finished 'lint:scripts:client' after 2.61 s
[13:53:53] Finished 'lint:scripts' after 2.61 s
[13:53:53] Starting 'start:server'...
[13:53:53] Finished 'start:server' after 31 ms
[13:53:53] Starting 'start:client'...
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/ben/dev/test/server/**/*
[nodemon] starting `node server`
Express server listening on 9000, in development mode
(node:30810) Warning: a promise was created in a handler at Users/ben/dev/test/server/config/seed.js:15:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/Users/ben/dev/test/node_modules/bluebird/js/release/promise.js:79:10)
finished populating things
[13:53:55] Finished 'start:client' after 2.65 s
[13:53:55] Starting 'watch'...
Error: ENOENT: no such file or directory, stat '/Users/ben/dev/test/client/index.html'
    at Error (native)
(node:30810) DeprecationWarning: Implicit async custom validators (custom validators that take 2 arguments) are deprecated in mongoose >= 4.9.0. See http://mongoosejs.com/docs/validation.html#async-custom-validators for more info.
[13:53:55] Finished 'watch' after 19 ms
[13:53:55] Finished 'serve' after 5.32 s
[BS] Proxying: http://localhost:9000
[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://172.16.30.161:3000
 --------------------------------------
          UI: http://localhost:3002
 UI External: http://172.16.30.161:3002
 --------------------------------------
GET / 404 77.588 ms - 256
Error: ENOENT: no such file or directory, stat '/Users/ben/dev/test/client/index.html'
    at Error (native)
webpack: wait until bundle finished: /
webpack: wait until bundle finished: /api/things
GET / 404 80.174 ms - 256
(node:30810) DeprecationWarning: crypto.pbkdf2 without specifying a digest is deprecated. Please specify a digest
finished populating users
webpack done hook
Hash: d93be40989397afa7944
Version: webpack 1.14.0
Time: 9031ms
                  Asset     Size  Chunks             Chunk Names
          app.bundle.js   432 kB       0  [emitted]  app
    polyfills.bundle.js   206 kB       1  [emitted]  polyfills
       vendor.bundle.js  2.56 MB       2  [emitted]  vendor
      app.bundle.js.map   537 kB       0  [emitted]  app
polyfills.bundle.js.map   267 kB       1  [emitted]  polyfills
   vendor.bundle.js.map  2.98 MB       2  [emitted]  vendor
   ../client/index.html  1.39 kB          [emitted]  
Child html-webpack-plugin for "../client/index.html":
                   Asset     Size  Chunks       Chunk Names
    ../client/index.html  2.69 kB       0       
webpack: Compiled successfully.
webpack: Compiling...
webpack: wait until bundle finished: /vendor.bundle.js
webpack: wait until bundle finished: /polyfills.bundle.js
webpack: wait until bundle finished: /app.bundle.js
GET /api/things 200 37.459 ms - -
webpack done hook
Hash: d93be40989397afa7944
Version: webpack 1.14.0
Time: 141ms
                  Asset     Size  Chunks       Chunk Names
          app.bundle.js   432 kB       0       app
    polyfills.bundle.js   206 kB       1       polyfills
       vendor.bundle.js  2.56 MB       2       vendor
      app.bundle.js.map   537 kB       0       app
polyfills.bundle.js.map   267 kB       1       polyfills
   vendor.bundle.js.map  2.98 MB       2       vendor
Child html-webpack-plugin for "../client/index.html":
                   Asset     Size  Chunks       Chunk Names
    ../client/index.html  2.69 kB       0       
webpack: Compiled successfully.
GET /api/things 304 8.077 ms - -
SocketIO / [127.0.0.1:54113] CONNECTED
GET /api/things 200 27.163 ms - -

After:

~/d/test $ gulp serve                                                                                                                          13:47:13
[13:47:19] Requiring external module babel-register
[13:47:21] Using gulpfile ~/dev/test/gulpfile.babel.js
[13:47:21] Starting 'serve'...
[13:47:21] Starting 'clean:tmp'...
[13:47:21] Starting 'lint:scripts'...
[13:47:21] Starting 'lint:scripts:client'...
[13:47:21] Starting 'lint:scripts:server'...
[13:47:21] Starting 'inject'...
[13:47:21] Starting 'inject:scss'...
[13:47:21] Starting 'copy:fonts:dev'...
[13:47:21] Starting 'env:all'...
[13:47:21] Finished 'env:all' after 4.72 ms
[13:47:21] Finished 'clean:tmp' after 50 ms
[13:47:21] gulp-inject 4 files into app.scss.
[13:47:21] Finished 'inject:scss' after 660 ms
[13:47:21] Finished 'inject' after 661 ms
[13:47:23] Finished 'lint:scripts:server' after 2.45 s
[13:47:23] Finished 'copy:fonts:dev' after 2.44 s
[13:47:23] Finished 'lint:scripts:client' after 2.61 s
[13:47:23] Finished 'lint:scripts' after 2.61 s
[13:47:23] Starting 'start:server'...
[13:47:23] Finished 'start:server' after 13 ms
[13:47:23] Starting 'start:client'...
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/ben/dev/test/server/**/*
[nodemon] starting `node server`
Express server listening on 9000, in development mode
[13:47:25] Finished 'start:client' after 2.11 s
[13:47:25] Starting 'watch'...
[13:47:25] Finished 'watch' after 21 ms
[13:47:25] Finished 'serve' after 4.76 s
[BS] Proxying: http://localhost:9000
[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://172.16.30.161:3000
 --------------------------------------
          UI: http://localhost:3002
 UI External: http://172.16.30.161:3002
 --------------------------------------
webpack: wait until bundle finished: /
webpack: wait until bundle finished: /api/things
finished populating things
finished populating users
webpack done hook
Hash: 81e3d5d0b4dde6e61b79
Version: webpack 1.14.0
Time: 9143ms
                  Asset     Size  Chunks             Chunk Names
          app.bundle.js   435 kB       0  [emitted]  app
    polyfills.bundle.js   206 kB       1  [emitted]  polyfills
       vendor.bundle.js  2.56 MB       2  [emitted]  vendor
      app.bundle.js.map   540 kB       0  [emitted]  app
polyfills.bundle.js.map   267 kB       1  [emitted]  polyfills
   vendor.bundle.js.map  2.98 MB       2  [emitted]  vendor
   ../client/index.html  1.39 kB          [emitted]  
Child html-webpack-plugin for "../client/index.html":
                   Asset     Size  Chunks       Chunk Names
    ../client/index.html  2.69 kB       0       
webpack: Compiled successfully.
webpack: Compiling...
webpack: wait until bundle finished: /vendor.bundle.js
webpack: wait until bundle finished: /polyfills.bundle.js
webpack: wait until bundle finished: /app.bundle.js
GET /api/things 200 38.965 ms - -
webpack done hook
Hash: 81e3d5d0b4dde6e61b79
Version: webpack 1.14.0
Time: 137ms
                  Asset     Size  Chunks       Chunk Names
          app.bundle.js   435 kB       0       app
    polyfills.bundle.js   206 kB       1       polyfills
       vendor.bundle.js  2.56 MB       2       vendor
      app.bundle.js.map   540 kB       0       app
polyfills.bundle.js.map   267 kB       1       polyfills
   vendor.bundle.js.map  2.98 MB       2       vendor
Child html-webpack-plugin for "../client/index.html":
                   Asset     Size  Chunks       Chunk Names
    ../client/index.html  2.69 kB       0       
webpack: Compiled successfully.
GET /api/things 304 7.036 ms - -
SocketIO / [127.0.0.1:53908] CONNECTED
GET /api/things 200 24.486 ms - -

@@ -82,7 +82,7 @@
"no-octal-escape": 0, //disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
"no-octal": 0, //disallow use of octal literals
"no-param-reassign": 0, //disallow reassignment of function parameters
"no-process-env": 1, //disallow use of process.env
"no-process-env": 0, //allow use of process.env
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comments are for when the rules are enabled, so they shouldn't be changed

<%_ if(filters.auth) { _%>
// eslint-disable-next-line no-unused-vars
import ngValidationMatch from 'angular-validation-match';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should instead just be changed to

import 'angular-validation-match';

@@ -1,3 +1,4 @@
/*global _*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should instead do this:

import _ from 'lodash';

@benmarten
Copy link
Contributor Author

Wasn't sure if I should have fixed the commits to the original commits, I pushed them for now... Let me know if I should do that, then I can forcepush again ;)
Also wasn't sure if I was splitting in to many commits or if its fine like this ;) Lmk....

@benmarten
Copy link
Contributor Author

Tested again, works.

I noticed on very first run of gulp serve these warnings appear:

[20:18:31] Starting 'watch'...
Error: ENOENT: no such file or directory, stat '/Users/ben/dev/test/client/index.html'
    at Error (native)
[20:18:31] Finished 'watch' after 19 ms
[20:18:31] Finished 'serve' after 6.42 s
[BS] Proxying: http://localhost:9000
[BS] Access URLs:
 ------------------------------------
       Local: http://localhost:3000
    External: http://192.168.1.5:3000
 ------------------------------------
          UI: http://localhost:3002
 UI External: http://192.168.1.5:3002
 ------------------------------------
Error: ENOENT: no such file or directory, stat '/Users/ben/dev/test/client/index.html'
    at Error (native)
finished populating things

Any idea where Error: ENOENT: no such file or directory, stat '/Users/ben/dev/test/client/index.html' at Error (native) comes from? I could try to resolve them too, very minor though, since they disappear after first start ;)

@Awk34
Copy link
Member

Awk34 commented Apr 10, 2017

I believe the ENOENT is when it starts trying to serve the index.html before it has been rendered by the webpack HTML plugin, from the _index.html template

@Awk34 Awk34 merged commit eac6992 into angular-fullstack:master Apr 10, 2017
@Awk34
Copy link
Member

Awk34 commented Apr 10, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants