For-Science / Crypto-For-Science

Crypto For Science is a crowdfunding platform that uses the spirit of cryptocurrency in order to fund scientific research: no fees and no intermediaries - all the funds go directly to the researchers.
MIT License
20 stars 6 forks source link

Use eslint for consistent styles #3

Closed dweipert-3138720606 closed 1 year ago

dweipert-3138720606 commented 6 years ago

With increasing contributors comes an increasing number of different ways to write code ofc. So it'd probably be best to use something like eslint to keep the coding style consistent and to make it easier to do so.

We can either just use one of the reccommended/more popular rule-sets or reflect the project's current style with custom rules. What would you prefer?

Laurentiu-Andronache commented 6 years ago

Maybe go with this one?

https://www.npmjs.com/package/eslint-config-airbnb

dweipert-3138720606 commented 6 years ago

They suggest to use their base config here if you don't need the React stuff https://www.npmjs.com/package/eslint-config-airbnb-base

We can lint the template files as well but before we can do that we have to do the switch from jade to pug, because jade and everything regarding it is actually deprecated since 2016. https://pugjs.org/api/migration-v2.html

// EDIT: Just found this: https://www.npmjs.com/package/eslint-plugin-meteor Oh and in the official documentation they mention it as well! https://guide.meteor.com/code-style.html#eslint-installing

LDubya commented 6 years ago

No problem switching over to a pug compiler if there's an easy way to do it.

As for the Jade package being used, it is Jade by name but it is using the pug syntax referenced in the link:

So switching over to a pug compiler wouldn't require much refactoring of the UI, depending on the compiler. Just a question of availability. There were no maintained pug compilers for Meteor (or even any with visible users), and I'm not sure how much effort it takes to roll your own. However the Meteor-Jade package had a visible user base, which suggested it was stable enough for basic usage.

As an alternative, we could just choose not to run the jade files through a linter. Jade/Pug already has a lot of requirements as far as structure goes (mandatory indentation, can't use tabs and spaces in the same file, etc); In that regard it kind has its own built-in linting. It won't compile successfully unless it's following a specific structure.

dweipert-3138720606 commented 6 years ago

Oh okay, thanks for the clarification. Then I'd say we ditch the Jade linting.

I tried different recommended eslint rule configs and so far the eslint-plugin-meteor recommendation with

"extends": ["eslint:recommended", "plugin:meteor/recommended"]

seems to be the the one that causes the least disruption to the current code base haha

LDubya commented 6 years ago

Nice. Would you be willing to submit a pull request for us to $ meteor npm install and try out? That way we'll make you a member of the GitHub organization, too, if you want, =D

dweipert-3138720606 commented 6 years ago

Yes of course, the Pull Request is in process, I'll refine and push it as soon as I find the time!

I wouldn't say no to being a member. =D

Laurentiu-Andronache commented 6 years ago

I sent the invite.

Laurentiu-Andronache commented 6 years ago

Daniel, please make your membership public from here https://github.com/orgs/For-Science/people (or a tutorial here if you don't find the button https://help.github.com/articles/publicizing-or-hiding-organization-membership/). Otherwise, you won't show up for others in the People tab.