@checkdigit/typescript-config 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.txt +1 -1
- package/README.md +67 -10
- package/bin/builder.mjs +196 -0
- package/package.json +164 -9
- package/tsconfig.json +3 -3
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
@@ -6,22 +6,78 @@ Copyright (c) 2022-2023 [Check Digit, LLC](https://checkdigit.com)
|
|
6
6
|
|
7
7
|
### Introduction
|
8
8
|
|
9
|
-
This module contains the standard Check Digit Typescript configuration
|
9
|
+
This module contains the standard Check Digit Typescript configuration, along with our standard build tool `builder`.
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
### Typescript Configuration
|
12
|
+
|
13
|
+
- currently requires Node 16 or above.
|
14
|
+
- emits `esnext`, with the default libraries, to avoid down-leveling. It is intended that application spec tests pick
|
15
|
+
up any issues with using newer features unavailable in a particular environment. Browsers and NodeJS are fast moving
|
16
|
+
targets, and can add language features at any time.
|
13
17
|
- uses the `module` type of `commonjs`.
|
14
|
-
- all compiler options set for maximum strictness
|
18
|
+
- all compiler options set for maximum strictness.
|
19
|
+
|
20
|
+
### Builder
|
21
|
+
|
22
|
+
`builder` is a command line tool that generates either commonjs or esm modules, from Typescript source. It is intended
|
23
|
+
to be used when publishing a package to NPM, or to bundle a package for deployment. It uses `tsc` for generating
|
24
|
+
types, and `esbuild` for generating code.
|
25
|
+
|
26
|
+
#### Options
|
27
|
+
|
28
|
+
- `--type` the type of module to generate. Defaults to `module` (ESM). Valid values are `commonjs` and `module`.
|
29
|
+
- `--entryPoint` the entry point for the bundle, relative to the inDir. if not provided, the files in the inDir will
|
30
|
+
be processed as individual unbundled files.
|
31
|
+
- `--inDir` the input source code directory.
|
32
|
+
- `--outDir` the output directory.
|
33
|
+
- `--outFile` the output file, relative to `--outDir`. This is provided for single-file bundles, along with `--entryPoint`.
|
34
|
+
- `--external` external modules to exclude from the bundle. Built-in `node` modules are automatically excluded.
|
35
|
+
A wildcard `*` can be used to exclude multiple external modules.
|
36
|
+
- `--minify` whether to minify the output.
|
37
|
+
- `--sourceMap` whether to include inline sourcemap.
|
38
|
+
|
39
|
+
#### Examples
|
40
|
+
|
41
|
+
```
|
42
|
+
# build commonjs .cjs files from Typescript source
|
43
|
+
npx builder --type=commonjs --outDir=build-cjs
|
44
|
+
|
45
|
+
# build single-file commonjs .cjs bundle from Typescript source
|
46
|
+
npx builder --type=commonjs --entryPoint=index.ts --outDir=build-cjs-bundle --outFile=index.cjs
|
47
|
+
|
48
|
+
# build ESM .mjs files from Typescript source
|
49
|
+
npx builder --type=module --outDir=build-esm
|
50
|
+
|
51
|
+
# build single-file ESM .mjs bundle from Typescript source
|
52
|
+
npx builder --type=module --outDir=build-esm-bundle --entryPoint=index.ts --outFile=index.mjs
|
53
|
+
```
|
54
|
+
|
55
|
+
### Tests
|
56
|
+
|
57
|
+
This module includes a number of integration-style tests, to ensure that a specific version of Typescript will interoperate
|
58
|
+
with `builder`, in addition to libraries and frameworks used by Check Digit:
|
59
|
+
|
60
|
+
- Jest and `ts-jest`
|
61
|
+
- ESLint and `@typescript-eslint/eslint-plugin`
|
62
|
+
- Built-in `node:test` runner
|
63
|
+
- prettier
|
64
|
+
- tsc
|
65
|
+
- esbuild
|
66
|
+
|
67
|
+
We do this to ensure that Typescript upgrades do not break these dependencies. New major versions of Typescript are not immediately
|
68
|
+
supported by projects such as ts-jest, eslint, prettier, etc. Our policy is to wait until these projects fully support
|
69
|
+
the new version of Typescript, and/or without emitting warnings during these tests, before publishing.
|
15
70
|
|
16
|
-
|
71
|
+
### A note about versioning
|
17
72
|
|
18
73
|
Strict semver is a little complicated, as Typescript itself does not adhere to semver. So our "best effort" policy is:
|
19
74
|
|
20
|
-
- Each
|
21
|
-
with whatever the latest LTS version of Node is currently supported by Amazon Lambda, Google Cloud Functions
|
75
|
+
- Each update to the minimum Node target (e.g. Node 16 to Node 18) will result in a new major version of this module.
|
76
|
+
We coordinate this with whatever the latest LTS version of Node is currently supported by Amazon Lambda, Google Cloud Functions
|
22
77
|
and Azure Functions.
|
23
|
-
- Each new major version of Typescript (e.g. `4.2.x` to `4.3.x`) will result in a new minor version of this module.
|
24
|
-
-
|
78
|
+
- Each new "major" version of Typescript (e.g. `4.2.x` to `4.3.x`) will result in a new minor version of this module.
|
79
|
+
- A new minor update of Typescript (e.g. `4.3.1` to `4.3.2`) _may_ result in a patch, in
|
80
|
+
a situation where a specific need or issue requires setting a new minimum version of Typescript.
|
25
81
|
|
26
82
|
Bear in mind, any update of Typescript can potentially break your build. But hopefully in a way that's useful.
|
27
83
|
|
@@ -31,7 +87,8 @@ Bear in mind, any update of Typescript can potentially break your build. But hop
|
|
31
87
|
npm add -D @checkdigit/typescript-config
|
32
88
|
```
|
33
89
|
|
34
|
-
Note: you do not need to explicitly install Typescript itself, as
|
90
|
+
Note: you do not need to explicitly install Typescript itself, as the most recent supported version comes in as a
|
91
|
+
peer dependency of `@checkdigit/typescript-config`.
|
35
92
|
|
36
93
|
Make sure your project's `tsconfig.json` extends `@checkdigit/typescript-config`.
|
37
94
|
|
package/bin/builder.mjs
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
// src/builder/index.mts
|
3
|
+
import { strict as assert2 } from "node:assert";
|
4
|
+
import path2 from "node:path";
|
5
|
+
import { parseArgs } from "node:util";
|
6
|
+
|
7
|
+
// src/builder/builder.mts
|
8
|
+
import { strict as assert } from "node:assert";
|
9
|
+
import { promises as fs } from "node:fs";
|
10
|
+
import path from "node:path";
|
11
|
+
import typescript from "typescript";
|
12
|
+
import { build } from "esbuild";
|
13
|
+
async function getFiles(directory) {
|
14
|
+
const entries = await fs.readdir(directory, { withFileTypes: true });
|
15
|
+
const files = await Promise.all(
|
16
|
+
entries.map((entry) => {
|
17
|
+
const result = path.resolve(directory, entry.name);
|
18
|
+
return entry.isDirectory() ? getFiles(result) : result;
|
19
|
+
})
|
20
|
+
);
|
21
|
+
return files.flat();
|
22
|
+
}
|
23
|
+
function excludeSourceMaps(filter) {
|
24
|
+
return (pluginBuild) => {
|
25
|
+
pluginBuild.onLoad({ filter }, async (args) => {
|
26
|
+
if (args.path.endsWith(".js") || args.path.endsWith(".mjs") || args.path.endsWith(".cjs")) {
|
27
|
+
return {
|
28
|
+
contents: `${await fs.readFile(
|
29
|
+
args.path,
|
30
|
+
"utf8"
|
31
|
+
)}
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,
|
33
|
+
loader: "default"
|
34
|
+
};
|
35
|
+
}
|
36
|
+
return void 0;
|
37
|
+
});
|
38
|
+
};
|
39
|
+
}
|
40
|
+
function resolveTypescriptPaths(type2) {
|
41
|
+
const extension = type2 === "module" ? "mjs" : "cjs";
|
42
|
+
return (pluginBuild) => {
|
43
|
+
pluginBuild.onResolve({ filter: /.*/u }, async (resolved) => {
|
44
|
+
if (resolved.kind === "entry-point" || !resolved.path.startsWith(".") || resolved.path.endsWith(".js")) {
|
45
|
+
return { external: resolved.kind !== "entry-point" };
|
46
|
+
}
|
47
|
+
let isDirectory = false;
|
48
|
+
try {
|
49
|
+
const stats = await fs.lstat(path.join(resolved.resolveDir, resolved.path));
|
50
|
+
isDirectory = stats.isDirectory();
|
51
|
+
} catch {
|
52
|
+
}
|
53
|
+
let newPath = resolved.path;
|
54
|
+
newPath += isDirectory ? `/index.${extension}` : `.${extension}`;
|
55
|
+
return { path: newPath, external: true };
|
56
|
+
});
|
57
|
+
};
|
58
|
+
}
|
59
|
+
async function builder_default({
|
60
|
+
type: type2,
|
61
|
+
entryPoint: entryPoint2,
|
62
|
+
inDir: inDir2,
|
63
|
+
outDir: outDir2,
|
64
|
+
outFile: outFile2,
|
65
|
+
external: external2 = [],
|
66
|
+
minify: minify2 = false,
|
67
|
+
sourceMap: sourceMap2
|
68
|
+
}) {
|
69
|
+
const messages2 = [];
|
70
|
+
assert.ok(
|
71
|
+
entryPoint2 === void 0 && outFile2 === void 0 || entryPoint2 !== void 0 && outFile2 !== void 0,
|
72
|
+
"entryPoint and outFile must both be provided"
|
73
|
+
);
|
74
|
+
const allSourceFiles = await getFiles(inDir2);
|
75
|
+
const productionSourceFiles = entryPoint2 === void 0 ? allSourceFiles.filter((file) => file.endsWith(".ts")) : [path.join(inDir2, entryPoint2)];
|
76
|
+
const program = typescript.createProgram(productionSourceFiles, {
|
77
|
+
module: typescript.ModuleKind.ESNext,
|
78
|
+
moduleResolution: typescript.ModuleResolutionKind.Bundler,
|
79
|
+
target: typescript.ScriptTarget.ESNext,
|
80
|
+
declaration: true,
|
81
|
+
noEmitOnError: true,
|
82
|
+
emitDeclarationOnly: true,
|
83
|
+
rootDir: inDir2,
|
84
|
+
outDir: outDir2,
|
85
|
+
noLib: false,
|
86
|
+
skipLibCheck: true,
|
87
|
+
strict: true,
|
88
|
+
preserveConstEnums: true,
|
89
|
+
noImplicitReturns: true,
|
90
|
+
noUnusedLocals: true,
|
91
|
+
noUnusedParameters: true,
|
92
|
+
alwaysStrict: true,
|
93
|
+
verbatimModuleSyntax: false,
|
94
|
+
noFallthroughCasesInSwitch: true,
|
95
|
+
forceConsistentCasingInFileNames: true,
|
96
|
+
emitDecoratorMetadata: true,
|
97
|
+
experimentalDecorators: true,
|
98
|
+
resolveJsonModule: true,
|
99
|
+
esModuleInterop: true,
|
100
|
+
noUncheckedIndexedAccess: true,
|
101
|
+
noPropertyAccessFromIndexSignature: true,
|
102
|
+
allowUnusedLabels: false,
|
103
|
+
allowUnreachableCode: false,
|
104
|
+
noImplicitOverride: true,
|
105
|
+
useUnknownInCatchVariables: true,
|
106
|
+
exactOptionalPropertyTypes: true
|
107
|
+
});
|
108
|
+
const emitResult = program.emit();
|
109
|
+
const allDiagnostics = typescript.sortAndDeduplicateDiagnostics([
|
110
|
+
...typescript.getPreEmitDiagnostics(program),
|
111
|
+
...emitResult.diagnostics
|
112
|
+
]);
|
113
|
+
for (const diagnostic of allDiagnostics) {
|
114
|
+
if (diagnostic.file) {
|
115
|
+
assert.ok(diagnostic.start !== void 0);
|
116
|
+
const { line, character } = typescript.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
117
|
+
const message = typescript.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
118
|
+
messages2.push(`tsc: ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
119
|
+
} else {
|
120
|
+
messages2.push(`tsc: ${typescript.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
if (emitResult.emitSkipped) {
|
124
|
+
throw new Error(`TypeScript compilation failed ${JSON.stringify(messages2)}`);
|
125
|
+
}
|
126
|
+
const buildResult = await build({
|
127
|
+
entryPoints: productionSourceFiles,
|
128
|
+
bundle: true,
|
129
|
+
minify: minify2,
|
130
|
+
platform: "node",
|
131
|
+
format: type2 === "module" ? "esm" : "cjs",
|
132
|
+
sourcesContent: false,
|
133
|
+
sourcemap: sourceMap2 ? "inline" : false,
|
134
|
+
...outFile2 === void 0 ? {
|
135
|
+
// individual files
|
136
|
+
outdir: outDir2,
|
137
|
+
outExtension: { ".js": type2 === "module" ? ".mjs" : ".cjs" },
|
138
|
+
plugins: [
|
139
|
+
{
|
140
|
+
name: "resolve-typescript-paths",
|
141
|
+
setup: resolveTypescriptPaths(type2)
|
142
|
+
}
|
143
|
+
]
|
144
|
+
} : {
|
145
|
+
// bundling
|
146
|
+
outfile: path.join(outDir2, outFile2),
|
147
|
+
legalComments: "none",
|
148
|
+
external: external2,
|
149
|
+
plugins: [
|
150
|
+
{
|
151
|
+
name: "exclude-source-maps",
|
152
|
+
setup: excludeSourceMaps(/node_modules/u)
|
153
|
+
}
|
154
|
+
]
|
155
|
+
}
|
156
|
+
});
|
157
|
+
messages2.push(...buildResult.errors.map((error) => `esbuild error: ${error.text}`));
|
158
|
+
messages2.push(...buildResult.warnings.map((warning) => `esbuild warning: ${warning.text}`));
|
159
|
+
if (messages2.length > 0) {
|
160
|
+
throw new Error(`esbuild failed ${JSON.stringify(messages2)}`);
|
161
|
+
}
|
162
|
+
return messages2;
|
163
|
+
}
|
164
|
+
|
165
|
+
// src/builder/index.mts
|
166
|
+
var {
|
167
|
+
values: { type, inDir, outDir, entryPoint, outFile, external, minify, sourceMap }
|
168
|
+
} = parseArgs({
|
169
|
+
options: {
|
170
|
+
type: { type: "string", short: "t", default: "module" },
|
171
|
+
inDir: { type: "string", short: "i", default: "src" },
|
172
|
+
outDir: { type: "string", short: "o", default: "build" },
|
173
|
+
entryPoint: { type: "string", short: "e", default: void 0 },
|
174
|
+
outFile: { type: "string", short: "f", default: void 0 },
|
175
|
+
external: { type: "string", short: "x", multiple: true, default: [] },
|
176
|
+
minify: { type: "boolean", short: "m", default: false },
|
177
|
+
sourceMap: { type: "boolean", short: "s", default: false }
|
178
|
+
}
|
179
|
+
});
|
180
|
+
assert2.ok(type === "module" || type === "commonjs", "type must be module or commonjs");
|
181
|
+
assert2.ok(inDir !== void 0, "inDir is required");
|
182
|
+
assert2.ok(outDir !== void 0, "outDir is required");
|
183
|
+
var messages = await builder_default({
|
184
|
+
type,
|
185
|
+
inDir: path2.join(process.cwd(), inDir),
|
186
|
+
outDir: path2.join(process.cwd(), outDir),
|
187
|
+
entryPoint,
|
188
|
+
outFile,
|
189
|
+
external,
|
190
|
+
minify,
|
191
|
+
sourceMap
|
192
|
+
});
|
193
|
+
if (messages.length > 0) {
|
194
|
+
console.warn(JSON.stringify(messages, void 0, 2));
|
195
|
+
process.exit(1);
|
196
|
+
}
|
package/package.json
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "@checkdigit/typescript-config",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.4.0",
|
4
4
|
"description": "Check Digit standard Typescript configuration",
|
5
5
|
"prettier": "@checkdigit/prettier-config",
|
6
6
|
"engines": {
|
7
7
|
"node": ">=16"
|
8
8
|
},
|
9
|
+
"bin": {
|
10
|
+
"builder": "./bin/builder.mjs"
|
11
|
+
},
|
9
12
|
"peerDependencies": {
|
10
13
|
"@types/node": ">=16",
|
11
|
-
"
|
14
|
+
"esbuild": "0.17.19",
|
15
|
+
"typescript": ">=5.0.4 <5.1"
|
12
16
|
},
|
13
17
|
"repository": {
|
14
18
|
"type": "git",
|
@@ -23,16 +27,167 @@
|
|
23
27
|
"scripts": {
|
24
28
|
"preversion": "npm test",
|
25
29
|
"postversion": "git push && git push --tags",
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
30
|
+
"prepare": "npm run build-builder",
|
31
|
+
"lint:fix": "eslint -f unix --ext .ts,.mts src --fix",
|
32
|
+
"lint": "eslint -f unix --ext .ts,.mts src",
|
33
|
+
"prettier": "prettier --ignore-path .gitignore --list-different .",
|
34
|
+
"prettier:fix": "prettier --ignore-path .gitignore --write .",
|
35
|
+
"test": "npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style",
|
36
|
+
"build-builder": "esbuild src/builder/index.mts --bundle --platform=node --format=esm --external:typescript --external:esbuild --outfile=build-builder/builder.mjs && mkdir -p bin && { echo '#!/usr/bin/env node'; cat build-builder/builder.mjs; } > bin/builder.mjs && chmod +x bin/builder.mjs",
|
37
|
+
"build-cjs": "rimraf build-cjs && npx builder --type=commonjs --outDir=build-cjs",
|
38
|
+
"build-cjs-bundle": "rimraf build-cjs-bundle && npx builder --type=commonjs --entryPoint=test/index.test.ts --outDir=build-cjs-bundle --outFile=test/index.test.cjs --minify --sourceMap",
|
39
|
+
"build-cjs-bundle-no-external": "rimraf build-cjs-bundle-no-external && npx builder --type=commonjs --external=./node_modules/* --entryPoint=test/index.test.ts --outDir=build-cjs-bundle-no-external --outFile=test/index.test.cjs",
|
40
|
+
"build-esm": "rimraf build-esm && npx builder --type=module --outDir=build-esm",
|
41
|
+
"build-esm-bundle": "rimraf build-esm-bundle && npx builder --type=module --outDir=build-esm-bundle --entryPoint=test/index.test.ts --outFile=test/index.test.mjs",
|
42
|
+
"build-esm-bundle-no-external": "rimraf build-esm-bundle-no-external && npx builder --type=module --external=./node_modules/* --outDir=build-esm-bundle-no-external --entryPoint=test/index.test.ts --outFile=test/index.test.mjs --minify",
|
43
|
+
"test-jest-esm": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --coverage=false src/*.mts src/*/*.mts src/*/*/*.mts",
|
44
|
+
"test-jest-cjs": "jest --coverage=false src/*.ts src/*/*.ts src/*/*/*.ts",
|
45
|
+
"test-cjs": "node --test build-cjs/test/index.test.cjs",
|
46
|
+
"test-cjs-bundle": "node --test build-cjs-bundle/test/index.test.cjs",
|
47
|
+
"test-cjs-bundle-no-external": "node --test build-cjs-bundle-no-external/test/index.test.cjs",
|
48
|
+
"test-esm": "node --test build-esm/test/index.test.mjs",
|
49
|
+
"test-esm-bundle": "echo \"node --test build-esm-bundle/test/index.test.mjs\"",
|
50
|
+
"test-esm-bundle-no-external": "node --test build-esm-bundle-no-external/test/index.test.mjs",
|
51
|
+
"ci:test": "npm run test-jest-cjs && npm run test-jest-esm && npm run test-cjs && npm run test-cjs-bundle && npm run test-cjs-bundle-no-external && npm run test-esm && npm run test-esm-bundle && npm run test-esm-bundle-no-external",
|
52
|
+
"ci:compile": "npm run build-builder && npm run build-cjs && npm run build-cjs-bundle && npm run build-cjs-bundle-no-external && npm run build-esm && npm run build-esm-bundle && npm run build-esm-bundle-no-external",
|
53
|
+
"ci:lint": "npm run lint",
|
31
54
|
"ci:style": "npm run prettier"
|
32
55
|
},
|
33
56
|
"devDependencies": {
|
34
|
-
"@checkdigit/prettier-config": "^3.
|
35
|
-
"
|
57
|
+
"@checkdigit/prettier-config": "^3.4.0",
|
58
|
+
"@types/debug": "^4.1.7",
|
59
|
+
"@types/jest": "^29.5.1",
|
60
|
+
"@types/uuid": "^9.0.1",
|
61
|
+
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
62
|
+
"@typescript-eslint/parser": "^5.59.6",
|
63
|
+
"debug": "^4.3.4",
|
64
|
+
"eslint": "^8.40.0",
|
65
|
+
"eslint-config-prettier": "^8.8.0",
|
66
|
+
"get-port": "^6.1.2",
|
67
|
+
"got": "^11.8.6",
|
68
|
+
"jest": "^29.5.0",
|
69
|
+
"rimraf": "^5.0.1",
|
70
|
+
"ts-jest": "^29.1.0",
|
71
|
+
"uuid": "^9.0.0"
|
72
|
+
},
|
73
|
+
"eslintConfig": {
|
74
|
+
"parser": "@typescript-eslint/parser",
|
75
|
+
"plugins": [
|
76
|
+
"@typescript-eslint"
|
77
|
+
],
|
78
|
+
"parserOptions": {
|
79
|
+
"project": "./tsconfig.json"
|
80
|
+
},
|
81
|
+
"extends": [
|
82
|
+
"eslint:all",
|
83
|
+
"plugin:@typescript-eslint/recommended",
|
84
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
85
|
+
"plugin:@typescript-eslint/strict",
|
86
|
+
"prettier"
|
87
|
+
],
|
88
|
+
"rules": {
|
89
|
+
"@typescript-eslint/non-nullable-type-assertion-style": "error",
|
90
|
+
"capitalized-comments": "off",
|
91
|
+
"one-var": "off",
|
92
|
+
"sort-keys": "off",
|
93
|
+
"sort-imports": "off",
|
94
|
+
"func-style": [
|
95
|
+
"error",
|
96
|
+
"declaration",
|
97
|
+
{
|
98
|
+
"allowArrowFunctions": true
|
99
|
+
}
|
100
|
+
],
|
101
|
+
"no-magic-numbers": [
|
102
|
+
"error",
|
103
|
+
{
|
104
|
+
"ignore": [
|
105
|
+
0,
|
106
|
+
1,
|
107
|
+
2
|
108
|
+
]
|
109
|
+
}
|
110
|
+
],
|
111
|
+
"no-undefined": "off",
|
112
|
+
"no-ternary": "off"
|
113
|
+
},
|
114
|
+
"overrides": [
|
115
|
+
{
|
116
|
+
"files": [
|
117
|
+
"*.spec.mts",
|
118
|
+
"*.test.mts",
|
119
|
+
"*.spec.ts",
|
120
|
+
"*.test.ts"
|
121
|
+
],
|
122
|
+
"rules": {
|
123
|
+
"@typescript-eslint/non-nullable-type-assertion-style": "off",
|
124
|
+
"@typescript-eslint/ban-types": "off",
|
125
|
+
"@typescript-eslint/require-await": "off",
|
126
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
127
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
128
|
+
"@typescript-eslint/no-unnecessary-condition": "off",
|
129
|
+
"@typescript-eslint/consistent-indexed-object-style": "off",
|
130
|
+
"@typescript-eslint/no-unused-vars": "off",
|
131
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
132
|
+
"line-comment-position": "off",
|
133
|
+
"no-inline-comments": "off",
|
134
|
+
"no-param-reassign": "off",
|
135
|
+
"id-length": "off",
|
136
|
+
"no-magic-numbers": "off",
|
137
|
+
"func-names": "off",
|
138
|
+
"no-duplicate-imports": "off",
|
139
|
+
"symbol-description": "off",
|
140
|
+
"no-invalid-this": "off",
|
141
|
+
"max-lines-per-function": "off",
|
142
|
+
"max-lines": "off",
|
143
|
+
"max-statements": "off",
|
144
|
+
"no-await-in-loop": "off"
|
145
|
+
}
|
146
|
+
}
|
147
|
+
]
|
148
|
+
},
|
149
|
+
"jest": {
|
150
|
+
"moduleFileExtensions": [
|
151
|
+
"js",
|
152
|
+
"mjs",
|
153
|
+
"cjs",
|
154
|
+
"ts",
|
155
|
+
"mts",
|
156
|
+
"json",
|
157
|
+
"node"
|
158
|
+
],
|
159
|
+
"extensionsToTreatAsEsm": [
|
160
|
+
".mts"
|
161
|
+
],
|
162
|
+
"transform": {
|
163
|
+
"^.+\\.mts$": [
|
164
|
+
"ts-jest",
|
165
|
+
{
|
166
|
+
"isolatedModules": true,
|
167
|
+
"diagnostics": false,
|
168
|
+
"useESM": true
|
169
|
+
}
|
170
|
+
],
|
171
|
+
"^.+\\.ts$": [
|
172
|
+
"ts-jest",
|
173
|
+
{
|
174
|
+
"isolatedModules": true,
|
175
|
+
"diagnostics": false,
|
176
|
+
"useESM": false
|
177
|
+
}
|
178
|
+
]
|
179
|
+
},
|
180
|
+
"collectCoverageFrom": [
|
181
|
+
"<rootDir>/src/**",
|
182
|
+
"!<rootDir>/src/**/*.spec.mts",
|
183
|
+
"!<rootDir>/src/**/*.test.mts",
|
184
|
+
"!<rootDir>/src/**/*.spec.ts",
|
185
|
+
"!<rootDir>/src/**/*.test.ts"
|
186
|
+
],
|
187
|
+
"testMatch": [
|
188
|
+
"<rootDir>/src/**/*.spec.ts",
|
189
|
+
"<rootDir>/src/**/*.spec.mts"
|
190
|
+
]
|
36
191
|
},
|
37
192
|
"files": [
|
38
193
|
"tsconfig.json",
|
package/tsconfig.json
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
|
-
"module": "
|
4
|
-
"target": "
|
5
|
-
"lib": ["esnext", "dom", "webworker"],
|
3
|
+
"module": "NodeNext",
|
4
|
+
"target": "esnext",
|
6
5
|
"sourceMap": true,
|
7
6
|
"inlineSources": true,
|
8
7
|
"outDir": "build",
|
@@ -28,6 +27,7 @@
|
|
28
27
|
"noUncheckedIndexedAccess": true,
|
29
28
|
"noPropertyAccessFromIndexSignature": true,
|
30
29
|
"allowUnusedLabels": false,
|
30
|
+
"allowUnreachableCode": false,
|
31
31
|
"noImplicitOverride": true,
|
32
32
|
"useUnknownInCatchVariables": true,
|
33
33
|
"exactOptionalPropertyTypes": true
|