Skip to content
This repository was archived by the owner on Dec 3, 2017. It is now read-only.
This repository was archived by the owner on Dec 3, 2017. It is now read-only.

Suggestions for a healthy codebase #48

@lsjroberts

Description

@lsjroberts

It's great seeing so many people contribute to the project, and it's refreshing for me to work on something without all the burden of external frameworks and dependencies. But I think there are a few things we could do to make it easier to maintain and to help new folks get involved (from a code point of view).

It may feel a little early to start looking at this stuff, but it's easier to adjust now before it becomes unwieldy and requires major refactoring.

Please discuss :) I'm not just doing them immediately as there are many other valid opinions.

Consistent code style with prettier

Prettier is an amazing tool to help keep your code clean and consistent. It can help when reading the code, and prevent any disagreements if you leave the way it looks up to a tool.

It can be setup to run in a couple of different ways:

Separating the logic and view layers

Essentially you have all your code that does things like get the data from the archives, mutate it however etc in one place, and all your code that renders it into the dom in another place. This helps in both the reading and understanding of the code, but also prevents a lot bugs, duplication of code, ease of testing, adding new features and performance optimisation.

We definitely do not need any external libraries like this, and to keep it simple I'd suggest not unless we really feel we need to. (You may have heard of Redux (data) and React (view)).

Adding tests

Once the data logic is separated it is pretty easy to test it. We wouldn't need too much testing but it'd help us be confident in new PRs and prevent bugs.

There's a bunch of libraries for this but I've found the most success with Jest.

Automating tests with CI

I suggest we could use Travis CI for this. It is free for open source projects and very easy to setup and use.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions