expo / expo-2d-context

A pure-js implementation of the W3C's Canvas-2D Context API that can be run on either Expo Graphics or WebGL
111 stars 7 forks source link

[style] Set up Prettier and ESLint #17

Closed ide closed 3 years ago

ide commented 3 years ago

Why

The code was previously unlinted and had a few unused variables, loose comparators, and uses of var that could easily be let. Running the linter and Prettier over the code will make it easier to keep consistent.

How

Installed Prettier, ESLint, and eslint-config-universe. Added eslintConfig and prettier to package.json to configure them. For now, we use the "shared/core" and "shared/prettier" ESLint configurations in order to exclude the TypeScript configuration, since this library doesn't use TS.

I also moved the source code under src so that the linter could easily target that one directory. This will also make it easier to set up TypeScript if we do that one day.

Also added a linter check to CI.

Test Plan

Ran npm test to make sure the local tests in this repo pass. Also used an example project from https://github.com/iddan/expo-2d-context-test.git with the expo-2d-context dependency pointed at my local repo to ensure it works in a real Expo app via Expo CLI and Expo Go.

Verify that CI passes.