Update NPM packaging, linting, and a bunch of types (#275)
Preparation for https://github.com/webrecorder/archiveweb.page/issues/198 / https://github.com/webrecorder/archiveweb.page/pull/199. ## Changes - Organizes published files more cleanly, using `dist/types` folder as the target for type declarations and sourcemaps - Configures type field in `package.json` - Updates ESLint & its config - Sets up type-informed linting rules mirroring browsertrix - Adds a bunch of other useful eslint and eslint-typescript rules, and applies auto-fixes to the codebase - Cleans up a bunch of types throughout the codebase, particularly parts of the code used by ArchiveWebPage - Changes `ItemIndex#_deleting` from `private` to `protected` so that a part of AWP that extends it can do so properly - Makes a bunch of previously-implied [non-null assertions](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-) explicit - Updates `URLResource` and `ItemType` types (and renames `Item` → `ItemType` to disambiguate from the `Item` class) - Removes `node-sass` and replaces it with `sass-embedded` for much quicker installs and compilation
This commit is contained in:
+22
-6
@@ -1,4 +1,21 @@
|
||||
export interface Item {
|
||||
export type URLResource = {
|
||||
id: number;
|
||||
title: string;
|
||||
url: string;
|
||||
mime: string;
|
||||
status: string;
|
||||
date: Date;
|
||||
ts: string;
|
||||
desc?: string;
|
||||
timestamp?: string;
|
||||
size: number;
|
||||
favIconUrl: string;
|
||||
text?: string;
|
||||
};
|
||||
|
||||
export type Page = URLResource;
|
||||
|
||||
export type ItemType = {
|
||||
filename: string;
|
||||
sourceUrl: string;
|
||||
replayPrefix: string;
|
||||
@@ -26,11 +43,10 @@ export interface Item {
|
||||
software?: string;
|
||||
};
|
||||
onDemand?: boolean;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO fixme
|
||||
pages?: any[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO fixme
|
||||
lists?: any[];
|
||||
pages: URLResource[];
|
||||
curatedPages: (URLResource & { list: string })[];
|
||||
lists: URLResource[];
|
||||
ctime?: string;
|
||||
totalSize?: unknown;
|
||||
size?: number | string;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user