Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

ES-Lint friendly syntax fixes. #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ishtms
Copy link
Contributor

@ishtms ishtms commented Jul 17, 2018

  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 Staging #56

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 freeCodeCamp#56
@zhakk-harn
Copy link
Contributor

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
Copy link
Contributor Author

ishtms commented Jul 21, 2018

@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
Copy link
Contributor

zhakk-harn commented Jul 21, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants