browsertrix/frontend
Emma Segal-Grossman 3968928ac2
ESLint improvements & Typescript upgrade (#1501)
## Overview

Adds a bunch of ESLint rules, mostly from `typescript-eslint`, and fixes
the issues turning on these rules raises.

Also updates Typescript & typescript-eslint.

## Rationale

Most of these new rules are auto-fixable, so I've tackled a bunch of the
little fixes that do need manual intervention now with the intention
that this shouldn't add much of any additional friction in future
development work, and also give us a good bump in overall code quality.
A lot of the rules here are also great for catching potential bugs!

## Changes

- Adds `void` to most un-awaited and unhandled promises (i.e. places
where async functions are called but nothing is done with the promise)
- Converts properties that are only ever read to `readonly`
- Adds a new `isApiError` function that informs Typescript of when an
error is an `APIError`
- Adds types to a bunch of places that were previously untyped
- Changes instances of `Map<string, any>` in lit property update methods
to `PropertyValues<this>`, or sometimes `PropertyValues<this> &
Map<string, unknown>` where private or protected members are used
(`keyof` doesn't include private and protected members, unfortunately)
  - Adds types to a bunch of custom events
- Cleans up a regex by removing unnecessary escape characters
- Makes a number of implied type conversions explicit (by wrapping with
`Boolean(...)` or calling `.toString()`)
- More consistently applies type coercions when necessary, and removes
them when unnecessary
- Converts a couple const strings to an enum
- Removes the need to type debounced functions as `any` by doing type
coercions to the underlying function type at where the method is bound
to the event in the `html` block
2024-01-31 14:42:06 -05:00
..
.husky
assets
config ESLint & Typescript fixes (#1407) 2023-11-24 12:32:53 -05:00
patches Fix attribute casing & lit-analyzer issues (#1429) 2023-12-11 12:34:03 -05:00
scripts
src ESLint improvements & Typescript upgrade (#1501) 2024-01-31 14:42:06 -05:00
tests
xliff revert changes from i18n (will address elsewhere) 2023-11-13 19:36:03 -05:00
.dockerignore
.editorconfig
.eslintrc.js ESLint improvements & Typescript upgrade (#1501) 2024-01-31 14:42:06 -05:00
.gitignore
.prettierignore
.vscode add vscode config symlink in frontend dir 2023-11-20 16:56:48 -05:00
00-browsertrix-nginx-init.sh
Dockerfile
frontend.conf.template Passthrough X-Forwarded-Proto header in frontend nginx (#1226) 2023-09-28 10:58:57 -07:00
index.d.ts Org settings layout fix + misc styling & consistency improvements (#1427) 2023-12-13 17:29:35 -05:00
lit-localize.json
minio.conf
package.json ESLint improvements & Typescript upgrade (#1501) 2024-01-31 14:42:06 -05:00
playwright.config.ts
postcss.config.js Org settings layout fix + misc styling & consistency improvements (#1427) 2023-12-13 17:29:35 -05:00
README.md
sample.env.local
tailwind.config.js Refactor data table to use btrix-table component (#1474) 2024-01-28 21:17:47 -08:00
tsconfig.eslint.json ESLint & Typescript fixes (#1407) 2023-11-24 12:32:53 -05:00
tsconfig.json Fix attribute casing & lit-analyzer issues (#1429) 2023-12-11 12:34:03 -05:00
web-test-runner.config.mjs Organize components into folders by function (#1411) 2023-11-29 14:12:29 -05:00
webpack.config.js Refactor collections and browser profile data-tables (#1505) 2024-01-30 19:46:42 -08:00
webpack.dev.js build: disable webpack polling for hot reload 2023-09-18 15:14:34 -07:00
webpack.prod.js Improvements to collection creation and editing flow (#1424) 2023-12-19 18:12:43 -08:00
yarn.lock ESLint improvements & Typescript upgrade (#1501) 2024-01-31 14:42:06 -05:00