diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ee1eda..5b2b43f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,8 @@ jobs: source .venv/bin/activate pre-commit run --all deactivate + - name: Run frontend tests + run: npm run test-ci - name: Run python tests run: | source .venv/bin/activate diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5524fe6..4feeb65 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,21 @@ repos: + # Run `npm run lint` + - repo: local + hooks: + - id: jslint + name: jslint + entry: npm run lint + language: system + files: \.(ts|tsx|js|jsx)$ + + - repo: local + hooks: + - id: tsc + name: tsc + entry: npm run type-check + language: system + pass_filenames: false + - repo: https://github.com/psf/black rev: 23.11.0 hooks: diff --git a/README.md b/README.md index 3265bc8..d69f3b3 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,23 @@ Details on the FEC data schema: https://www.fec.gov/campaign-finance-data/contri We're using `python 3.12`. Modern Macs have `clang >= 15.x` (mine has `17.0.4`). Alas, a transitive dependency (`multidict`) is currently broken in this environment and, also, does not ship binary wheels. Here's my solution: https://github.com/aio-libs/multidict/pull/877#issuecomment-1812948387 + +### Running locally + +You'll need the sqlite databases, of course (ask Dave). + +Then, you'll need to install the dependencies: + +``` +npm install +CFLAGS="-Wno-error=int-conversion" pip install -r requirements.txt +pip install -r requirements-dev.txt +``` + +Then, you'll need to run both the Vite front-end server AND the python+litestar backend server: + +``` +./scripts/run.sh +``` + +Pop open http://localhost:2222/ and you should see the app. diff --git a/index.html b/index.html index e4b78ea..7014c3e 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,21 @@ -
- - - -