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

(TypeScript) Enforce source order #281

Open
mcmire opened this issue Apr 11, 2023 · 0 comments
Open

(TypeScript) Enforce source order #281

mcmire opened this issue Apr 11, 2023 · 0 comments

Comments

@mcmire
Copy link
Contributor

mcmire commented Apr 11, 2023

To make files look the same, we should enforce the following order:

  1. Types
  2. Enums
  3. Constants
  4. Functions

In test files, the order should look like this:

  1. Module mocks (using jest.mock)
  2. Typed module mocks (using jest.mocked)
  3. Types
  4. Enums
  5. Constants
  6. Tests
  7. Functions

In some cases, a file may be so long that the author may wish to locate a type next to the place in which it's used, such as options for a function. Instead of doing this, this should act as a code smell and should indicate that we ought to move the function along with its type to a separate file.

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