freeCodeCamp / mail-for-good

An open source email campaign management tool for nonprofits
BSD 3-Clause "New" or "Revised" License
3.83k stars 476 forks source link

ES-Lint friendly syntax fixes. #300

Open ishtms opened 6 years ago

ishtms commented 6 years ago
  1. By default, ever property is true, and you don't need to specify true. Eg. <Component something={true} /> is same as <Component something /> but in this case, es-lint won't throw warnings with airbnb's configuration.

  2. Changed an if/else logic to ternary one Which previously might give warnings with different es-lint configurations.

  3. Functions inside object with their body enclosed in { should have their fat-arrow functions enclosed in brackets. Eg - var obj = { curr: (args) => {...} } instead of var obj = { curr: args => {...} }.

  4. Fixed indentation.

  5. Arrow functions that return a JSX element without any logic, should prefer direct return instead of return inside curly braces. Check line #56

zhakk-harn commented 6 years ago

I'm alright with every point except the first one. Ultimately this repo is a freecodecamp repo, let's make stuff as clear as possible in case anyone finishing the FCC curriculum wants to jump in.

ishtms commented 6 years ago

@zhakkarn Actually, it's a good practice to use some_attr instead of some_attr={true}. I am pretty sure all campers who have reached react's curriculum are clever enough to find out if it's not mentioned in the curriculum. Anyways, do you want me to send another pull request after removing the first one?

zhakk-harn commented 6 years ago

it's a good practice

Why?

I am pretty sure all campers who have reached react's curriculum are clever enough

I am sure of it too. But the clearer the code, the faster we can move. I'd rather have the random contributor thinking about mail for good itself than React/JSX syntax. Even if it's for a handful of minutes.

do you want me to send another pull request after removing the first one?

I'm also convinced that you are clever enough to modify this pull request instead of submitting another one.