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

Standardize code formatting #378

Merged
merged 4 commits into from
Aug 20, 2019
Merged

Conversation

sashadev-sky
Copy link
Member

@sashadev-sky sashadev-sky commented Aug 11, 2019

Fixes #0000 (<=== Add issue number here)

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with grunt
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updates
  • @mention the original creator of the issue in a comment below for help or for a review

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

formatting:

  • 2 space indents
  • single quotes

@sashadev-sky
Copy link
Member Author

@rexagod im going to standardize the code formatting so that all src files use 2 space indent, and all test files use 4 space indent, because right now it is not standard for every file.
Do you like this idea? I have only done 1 file so far but if you approve i'll update the rest

@rexagod
Copy link
Member

rexagod commented Aug 12, 2019

Sounds good! And what are your thoughts on using a linter to enforce such style in the future? We can add --fix flag at runtime to auto-format all files to this particular style at build.

Or better yet, use husky to add pre-commit hooks that check linting? That should automate the formatting stuff for us.

@sashadev-sky
Copy link
Member Author

@rexagod Ok that sounds like a much better idea than this PR do you want to open one with Husky?

@rexagod
Copy link
Member

rexagod commented Aug 13, 2019

@sashadev-sky On it!

@rexagod
Copy link
Member

rexagod commented Aug 13, 2019

Okay just a question before I push on this, do you want to apply linting only for the spacing stuff, or do you think it'd be better to apply an already existing linting style to this lib?

@sashadev-sky
Copy link
Member Author

@rexagod oh really good idea!! I tend to look up google's style guide for best practice, but if you have experience with using a particular one and prefer it let's use that! Also don't know the diff but in the past Airbnb style guide was recommended to me.

This is actually an important maintenance move that i've been thinking we should do for a while so glad we're getting to it

@rexagod
Copy link
Member

rexagod commented Aug 14, 2019

@sashadev-sky --fix fixed most of the errors while 441 of them required manual attention. So I've fixed them up now, and added 23 of them to warnings for later.

x

Also, I would recommend you to install the eslint extension so that you can easily see the errors/warnings as you type.

lint

@rexagod
Copy link
Member

rexagod commented Aug 14, 2019

Actually let me just fix those warnings too.

@rexagod
Copy link
Member

rexagod commented Aug 14, 2019

Done!

@sashadev-sky
Copy link
Member Author

@rexagod awesme im gonna pull this and check it out. i guess i will rebase it to because that was all me.. 😫

@sashadev-sky
Copy link
Member Author

@rexagod wait how are you using let and const everywhere? isnt that only for ES6

@sashadev-sky
Copy link
Member Author

@rexagod tests are not passing.

image

I believe this is due to your usage of let and const. I have tripped over this to a few times in this lib we can only use var until make ES6 compatible.

@rexagod rexagod added this to the Version 1.0.0 Release milestone Aug 17, 2019
@rexagod
Copy link
Member

rexagod commented Aug 17, 2019

@sashadev-sky Check now.

@sashadev-sky
Copy link
Member Author

@rexagod ok awesome! Thank you!!! I am going to rebase and merge this an open a follow-up about some questions I have

node_modules
test/src/util
test/src/*Spec.js
Gruntfile.js
Copy link
Member Author

Choose a reason for hiding this comment

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

Why do we want to be ignoring Gruntfile.js?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ohh its .eslintignore gotchya

@sashadev-sky
Copy link
Member Author

actually @rexagod I left a review comment that I would like to address quickly before merge

@sashadev-sky
Copy link
Member Author

Ok this is ready! Disregard last comment. I'll open the follow up :)

@sashadev-sky sashadev-sky merged commit a980773 into publiclab:main Aug 20, 2019
sashadev-sky added a commit that referenced this pull request Sep 15, 2019
* single space code

* added lint hooks

* format files

* fix tests
themacboy pushed a commit to themacboy/Leaflet.DistortableImage that referenced this pull request Sep 19, 2019
* single space code

* added lint hooks

* format files

* fix tests
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.

2 participants