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
Merged

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

merged 3 commits into from
Jan 31, 2019

Conversation

bonbon12
Copy link
Contributor

Updating for better coding practices.

@codecov-io
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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor

@hoaianhkhang hoaianhkhang left a comment

Choose a reason for hiding this comment

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

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

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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();
Copy link
Contributor

Choose a reason for hiding this comment

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

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'];
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

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.
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

Nice!

@humphd humphd merged commit 1e660a9 into filerjs:master Jan 31, 2019
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.

4 participants