Skip to content

Commit 2875f31

Browse files
committed
build: updated tsconfig, fixed related errors
1 parent 791ec95 commit 2875f31

File tree

5 files changed

+36
-30
lines changed

5 files changed

+36
-30
lines changed

src/build/build-distfiles.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ export async function buildDistFiles(basePath: string): Promise<boolean> {
2525
text = data.toString(),
2626
libObj = JSON.parse(text) as Record<string, unknown>;
2727

28-
libObj.version = pkgInfo.version;
28+
libObj["version"] = pkgInfo.version;
2929

3030
if (pkgInfo.dependencies) {
31-
libObj.dependencies = JSON.parse(JSON.stringify(pkgInfo.dependencies).replaceAll("workspace:", ""));
31+
libObj["dependencies"] = JSON.parse(JSON.stringify(pkgInfo.dependencies).replaceAll("workspace:", ""));
3232
} else if (pkgInfo.peerDependencies) {
33-
libObj.peerDependencies = JSON.parse(JSON.stringify(pkgInfo.peerDependencies).replaceAll("workspace:", ""));
33+
libObj["peerDependencies"] = JSON.parse(
34+
JSON.stringify(pkgInfo.peerDependencies).replaceAll("workspace:", ""),
35+
);
3436
}
3537

3638
const jsonIndent = 2;

src/build/build-tsc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ async function readConfig(basePath: string, file: string): Promise<string | unde
2222

2323
return data.toString();
2424
}
25+
26+
return undefined;
2527
}
2628

2729
/**

src/build/build.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ buildCommand.option("-t, --tsc", "Build the library using TypeScript", false);
2424
buildCommand.argument("[path]", `Path to the project root folder, default is "src"`, "src");
2525
buildCommand.action(async (argPath: string) => {
2626
const opts = buildCommand.opts(),
27-
ci = !!opts.ci,
28-
all = !!opts.all || (!opts.bundle && !opts.clean && !opts.dist && !opts.lint && !opts.prettify && !opts.tsc),
29-
doBundle = all || !!opts.bundle,
30-
circularDeps = all || !!opts.circularDeps,
31-
clean = all || !!opts.clean,
32-
distfiles = all || !!opts.dist,
33-
doLint = all || !!opts.lint,
34-
prettier = all || !!opts.prettify,
35-
tsc = all || !!opts.tsc;
27+
ci = !!opts["ci"],
28+
all =
29+
!!opts["all"] ||
30+
(!opts["bundle"] && !opts["clean"] && !opts["dist"] && !opts["lint"] && !opts["prettify"] && !opts["tsc"]),
31+
doBundle = all || !!opts["bundle"],
32+
circularDeps = all || !!opts["circularDeps"],
33+
clean = all || !!opts["clean"],
34+
distfiles = all || !!opts["dist"],
35+
doLint = all || !!opts["lint"],
36+
prettier = all || !!opts["prettify"],
37+
tsc = all || !!opts["tsc"];
3638

3739
const basePath = process.cwd(),
3840
{ getDistStats } = await import("./build-diststats.js"),

src/tsconfig.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,24 @@
9797
/* Ensure that casing is correct in imports. */
9898

9999
/* Type Checking */
100-
"strict": true
100+
"strict": true,
101101
/* Enable all strict type-checking options. */
102-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
103-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
104-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
105-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
106-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
107-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
108-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
109-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
110-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
111-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
112-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
113-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
114-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
115-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
116-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
117-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102+
"noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
103+
"strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */,
104+
"strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
105+
"strictBindCallApply": true /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */,
106+
"strictPropertyInitialization": true /* Check for class properties that are declared but not set in the constructor. */,
107+
"noImplicitThis": true /* Enable error reporting when 'this' is given the type 'any'. */,
108+
"useUnknownInCatchVariables": true /* Default catch clause variables as 'unknown' instead of 'any'. */,
109+
"alwaysStrict": true /* Ensure 'use strict' is always emitted. */,
110+
"noUnusedLocals": true /* Enable error reporting when local variables aren't read. */,
111+
"noUnusedParameters": true /* Raise an error when a function parameter isn't read. */,
112+
"exactOptionalPropertyTypes": true /* Interpret optional property types as written, rather than adding 'undefined'. */,
113+
"noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
114+
"noFallthroughCasesInSwitch": true /* Enable error reporting for fallthrough cases in switch statements. */,
115+
"noUncheckedIndexedAccess": true /* Add 'undefined' to a type when accessed using an index. */,
116+
"noImplicitOverride": true /* Ensure overriding members in derived classes are marked with an override modifier. */,
117+
"noPropertyAccessFromIndexSignature": true /* Enforces using indexed accessors for keys declared using an indexed type. */
118118
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
119119
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
120120

src/utils/string-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function camelize(str: string, ...splits: string[]): string {
3434
*/
3535
export function dash(str: string): string {
3636
const index = 0,
37-
dashed = str.replace(/([A-Z])/g, g => `-${g[index].toLowerCase()}`),
37+
dashed = str.replace(/([A-Z])/g, g => `-${g[index]?.toLowerCase() ?? ""}`),
3838
startPos = 1;
3939

4040
return dashed.startsWith("-") ? dashed.substring(startPos) : dashed;

0 commit comments

Comments
 (0)