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

[SUGGESTION]: Use src/ folder on frontend #219

Merged
merged 9 commits into from
Jun 6, 2022
Merged

Conversation

dsousa12
Copy link
Contributor

Relates to #218

Proposed Changes

  • Create src/ folder;
  • Set baseUrl as src/ on tsconfig to clean imports;
  • Update import organizer and other configs on .eslintrc

Folder Structure on root

.
├── cypress
├── docker
├── node_modules
├── public
└── src

This pull request closes #218

@dsousa12 dsousa12 requested a review from a team May 31, 2022 16:27
@dsousa12 dsousa12 self-assigned this May 31, 2022
@dsousa12
Copy link
Contributor Author

dsousa12 commented May 31, 2022

@xgeekshq/d-c-frontend please review this structure and see if make senses for you.
My idea is to avoid more imports like:

import { getAuthError } from '../../../errors/auth-messages';
import useUser from '../../../hooks/useUser';
import SchemaLoginForm from '../../../schema/schemaLoginForm';
import { toastState } from '../../../store/toast/atom/toast.atom';
import { LoginUser } from '../../../types/user/user';

Other thing, please if you can test the eslint configurations and see if everything feels ok for you. I make some changes to have imports organized this way:

  1. packages (react, nest,...)
  2. files from styles folder (like stitches and others)
  3. other files (components, ...)
  4. last the sass/css/scss files (in case some day have any file of this type)

@tiagomichaelsousa
Copy link
Contributor

The idea here is to avoid long path imports? If so, instead of changing the entire folder structure for the project I would suggest creating aliases like "@hooks": ["src/hooks"] and them like:

import useUser from '@hooks/useUser';

@dsousa12
Copy link
Contributor Author

dsousa12 commented Jun 3, 2022

The idea here is to avoid long path imports? If so, instead of changing the entire folder structure for the project I would suggest creating aliases like "@hooks": ["src/hooks"] and them like:

import useUser from '@hooks/useUser';

It's an alternative.
I personally prefer using the src/ folder to avoid a longer root folder, but if you prefer that approach I can close this pull request, and create a new one with aliases

@tiagomichaelsousa
Copy link
Contributor

The idea here is to avoid long path imports? If so, instead of changing the entire folder structure for the project I would suggest creating aliases like "@hooks": ["src/hooks"] and them like:

import useUser from '@hooks/useUser';

It's an alternative. I personally prefer using the src/ folder to avoid a longer root folder, but if you prefer that approach I can close this pull request, and create a new one with aliases

sorry I didn't notice that we don't have an src folder! Im totally up for it as it keeps the root cleaner 🧹
we can still use both approaches and add the aliases but let's get things separated and create another issue/pr with it

@dsousa12 dsousa12 merged commit 27cc37d into main Jun 6, 2022
@dsousa12 dsousa12 deleted the suggestion-src-folder branch June 6, 2022 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SUGGESTION]: Use src/ folder on frontend
2 participants