Skip to content
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

Fixed #699 Replacing var with let/const and adding strict mode #706

Merged
merged 3 commits into from Jan 31, 2019

Conversation

Projects
None yet
4 participants
@bonbon12
Copy link
Contributor

bonbon12 commented Jan 29, 2019

Updating for better coding practices.

bonbon12 added some commits Jan 29, 2019

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jan 29, 2019

Codecov Report

Merging #706 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #706   +/-   ##
=======================================
  Coverage   86.71%   86.71%           
=======================================
  Files          16       16           
  Lines        1746     1746           
=======================================
  Hits         1514     1514           
  Misses        232      232
Impacted Files Coverage Δ
src/shell/environment.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26b47ee...55dd7e5. Read the comment docs.

@@ -241,7 +242,7 @@ describe('path resolution', function() {
});

it('should properly remove trailing slashes with Path.removeTrailing()', function() {
var Path = Filer.Path;
let Path = Filer.Path;

This comment has been minimized.

@hoaianhkhang

hoaianhkhang Jan 31, 2019

Contributor
Suggested change
let Path = Filer.Path;
const Path = Filer.Path;

Great job with the code, I just think that since path wont be changing later on, you should put it const instead of let.

@@ -232,7 +233,7 @@ describe('path resolution', function() {
});

it('should properly add trailing slashes with Path.addTrailing()', function() {
var Path = Filer.Path;
let Path = Filer.Path;

This comment has been minimized.

@hoaianhkhang

hoaianhkhang Jan 31, 2019

Contributor

I think this is the same with the previous one, the path should be a const because It will not be used later on

@hoaianhkhang
Copy link
Contributor

hoaianhkhang left a comment

Overall you work was great, I just gave some of my opinion about changing your code a bit, cheers.

@humphd
Copy link
Contributor

humphd left a comment

This is looking great. You can further improve this with the use of const throughout.


// Support global URL and node's url module
var URL = global.URL || require('url').URL;
let URL = global.URL || require('url').URL;

This comment has been minimized.

@humphd

humphd Jan 31, 2019

Contributor

This can be const, it won't change.


describe('path resolution', function() {
beforeEach(util.setup);
afterEach(util.cleanup);

it('should follow a symbolic link to the root directory', function(done) {
var fs = util.fs();
let fs = util.fs();

This comment has been minimized.

@humphd

humphd Jan 31, 2019

Contributor

const here too, since fs will always be the same for this block.

@@ -19,7 +20,7 @@ describe('path resolution', function() {
if(error) throw error;

expect(result['node']).to.exist;
var _node = result['node'];
let _node = result['node'];

This comment has been minimized.

@humphd

humphd Jan 31, 2019

Contributor

Same thing here. In fact, I don't think I see any let below that can't become a const. Do you want to try changing them all, and see what eslint and the tests say?

Updated path-resolution.spec.js
Upon review and further inspection, there was a realization that there was need for the "let" variable as all variable were not modified.
Instead, "const" was used.
@humphd

humphd approved these changes Jan 31, 2019

Copy link
Contributor

humphd left a comment

Nice!

@humphd humphd merged commit 1e660a9 into filerjs:master Jan 31, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.