Skip to content

Commit 984bb7c

Browse files
authored
chore: update dependencies and use new eslint/ts configs (#169)
1 parent 4b32b1d commit 984bb7c

10 files changed

+38
-59
lines changed

.eslintrc

-11
This file was deleted.

.github/workflows/codeql.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ jobs:
4343

4444
steps:
4545
- name: Harden Runner
46-
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
46+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
4747
with:
4848
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
4949
- name: Checkout repository
50-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
50+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5151

5252
# Initializes the CodeQL tools for scanning.
5353
- name: Initialize CodeQL
54-
uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
54+
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
5555
with:
5656
languages: ${{ matrix.language }}
5757
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -65,7 +65,7 @@ jobs:
6565
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
6666
# If this step fails, then you should remove it and run the build manually (see below)
6767
- name: Autobuild
68-
uses: github/codeql-action/autobuild@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
68+
uses: github/codeql-action/autobuild@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
6969

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

8080
- name: Perform CodeQL Analysis
81-
uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
81+
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
8282
with:
8383
category: "/language:${{matrix.language}}"

.github/workflows/node.js.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
fail-fast: false
1818
steps:
1919
- name: Harden Runner
20-
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
20+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
2121
with:
2222
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
23-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2424
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
25+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828
- name: Install dependencies

.github/workflows/scorecard.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ jobs:
3232

3333
steps:
3434
- name: "Checkout code"
35-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3636
with:
3737
persist-credentials: false
3838

3939
- name: "Run analysis"
40-
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
40+
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
4141
with:
4242
results_file: results.sarif
4343
results_format: sarif
@@ -59,14 +59,14 @@ jobs:
5959
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6060
# format to the repository Actions tab.
6161
- name: "Upload artifact"
62-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
62+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
6363
with:
6464
name: SARIF file
6565
path: results.sarif
6666
retention-days: 5
6767

6868
# Upload the results to GitHub's code scanning dashboard.
6969
- name: "Upload to code-scanning"
70-
uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
70+
uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
7171
with:
7272
sarif_file: results.sarif

eslint.config.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { typescriptConfig } from "@openally/config.eslint";
2+
3+
export default typescriptConfig();

package.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77
"types": "./dist/index.d.ts",
88
"exports": {
99
".": {
10+
"types": "./dist/index.d.ts",
1011
"require": "./dist/index.cjs",
11-
"import": "./dist/index.js",
12-
"types": "./dist/index.d.ts"
12+
"import": "./dist/index.js"
1313
}
1414
},
1515
"scripts": {
1616
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
1717
"prepublishOnly": "npm run build",
18-
"test-only": "npx tsx --test test/Spinner.spec.ts",
18+
"test-only": "tsx --test test/Spinner.spec.ts",
1919
"test": "npm run lint && npm run coverage",
2020
"coverage": "c8 -r html npm run test-only",
21-
"lint": "eslint ."
21+
"lint": "eslint .",
22+
"lint:fix": "eslint . --fix"
2223
},
2324
"repository": {
2425
"type": "git",
@@ -47,15 +48,15 @@
4748
"dependencies": {
4849
"@topcli/wcwidth": "^1.0.1",
4950
"ansi-regex": "^6.0.1",
50-
"cli-cursor": "^4.0.0",
51+
"cli-cursor": "^5.0.0",
5152
"cli-spinners": "^3.1.0",
5253
"kleur": "^4.1.5",
5354
"strip-ansi": "^7.1.0"
5455
},
5556
"devDependencies": {
56-
"@nodesecure/eslint-config": "^1.9.0",
57-
"@slimio/is": "^2.0.0",
58-
"@types/node": "^20.14.11",
57+
"@openally/config.eslint": "^1.1.0",
58+
"@openally/config.typescript": "^1.0.3",
59+
"@types/node": "^22.10.2",
5960
"c8": "^10.1.2",
6061
"tsup": "^8.1.0",
6162
"tsx": "^4.16.2",

src/Spinner.class.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import readline from "node:readline";
55
import * as TTY from "node:tty";
66

77
// Import Third-party Dependencies
8-
import cliSpinners, { type SpinnerName, type Spinner as CliSpinner } from "cli-spinners";
8+
import * as cliSpinners from "cli-spinners";
99
import stripAnsi from "strip-ansi";
1010
import ansiRegex from "ansi-regex";
1111
import wcwidth from "@topcli/wcwidth";
@@ -15,7 +15,7 @@ import kleur from "kleur";
1515
let internalSpinnerCount = 0;
1616

1717
// CONSTANTS
18-
const kDefaultSpinnerName = "dots" satisfies SpinnerName;
18+
const kDefaultSpinnerName = "dots" satisfies cliSpinners.SpinnerName;
1919
const kLogSymbols = process.platform !== "win32" || process.env.CI || process.env.TERM === "xterm-256color" ?
2020
{ success: kleur.bold().green("✔"), error: kleur.bold().red("✖") } :
2121
{ success: kleur.bold().green("√"), error: kleur.bold().red("×") };
@@ -26,7 +26,7 @@ export interface ISpinnerOptions {
2626
*
2727
* @default "dots"
2828
*/
29-
name?: SpinnerName;
29+
name?: cliSpinners.SpinnerName;
3030
/**
3131
* Spinner frame color
3232
*
@@ -54,7 +54,7 @@ export class Spinner extends EventEmitter {
5454

5555
#verbose = true;
5656
#started = false;
57-
#spinner: CliSpinner;
57+
#spinner: cliSpinners.Spinner;
5858
#text = "";
5959
#prefix = "";
6060
#color: (stdout: string) => string;
@@ -124,7 +124,7 @@ export class Spinner extends EventEmitter {
124124
const terminalCol = this.stream.columns;
125125
const defaultRaw = `${this.#getSpinnerFrame(spinnerSymbol)} ${this.#prefix}${this.text}`;
126126

127-
let regexArray: any[] = [];
127+
let regexArray: any[];
128128
let count = 0;
129129
while (1) {
130130
regexArray = defaultRaw
@@ -135,7 +135,7 @@ export class Spinner extends EventEmitter {
135135
}
136136
count = regexArray.length;
137137
}
138-
count += regexArray.reduce((prev, curr) => prev + wcwidth(curr), 0);
138+
count += regexArray!.reduce((prev, curr) => prev + wcwidth(curr), 0);
139139

140140
return wcwidth(stripAnsi(defaultRaw)) > terminalCol ?
141141
`${defaultRaw.slice(0, terminalCol + count)}\x1B[0m` :

src/computeWithSpinner.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Import Internal Dependencies
2-
import { Spinner, ISpinnerOptions } from "./Spinner.class.js";
2+
import {
3+
Spinner,
4+
type ISpinnerOptions
5+
} from "./Spinner.class.js";
36

47
// CONSTANTS
58
// eslint-disable-next-line func-style
@@ -31,7 +34,7 @@ export async function computeWithSpinner<T = void>(
3134

3235
return response;
3336
}
34-
catch (err) {
37+
catch (err: any) {
3538
spinner.failed(fail(err));
3639

3740
throw err;

test/Spinner.spec.ts

-7
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,10 @@ import { describe, it } from "node:test";
33
import assert from "node:assert/strict";
44
import { once } from "node:events";
55

6-
// Import Third-party Dependencies
7-
import is from "@slimio/is";
8-
96
// Import Internal Dependencies
107
import { Spinner } from "../src/index.js";
118

129
describe("Spinner", () => {
13-
it("should export a JavaScript class", () => {
14-
assert.ok(is.classObject(Spinner));
15-
});
16-
1710
describe("reset", () => {
1811
it("should exist", () => {
1912
assert.ok(typeof Spinner.reset === "function");

tsconfig.json

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
{
2+
"extends": "@openally/config.typescript",
23
"compilerOptions": {
3-
"declaration": true,
4-
"strictNullChecks": true,
5-
"target": "ES2021",
64
"outDir": "dist",
7-
"module": "NodeNext",
8-
"moduleResolution": "NodeNext",
9-
"esModuleInterop": true,
10-
"resolveJsonModule": true,
11-
"skipDefaultLibCheck": true,
12-
"forceConsistentCasingInFileNames": true,
13-
"sourceMap": true,
14-
"rootDir": "./src",
15-
"types": ["node"]
5+
"rootDir": "./",
166
},
17-
"include": ["src", "src/schema/**/*.json"],
7+
"include": ["src", "index.ts"],
188
"exclude": ["node_modules", "dist"]
199
}

0 commit comments

Comments
 (0)