Skip to content

Commit

Permalink
refactor: use @openally/config.typescript and cleanup configs & types
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Aug 13, 2024
1 parent e138048 commit 98f6227
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

Expand All @@ -50,7 +50,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -60,7 +60,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
uses: github/codeql-action/autobuild@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -73,6 +73,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ephemeral-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mutex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

Expand Down Expand Up @@ -63,14 +63,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/timestore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"devDependencies": {
"@faker-js/faker": "^8.1.0",
"@nodesecure/eslint-config": "^1.8.0",
"@openally/config.typescript": "^1.0.2",
"@types/node": "^22.0.0",
"c8": "^10.1.2",
"cross-env": "^7.0.3",
Expand Down
15 changes: 2 additions & 13 deletions src/auto-url/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"target": "ES2022",
"outDir": "dist",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"rootDir": "./src",
"types": ["node"]
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
4 changes: 2 additions & 2 deletions src/config/src/AsynchronousConfig.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class AsynchronousConfig<T extends Record<string, any> = Record<string, a
}
JSONConfig = this.#isTOML ? TOML.parse(configFileContent) : JSON.parse(configFileContent);
}
catch (err) {
catch (err: any) {
const isSyntaxError = err.name === "SyntaxError" || err.name === "TomlError";

// If NodeJS Code is different from "ENOENTRY", then throw Error (only if createOnNoEntry is equal to false)
Expand All @@ -187,7 +187,7 @@ export class AsynchronousConfig<T extends Record<string, any> = Record<string, a
const schemaFileContent = await this.#fs.promises.readFile(this.#configSchemaFilePath, "utf-8");
JSONSchema = JSON.parse(schemaFileContent);
}
catch (err) {
catch (err: any) {
if (Reflect.has(err, "code") && err.code !== "ENOENT") {
throw err;
}
Expand Down
15 changes: 2 additions & 13 deletions src/config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"target": "ES2022",
"outDir": "dist",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"rootDir": "./src",
"types": ["node"]
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
15 changes: 2 additions & 13 deletions src/ephemeral-map/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"target": "ES2022",
"outDir": "dist",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"rootDir": "./src",
"types": ["node"]
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
4 changes: 2 additions & 2 deletions src/mutex/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Import Node.js Dependencies
import EventEmitter from "node:events";
import crypto from "node:crypto";
import { EventEmitter } from "node:events";
import * as crypto from "node:crypto";
import { clearTimeout } from "node:timers";

export interface IMutexOptions {
Expand Down
15 changes: 2 additions & 13 deletions src/mutex/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"target": "ES2022",
"outDir": "dist",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"rootDir": "./src",
"types": ["node"]
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
6 changes: 3 additions & 3 deletions src/result/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Ok, OkImpl } from "./class/Ok.class.js";
import { Err, ErrImpl } from "./class/Err.class.js";

export { Option, Some } from "./class/Some.class.js";
export { type Option, Some } from "./class/Some.class.js";
export { None } from "./class/None.class.js";
export { Ok, Err };

Expand Down Expand Up @@ -35,8 +35,8 @@ export namespace Result {

return new OkImpl(val);
}
catch (e) {
return new ErrImpl(e);
catch (e: any) {
return new ErrImpl<E>(e);
}
}

Expand Down
15 changes: 2 additions & 13 deletions src/result/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"target": "ES2022",
"outDir": "dist",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"rootDir": "./src",
"types": ["node"]
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
2 changes: 1 addition & 1 deletion src/timestore/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,4 @@ export class TimeStore extends EventEmitter {
}
}

export { tSv, tSvResponse, TSV_SYMBOL };
export { tSv, type tSvResponse, TSV_SYMBOL };
10 changes: 6 additions & 4 deletions src/timestore/test/TimeStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ describe("TimeStore", () => {
store.add(expectedIdentifier);

try {
// @ts-ignore
const [identifier] = await once(store, TimeStore.Expired, AbortSignal.timeout(500));
const [identifier] = await once(store, TimeStore.Expired, {
signal: AbortSignal.timeout(500)
});
assert.equal(identifier, expectedIdentifier);
}
finally {
Expand Down Expand Up @@ -371,8 +372,9 @@ describe("TimeStore", () => {
setTimeout(() => store.delete(toDeleteIdentifier), 100);

try {
// @ts-ignore
const [identifier] = await once(store, TimeStore.Expired, AbortSignal.timeout(safeTTL(ttl)));
const [identifier] = await once(store, TimeStore.Expired, {
signal: AbortSignal.timeout(safeTTL(ttl))
});

assert.equal(identifier, expectedIdentifier);
assert.equal(counter.listenerCount, 1);
Expand Down
15 changes: 2 additions & 13 deletions src/timestore/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"target": "ES2022",
"outDir": "dist",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"rootDir": "./src",
"types": ["node"]
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@openally/config.typescript/cjs",
"compilerOptions": {
"strictPropertyInitialization": false,
"composite": true,
"types": ["node"]
}
}

0 comments on commit 98f6227

Please sign in to comment.