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

Fix eslint issues #33

Merged
merged 11 commits into from
Nov 15, 2019
Merged

Conversation

skathuria29
Copy link
Contributor

@skathuria29 skathuria29 commented Oct 27, 2019

Description

Fixed eslint global-require rule - did changes in 2 files: keygen.js and showkey.js.
Fixed eslint no-param-reassign rule - it required changes in: create.js and keys.js.
Fixed eslint no-unused-vars rule - required changes in create.js, index.js and start.js.
Fixed eslint one-var and prefer-const rule - by changing start.js.
Fixed eslint no-use-before-define rule - did changes in start.js.
Fixed eslint consistent-return rule - required changes in the following files keygen.js, showkey.js, start.js and keys.js.

Motivation and Context

Fixed eslint errors #16

How Has This Been Tested?

npm run test command

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@NicolasRitouet
Copy link
Member

hi @skathuria29
Thanks a lot for your proposal.
The build is breaking because it seems that yarn doesn't support node 5.
2 options:

  • we drop support for node < 6 (we could also support only LTS versions)
  • we use an old version of yarn

I'm in favor of first option, but I don't want to take the decision by myself.
@deployd/developers any opinion?

@andreialecu
Copy link
Contributor

Dropping support for node <6 should be fine, it's quite old by this point anyway. I'm in favor.

@skathuria29
Copy link
Contributor Author

skathuria29 commented Oct 29, 2019

Ohh I thought the build was failing because of my changes. This was my first time contributing to an open source project. Please review the changes and let me know if it requires any further modifications. Thanks and I would be happy to contribute more 😄 @NicolasRitouet

@NicolasRitouet
Copy link
Member

@skathuria29
Since we agreed to get rid of support for node <6, you need to remove this on the config file for travis ci:
https://github.com/deployd/deployd-cli/blob/master/.travis.yml
The last two lines need to be deleted.

@NicolasRitouet NicolasRitouet self-requested a review November 4, 2019 08:38
name = name || 'my-deployd-app';
if (test('-d', name)) {
return console.info(`${name} already exists in this directory`);
const newName = name || 'my-deployd-app';
Copy link
Member

Choose a reason for hiding this comment

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

naming a variable new is not recommended because something new at the time of writing won't probably stay new for a long time. (I remember an api I encountered at a customer called newCustomerApi built in 2003... Not so new anymore, but still around).
In this particular case, I'd rather change the name of the param with something like _name and keep the name of the variable used in the function name. It makes reading the code in the function easier (remember, when writing code, you want to reduce cognitive complexity

const create = function (_name) {
  const name= _name || 'my-deployd-app';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense. Please review the changes I've made with respect to renaming the variable and changing the warnings to error in eslintrc.
I've kept the import/no-dynamic-require in /.eslintrc.js as a warning as I wasn't able to fix it.

@NicolasRitouet
Copy link
Member

@skathuria29 looks great.
I've added one comment regarding the name of a variable, but the rest is good.
If there's no error anymore in eslint, you should be able to change the eslint rules to errors instead of warning:

"no-unused-vars": 1, // 3 errors

"no-unused-vars": 1, // 3 errors should be `"no-unused-vars": "error" (same for other rules)

.eslintrc.js Outdated
"consistent-return": 1, // 8 errors
"no-param-reassign": 1, // 2 errors
"global-require": 1, // 2 errors
"prefer-const": "error", // 4 errors
Copy link
Member

Choose a reason for hiding this comment

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

can you also remove the comments (on each line) as they are not accurate anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Fixed.

@NicolasRitouet
Copy link
Member

hi @skathuria29 looks great!
Can you just remove the comments and then, it's good to be merged :)

Copy link
Member

@NicolasRitouet NicolasRitouet left a comment

Choose a reason for hiding this comment

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

Great Work @skathuria29

Thanks a lot for your PR 👍

@NicolasRitouet NicolasRitouet merged commit d69eb13 into deployd:master Nov 15, 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.

3 participants