mail-for-good icon indicating copy to clipboard operation
mail-for-good copied to clipboard

ES-Lint friendly syntax fixes.

Open ishtms opened this issue 7 years ago • 3 comments

  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

ishtms avatar Jul 17 '18 06:07 ishtms

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.

zhakk-harn avatar Jul 19 '18 23:07 zhakk-harn

@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?

ishtms avatar Jul 21 '18 07:07 ishtms

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.

zhakk-harn avatar Jul 21 '18 15:07 zhakk-harn