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

Code Consistency #34

Open
emilyparkes opened this issue Sep 25, 2022 · 0 comments
Open

Code Consistency #34

emilyparkes opened this issue Sep 25, 2022 · 0 comments

Comments

@emilyparkes
Copy link

emilyparkes commented Sep 25, 2022

Code Formatting

  • You need to use a linter.
  • File names need to be consistent. Use camelCase or lowercase or kebab-case. Pick one!
  • All imports, function names, line spacing etc needs to be consistent. It's a real eye sore when it's not!
    Eg:
import {addStoryApi } from '../apis/stories'

export const ADD_STORY ='ADD_STORY'
  • What does maori refer to throughout your code? The Te Reo place names? A person? A story?
  • Decide to use async await OR .then don't use a mix of methods. It makes reading code confusing when you have different code styles.
  • Remove all console.logs(). If using for errors, instead use console.error().
  • Remove all commented out code. Comments should only remain present in your main branch if they are useful for explaining the code. (Remove // Add a Story in api file, function name should explain this enough).
  • Either use api prefixes in all routes or use const rootUrl = '/api/v1/stories/' at the top of api files. Not both!
  • Seperate package and own imports at the top of your files. In App, you have blocks of mixed.
  • In Search.tsx, change the order of code inside the component to have variables and state before functions and then the return to be consistent with other components formatting.

Naming

  • In actions, what does fetchAddStory mean? Is it's purpose to get something from the backend or to post/add something to the backend.
  • In actions, you have an undefined function showError. Please remove or define.
  • In actions, what is the difference between addStory and addNewStory. Don't they do the same thing? Then pick one and use the same function in multiple places. Or clearly define how they are different.
  • In actions, some of your APIs are just called fetchStories and others are called fetchRegionsAPI should they all have API at the end or not?
  • in actions, all responses should be in the same format as regionsArr or be implied that plurals regions means an array of regions.
  • In reducers, you made variables for action names, so import those here instead of string text. This is the purpose for making them variables to start with, so when used in the reducer they match an actual action case too! :D
  switch (type) {
    case 'NAVIGATE':
      return payload
  • Also, do you need redux to navigate? Don't you have routes doing that?
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

No branches or pull requests

1 participant