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
42 lines
1.2 KiB
JSON
42 lines
1.2 KiB
JSON
{
|
|
"compilerOptions": {
|
|
"outDir": "./dist/",
|
|
"module": "esnext",
|
|
"target": "es6",
|
|
"moduleResolution": "node",
|
|
"allowJs": true,
|
|
"strict": true,
|
|
"declaration": true,
|
|
"declarationMap": true,
|
|
"declarationDir": "./dist/types",
|
|
"noImplicitAny": false,
|
|
"allowSyntheticDefaultImports": true,
|
|
"experimentalDecorators": true,
|
|
"importHelpers": true,
|
|
"sourceMap": true,
|
|
"inlineSources": true,
|
|
"paths": {
|
|
"flexsearch": ["./node_modules/@types/flexsearch"]
|
|
},
|
|
"plugins": [
|
|
{
|
|
"name": "ts-lit-plugin",
|
|
"strict": true,
|
|
"rules": {
|
|
// This seems to produce a bunch of false positives, so we've turned it off for now.
|
|
// Relevant issues:
|
|
// https://github.com/runem/lit-analyzer/issues/293
|
|
// https://github.com/runem/lit-analyzer/issues/302
|
|
// https://github.com/runem/lit-analyzer/issues/266
|
|
"no-missing-import": "off",
|
|
|
|
// ts-lit-plugin also doesn't seem to understand string interpolations in CSS, so this is also turned off.
|
|
"no-invalid-css": "off"
|
|
}
|
|
}
|
|
],
|
|
"skipLibCheck": true
|
|
},
|
|
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
|
|
}
|