From b98721efc8ebb83216ce3833538d4bc3cc454a32 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Fri, 25 Jul 2025 10:01:54 +0200 Subject: [PATCH 01/15] feat(utilities): add basic ts guards to check for a certain type from value --- packages/utilities/src/index.ts | 7 +++++ .../src/lib/ts-guards/is-array.spec.ts | 23 ++++++++++++++++ .../utilities/src/lib/ts-guards/is-array.ts | 3 +++ .../src/lib/ts-guards/is-boolean.spec.ts | 20 ++++++++++++++ .../utilities/src/lib/ts-guards/is-boolean.ts | 3 +++ .../src/lib/ts-guards/is-class.spec.ts | 26 ++++++++++++++++++ .../utilities/src/lib/ts-guards/is-class.ts | 5 ++++ .../src/lib/ts-guards/is-date.spec.ts | 22 +++++++++++++++ .../utilities/src/lib/ts-guards/is-date.ts | 3 +++ .../src/lib/ts-guards/is-defined.spec.ts | 18 +++++++++++++ .../utilities/src/lib/ts-guards/is-defined.ts | 3 +++ .../src/lib/ts-guards/is-number.spec.ts | 27 +++++++++++++++++++ .../utilities/src/lib/ts-guards/is-number.ts | 3 +++ .../src/lib/ts-guards/is-string.spec.ts | 21 +++++++++++++++ .../utilities/src/lib/ts-guards/is-string.ts | 3 +++ 15 files changed, 187 insertions(+) create mode 100644 packages/utilities/src/lib/ts-guards/is-array.spec.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-array.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-boolean.spec.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-boolean.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-class.spec.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-class.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-date.spec.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-date.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-defined.spec.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-defined.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-number.spec.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-number.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-string.spec.ts create mode 100644 packages/utilities/src/lib/ts-guards/is-string.ts diff --git a/packages/utilities/src/index.ts b/packages/utilities/src/index.ts index 417e7f5..0748aee 100644 --- a/packages/utilities/src/index.ts +++ b/packages/utilities/src/index.ts @@ -19,3 +19,10 @@ export * from './lib/type-utils/nullable.type.js' export * from './lib/type-utils/union-to-intersection.type.js' export * from './lib/string/words.js' export * from './lib/string/capitalize.function.js' +export * from './lib/ts-guards/is-array.js' +export * from './lib/ts-guards/is-boolean.js' +export * from './lib/ts-guards/is-class.js' +export * from './lib/ts-guards/is-date.js' +export * from './lib/ts-guards/is-defined.js' +export * from './lib/ts-guards/is-number.js' +export * from './lib/ts-guards/is-string.js' diff --git a/packages/utilities/src/lib/ts-guards/is-array.spec.ts b/packages/utilities/src/lib/ts-guards/is-array.spec.ts new file mode 100644 index 0000000..10dd2fc --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-array.spec.ts @@ -0,0 +1,23 @@ +import { isArray } from './is-array.js'; + +describe('isArray', () => { + it('should return true for array values', () => { + expect(isArray([])).toBe(true); + expect(isArray([1, 2, 3])).toBe(true); + expect(isArray(['a', 'b', 'c'])).toBe(true); + expect(isArray([null, undefined])).toBe(true); + // eslint-disable-next-line @typescript-eslint/no-array-constructor + expect(isArray(new Array())).toBe(true); + }); + + it('should return false for non-array values', () => { + expect(isArray('array')).toBe(false); + expect(isArray(123)).toBe(false); + expect(isArray(true)).toBe(false); + expect(isArray(null)).toBe(false); + expect(isArray(undefined)).toBe(false); + expect(isArray({})).toBe(false); + expect(isArray(new Date())).toBe(false); + expect(isArray({ length: 0 })).toBe(false); + }); +}); \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-array.ts b/packages/utilities/src/lib/ts-guards/is-array.ts new file mode 100644 index 0000000..23caaca --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-array.ts @@ -0,0 +1,3 @@ +export function isArray(value: unknown): value is unknown[] { + return Array.isArray(value); +} \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-boolean.spec.ts b/packages/utilities/src/lib/ts-guards/is-boolean.spec.ts new file mode 100644 index 0000000..4ad5b0e --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-boolean.spec.ts @@ -0,0 +1,20 @@ +import { isBoolean } from './is-boolean.js'; + +describe('isBoolean', () => { + it('should return true for boolean values', () => { + expect(isBoolean(true)).toBe(true); + expect(isBoolean(false)).toBe(true); + }); + + it('should return false for non-boolean values', () => { + expect(isBoolean(1)).toBe(false); + expect(isBoolean(0)).toBe(false); + expect(isBoolean('true')).toBe(false); + expect(isBoolean('false')).toBe(false); + expect(isBoolean(null)).toBe(false); + expect(isBoolean(undefined)).toBe(false); + expect(isBoolean([])).toBe(false); + expect(isBoolean({})).toBe(false); + expect(isBoolean(new Date())).toBe(false); + }); +}); \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-boolean.ts b/packages/utilities/src/lib/ts-guards/is-boolean.ts new file mode 100644 index 0000000..b4bd29b --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-boolean.ts @@ -0,0 +1,3 @@ +export function isBoolean(value: unknown): value is boolean { + return typeof value === 'boolean'; +} \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-class.spec.ts b/packages/utilities/src/lib/ts-guards/is-class.spec.ts new file mode 100644 index 0000000..2e29463 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-class.spec.ts @@ -0,0 +1,26 @@ +import { isClass } from './is-class.js'; + +class TestClass { + constructor() {} + + x(){} +} + +describe('isClass', () => { + it('should return true for classes', () => { + expect(isClass(TestClass)).toBe(true); + }); + + + it('should return false for non-class values', () => { + expect(isClass('string')).toBe(false); + expect(isClass(123)).toBe(false); + expect(isClass(true)).toBe(false); + expect(isClass(null)).toBe(false); + expect(isClass(undefined)).toBe(false); + expect(isClass([])).toBe(false); + expect(isClass({})).toBe(false); + expect(isClass(function y(){})).toBe(false); + expect(isClass(new TestClass().x)).toBe(false); + }); +}); \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-class.ts b/packages/utilities/src/lib/ts-guards/is-class.ts new file mode 100644 index 0000000..3a8d1e3 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-class.ts @@ -0,0 +1,5 @@ +export function isClass any>(v: T): v is T +export function isClass(v: any): v is new (...args: any[]) => any +export function isClass(v: any): v is new (...args: any[]) => any { + return typeof v === 'function' && /^\s*class\s+/.test(v.toString()) +} \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-date.spec.ts b/packages/utilities/src/lib/ts-guards/is-date.spec.ts new file mode 100644 index 0000000..4990656 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-date.spec.ts @@ -0,0 +1,22 @@ +import { isDate } from './is-date.js'; + +describe('isDate', () => { + it('should return true for Date objects', () => { + expect(isDate(new Date())).toBe(true); + expect(isDate(new Date('2023-01-01'))).toBe(true); + expect(isDate(new Date(2023, 0, 1))).toBe(true); + expect(isDate(new Date(Date.now()))).toBe(true); + }); + + it('should return false for non-Date values', () => { + expect(isDate('2023-01-01')).toBe(false); + expect(isDate(1672531200000)).toBe(false); + expect(isDate(true)).toBe(false); + expect(isDate(false)).toBe(false); + expect(isDate(null)).toBe(false); + expect(isDate(undefined)).toBe(false); + expect(isDate([])).toBe(false); + expect(isDate({})).toBe(false); + expect(isDate('hello')).toBe(false); + }); +}); \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-date.ts b/packages/utilities/src/lib/ts-guards/is-date.ts new file mode 100644 index 0000000..911dc58 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-date.ts @@ -0,0 +1,3 @@ +export function isDate(value: unknown): value is Date { + return value instanceof Date; +} \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-defined.spec.ts b/packages/utilities/src/lib/ts-guards/is-defined.spec.ts new file mode 100644 index 0000000..6f1a2c8 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-defined.spec.ts @@ -0,0 +1,18 @@ +import { isDefined } from './is-defined.js'; + +describe('isDefined', () => { + it('should return true for defined values', () => { + expect(isDefined('')).toBe(true); + expect(isDefined(0)).toBe(true); + expect(isDefined(false)).toBe(true); + expect(isDefined([])).toBe(true); + expect(isDefined({})).toBe(true); + expect(isDefined('hello')).toBe(true); + expect(isDefined(123)).toBe(true); + }); + + it('should return false for undefined values', () => { + expect(isDefined(undefined)).toBe(false); + expect(isDefined(null)).toBe(false); + }); +}); \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-defined.ts b/packages/utilities/src/lib/ts-guards/is-defined.ts new file mode 100644 index 0000000..e81adaa --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-defined.ts @@ -0,0 +1,3 @@ +export function isDefined(value: T | undefined | null): value is T { + return value !== undefined && value !== null; +} \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-number.spec.ts b/packages/utilities/src/lib/ts-guards/is-number.spec.ts new file mode 100644 index 0000000..cdd1001 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-number.spec.ts @@ -0,0 +1,27 @@ +import { isNumber } from './is-number.js'; + +describe('isNumber', () => { + it('should return true for valid number values', () => { + expect(isNumber(0)).toBe(true); + expect(isNumber(123)).toBe(true); + expect(isNumber(-456)).toBe(true); + expect(isNumber(3.14)).toBe(true); + expect(isNumber(Infinity)).toBe(true); + expect(isNumber(-Infinity)).toBe(true); + }); + + it('should return false for NaN', () => { + expect(isNumber(NaN)).toBe(false); + }); + + it('should return false for non-number values', () => { + expect(isNumber('123')).toBe(false); + expect(isNumber(true)).toBe(false); + expect(isNumber(false)).toBe(false); + expect(isNumber(null)).toBe(false); + expect(isNumber(undefined)).toBe(false); + expect(isNumber([])).toBe(false); + expect(isNumber({})).toBe(false); + expect(isNumber(new Date())).toBe(false); + }); +}); \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-number.ts b/packages/utilities/src/lib/ts-guards/is-number.ts new file mode 100644 index 0000000..9463208 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-number.ts @@ -0,0 +1,3 @@ +export function isNumber(value: unknown): value is number { + return typeof value === 'number' && !isNaN(value); +} \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-string.spec.ts b/packages/utilities/src/lib/ts-guards/is-string.spec.ts new file mode 100644 index 0000000..859ecb3 --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-string.spec.ts @@ -0,0 +1,21 @@ +import { isString } from './is-string.js'; + +describe('isString', () => { + it('should return true for string values', () => { + expect(isString('')).toBe(true); + expect(isString('hello')).toBe(true); + expect(isString('123')).toBe(true); + expect(isString(' ')).toBe(true); + }); + + it('should return false for non-string values', () => { + expect(isString(123)).toBe(false); + expect(isString(true)).toBe(false); + expect(isString(false)).toBe(false); + expect(isString(null)).toBe(false); + expect(isString(undefined)).toBe(false); + expect(isString([])).toBe(false); + expect(isString({})).toBe(false); + expect(isString(new Date())).toBe(false); + }); +}); \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-string.ts b/packages/utilities/src/lib/ts-guards/is-string.ts new file mode 100644 index 0000000..2eac35e --- /dev/null +++ b/packages/utilities/src/lib/ts-guards/is-string.ts @@ -0,0 +1,3 @@ +export function isString(value: unknown): value is string { + return typeof value === 'string'; +} \ No newline at end of file From 8eeef5ee7492e7a6a548e61226a07dff3e93cbdf Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Fri, 25 Jul 2025 10:06:05 +0200 Subject: [PATCH 02/15] docs(utilities): add some docs --- packages/utilities/src/lib/ts-guards/is-defined.ts | 3 +++ packages/utilities/src/lib/ts-guards/is-number.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/utilities/src/lib/ts-guards/is-defined.ts b/packages/utilities/src/lib/ts-guards/is-defined.ts index e81adaa..0ad014b 100644 --- a/packages/utilities/src/lib/ts-guards/is-defined.ts +++ b/packages/utilities/src/lib/ts-guards/is-defined.ts @@ -1,3 +1,6 @@ +/** + * Checks if a value is defined (not undefined or null). + */ export function isDefined(value: T | undefined | null): value is T { return value !== undefined && value !== null; } \ No newline at end of file diff --git a/packages/utilities/src/lib/ts-guards/is-number.ts b/packages/utilities/src/lib/ts-guards/is-number.ts index 9463208..a46e001 100644 --- a/packages/utilities/src/lib/ts-guards/is-number.ts +++ b/packages/utilities/src/lib/ts-guards/is-number.ts @@ -1,3 +1,6 @@ +/** + * Checks if the provided value is a number. (NaN is technically a number, but this function returns false for NaN.) + */ export function isNumber(value: unknown): value is number { return typeof value === 'number' && !isNaN(value); } \ No newline at end of file From 4bfa6b5312069d331783fd17691d28ddd7aaec0a Mon Sep 17 00:00:00 2001 From: Github Actions Date: Fri, 25 Jul 2025 08:08:41 +0000 Subject: [PATCH 03/15] build(release): next version [skip_build] - @shiftcode/logger@3.0.1-pr53.0 - @shiftcode/utilities@4.1.0-pr53.0 --- package-lock.json | 6 +++--- packages/logger/package.json | 4 ++-- packages/utilities/package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5924ce..ef0d31c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14907,10 +14907,10 @@ }, "packages/logger": { "name": "@shiftcode/logger", - "version": "3.0.0", + "version": "3.0.1-pr53.0", "license": "UNLICENSED", "devDependencies": { - "@shiftcode/utilities": "^4.0.0" + "@shiftcode/utilities": "^4.1.0-pr53.0" }, "engines": { "node": "^20.0.0 || ^22.0.0" @@ -14957,7 +14957,7 @@ }, "packages/utilities": { "name": "@shiftcode/utilities", - "version": "4.0.0", + "version": "4.1.0-pr53.0", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" diff --git a/packages/logger/package.json b/packages/logger/package.json index 5f42e0d..d220070 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/logger", - "version": "3.0.0", + "version": "3.0.1-pr53.0", "description": "logger for local and aws lambda execution", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -35,7 +35,7 @@ "test:watch": "npm run test -- --watch" }, "devDependencies": { - "@shiftcode/utilities": "^4.0.0" + "@shiftcode/utilities": "^4.1.0-pr53.0" }, "peerDependencies": { "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr45" diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 80bb2ab..34bcd72 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/utilities", - "version": "4.0.0", + "version": "4.1.0-pr53.0", "description": "Contains some utilities", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", From 844978c8871bd8ef96cb5d62f78aba3d0d6d90b7 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Fri, 25 Jul 2025 10:25:28 +0200 Subject: [PATCH 04/15] refactor(logger): update to correct prerelease version --- packages/logger/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/logger/package.json b/packages/logger/package.json index d220070..0ad6b1c 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -38,7 +38,7 @@ "@shiftcode/utilities": "^4.1.0-pr53.0" }, "peerDependencies": { - "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr45" + "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr53" }, "engines": { "node": "^20.0.0 || ^22.0.0" From 887937ccdc436b9958323497a77278e848a6f25a Mon Sep 17 00:00:00 2001 From: Github Actions Date: Fri, 25 Jul 2025 08:27:39 +0000 Subject: [PATCH 05/15] build(release): next version [skip_build] - @shiftcode/logger@3.0.1-pr53.1 - @shiftcode/utilities@4.1.0-pr53.1 --- package-lock.json | 8 ++++---- packages/logger/package.json | 4 ++-- packages/utilities/package.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef0d31c..2e81097 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14907,16 +14907,16 @@ }, "packages/logger": { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.0", + "version": "3.0.1-pr53.1", "license": "UNLICENSED", "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.0" + "@shiftcode/utilities": "^4.1.0-pr53.1" }, "engines": { "node": "^20.0.0 || ^22.0.0" }, "peerDependencies": { - "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr45" + "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr53" } }, "packages/publish-helper": { @@ -14957,7 +14957,7 @@ }, "packages/utilities": { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.0", + "version": "4.1.0-pr53.1", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" diff --git a/packages/logger/package.json b/packages/logger/package.json index 0ad6b1c..14d7709 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.0", + "version": "3.0.1-pr53.1", "description": "logger for local and aws lambda execution", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -35,7 +35,7 @@ "test:watch": "npm run test -- --watch" }, "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.0" + "@shiftcode/utilities": "^4.1.0-pr53.1" }, "peerDependencies": { "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr53" diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 34bcd72..f2cc67b 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.0", + "version": "4.1.0-pr53.1", "description": "Contains some utilities", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", From cd29211c2bba0a1b92549a57359a04ac8614201c Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 9 Sep 2025 06:25:30 +0000 Subject: [PATCH 06/15] build(release): next version [skip_build] - @shiftcode/logger@3.0.1-pr53.2 - @shiftcode/utilities@4.1.0-pr53.2 --- package-lock.json | 6 +++--- packages/logger/package.json | 4 ++-- packages/utilities/package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 770e320..ae87857 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14907,10 +14907,10 @@ }, "packages/logger": { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.1", + "version": "3.0.1-pr53.2", "license": "UNLICENSED", "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.1" + "@shiftcode/utilities": "^4.1.0-pr53.2" }, "engines": { "node": "^20.0.0 || ^22.0.0" @@ -14957,7 +14957,7 @@ }, "packages/utilities": { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.1", + "version": "4.1.0-pr53.2", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" diff --git a/packages/logger/package.json b/packages/logger/package.json index 14d7709..4c1bd60 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.1", + "version": "3.0.1-pr53.2", "description": "logger for local and aws lambda execution", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -35,7 +35,7 @@ "test:watch": "npm run test -- --watch" }, "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.1" + "@shiftcode/utilities": "^4.1.0-pr53.2" }, "peerDependencies": { "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr53" diff --git a/packages/utilities/package.json b/packages/utilities/package.json index f2cc67b..6e88d5a 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.1", + "version": "4.1.0-pr53.2", "description": "Contains some utilities", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", From 1939bfaacba49fc27bc30c1d4d7f190196ace8e2 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 9 Sep 2025 08:47:59 +0200 Subject: [PATCH 07/15] refactor(utils): use consistent naming --- packages/utilities/src/lib/ts-guards/is-class.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/utilities/src/lib/ts-guards/is-class.ts b/packages/utilities/src/lib/ts-guards/is-class.ts index 3a8d1e3..e47cc80 100644 --- a/packages/utilities/src/lib/ts-guards/is-class.ts +++ b/packages/utilities/src/lib/ts-guards/is-class.ts @@ -1,5 +1,5 @@ export function isClass any>(v: T): v is T -export function isClass(v: any): v is new (...args: any[]) => any -export function isClass(v: any): v is new (...args: any[]) => any { - return typeof v === 'function' && /^\s*class\s+/.test(v.toString()) +export function isClass(value: unknown): value is new (...args: any[]) => any +export function isClass(value: unknown): value is new (...args: any[]) => any { + return typeof value === 'function' && /^\s*class\s+/.test(value.toString()) } \ No newline at end of file From 2630b3cef0577db7a66fa4e1520e4d595fa2c820 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 9 Sep 2025 06:50:33 +0000 Subject: [PATCH 08/15] build(release): next version [skip_build] - @shiftcode/logger@3.0.1-pr53.3 - @shiftcode/utilities@4.1.0-pr53.3 --- package-lock.json | 6 +++--- packages/logger/package.json | 4 ++-- packages/utilities/package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index ae87857..60977ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14907,10 +14907,10 @@ }, "packages/logger": { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.2", + "version": "3.0.1-pr53.3", "license": "UNLICENSED", "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.2" + "@shiftcode/utilities": "^4.1.0-pr53.3" }, "engines": { "node": "^20.0.0 || ^22.0.0" @@ -14957,7 +14957,7 @@ }, "packages/utilities": { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.2", + "version": "4.1.0-pr53.3", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" diff --git a/packages/logger/package.json b/packages/logger/package.json index 4c1bd60..bdf461a 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.2", + "version": "3.0.1-pr53.3", "description": "logger for local and aws lambda execution", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -35,7 +35,7 @@ "test:watch": "npm run test -- --watch" }, "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.2" + "@shiftcode/utilities": "^4.1.0-pr53.3" }, "peerDependencies": { "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr53" diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 6e88d5a..4b236f7 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.2", + "version": "4.1.0-pr53.3", "description": "Contains some utilities", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", From 355b0b4a1d7639cdbbbc29bd6bfa63cafde5bdd1 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 9 Sep 2025 08:58:04 +0200 Subject: [PATCH 09/15] build(*): add prettier check to CI --- .github/workflows/main.yml | 3 +++ package.json | 1 + packages/branch-utilities/package.json | 4 +++- packages/eslint-config-recommended/package.json | 4 +++- packages/eslint-plugin-rules/package.json | 4 +++- packages/logger/package.json | 4 +++- packages/publish-helper/package.json | 4 +++- packages/utilities/package.json | 4 +++- 8 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fbb0458..f838653 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,6 +93,9 @@ jobs: # build lint plugins before linting - name: Build lint plugins run: npm run build:lint:ci + # check formatting + - name: Prettier Check + run: npm run prettier:check # lint - name: Lint run: npm run lint:ci diff --git a/package.json b/package.json index 17ba8b8..5551106 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "lint:ci": "lerna run lint:ci", "prepare": "husky", "prettier": "lerna run prettier", + "prettier:check": "lerna run prettier:check", "publish-libs": "node packages/publish-helper/dist/publish-lib", "test:ci": "lerna run test:ci" }, diff --git a/packages/branch-utilities/package.json b/packages/branch-utilities/package.json index 093b880..bdbe945 100644 --- a/packages/branch-utilities/package.json +++ b/packages/branch-utilities/package.json @@ -21,7 +21,9 @@ "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "prettier --write --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier": "npm run prettier:base -- --write", + "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier:check": "npm run prettier:base -- --check", "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js", diff --git a/packages/eslint-config-recommended/package.json b/packages/eslint-config-recommended/package.json index 4e9909b..6160d5c 100644 --- a/packages/eslint-config-recommended/package.json +++ b/packages/eslint-config-recommended/package.json @@ -29,7 +29,9 @@ "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "prettier --write --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier": "npm run prettier:base -- --write", + "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier:check": "npm run prettier:base -- --check", "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "echo 'Error: no test specificed'", diff --git a/packages/eslint-plugin-rules/package.json b/packages/eslint-plugin-rules/package.json index d587976..0c9be24 100644 --- a/packages/eslint-plugin-rules/package.json +++ b/packages/eslint-plugin-rules/package.json @@ -19,7 +19,9 @@ "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "prettier --write --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier": "npm run prettier:base -- --write", + "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier:check": "npm run prettier:base -- --check", "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "jest", diff --git a/packages/logger/package.json b/packages/logger/package.json index 4c1bd60..3a9ac25 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -27,7 +27,9 @@ "lint:staged": "npm run lint", "lint:test": "eslint ./test", "lint:test:fix": "eslint ./test --cache --fix", - "prettier": "prettier --write --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier": "npm run prettier:base -- --write", + "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier:check": "npm run prettier:base -- --check", "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js", diff --git a/packages/publish-helper/package.json b/packages/publish-helper/package.json index e8d6060..4de502f 100644 --- a/packages/publish-helper/package.json +++ b/packages/publish-helper/package.json @@ -18,7 +18,9 @@ "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "prettier --write --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier": "npm run prettier:base -- --write", + "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier:check": "npm run prettier:base -- --check", "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ./dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js --passWithNoTests", diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 6e88d5a..1207d74 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -21,7 +21,9 @@ "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "prettier --write --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier": "npm run prettier:base -- --write", + "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "prettier:check": "npm run prettier:base -- --check", "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js", From cb60f0c7dec3824db058a171e09873864af4f9a3 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 9 Sep 2025 09:04:10 +0200 Subject: [PATCH 10/15] refactor(*): prettify whole code base --- .../src/lib/base.utils.spec.ts | 13 ++++-- .../branch-utilities/src/lib/base.utils.ts | 8 ++-- packages/publish-helper/src/prepare-dist.ts | 2 +- .../src/lib/ts-guards/is-array.spec.ts | 34 ++++++++-------- .../utilities/src/lib/ts-guards/is-array.ts | 4 +- .../src/lib/ts-guards/is-boolean.spec.ts | 30 +++++++------- .../utilities/src/lib/ts-guards/is-boolean.ts | 4 +- .../src/lib/ts-guards/is-class.spec.ts | 31 +++++++------- .../utilities/src/lib/ts-guards/is-class.ts | 2 +- .../src/lib/ts-guards/is-date.spec.ts | 34 ++++++++-------- .../utilities/src/lib/ts-guards/is-date.ts | 4 +- .../src/lib/ts-guards/is-defined.spec.ts | 26 ++++++------ .../utilities/src/lib/ts-guards/is-defined.ts | 4 +- .../src/lib/ts-guards/is-number.spec.ts | 40 +++++++++---------- .../utilities/src/lib/ts-guards/is-number.ts | 4 +- .../src/lib/ts-guards/is-string.spec.ts | 32 +++++++-------- .../utilities/src/lib/ts-guards/is-string.ts | 4 +- 17 files changed, 141 insertions(+), 135 deletions(-) diff --git a/packages/branch-utilities/src/lib/base.utils.spec.ts b/packages/branch-utilities/src/lib/base.utils.spec.ts index e57ca14..befd57d 100644 --- a/packages/branch-utilities/src/lib/base.utils.spec.ts +++ b/packages/branch-utilities/src/lib/base.utils.spec.ts @@ -81,9 +81,10 @@ describe('base utils', () => { }) describe('parseBranchName', () => { - test('works when valid pattern', () => { - expect(parseBranchName('#7-abc')).toEqual({ branchId: 7, branchName: 'abc' } satisfies ReturnType) + expect(parseBranchName('#7-abc')).toEqual({ branchId: 7, branchName: 'abc' } satisfies ReturnType< + typeof parseBranchName + >) expect(parseBranchName('#72-abc').branchId).toBe(72) expect(parseBranchName('#000-int').branchId).toBe(0) @@ -94,8 +95,12 @@ describe('base utils', () => { }) test('works for github copilot created branches', () => { - expect(parseBranchName('copilot/fix-123')).toEqual({ branchId: 123, branchName: 'fix' } satisfies ReturnType) - expect(parseBranchName('copilot/feat-123')).toEqual({ branchId: 123, branchName: 'feat' } satisfies ReturnType) + expect(parseBranchName('copilot/fix-123')).toEqual({ branchId: 123, branchName: 'fix' } satisfies ReturnType< + typeof parseBranchName + >) + expect(parseBranchName('copilot/feat-123')).toEqual({ branchId: 123, branchName: 'feat' } satisfies ReturnType< + typeof parseBranchName + >) }) test('throws when invalid pattern', () => { diff --git a/packages/branch-utilities/src/lib/base.utils.ts b/packages/branch-utilities/src/lib/base.utils.ts index 5f39748..c906fcb 100644 --- a/packages/branch-utilities/src/lib/base.utils.ts +++ b/packages/branch-utilities/src/lib/base.utils.ts @@ -90,9 +90,11 @@ export function getBranchInfo(env: unknown, branchName?: string): BranchInfo { } export function isFullBranchOverrideDefined(envVars: unknown): envVars is CustomScOverrideEnv { - return envVars !== null - && typeof (envVars as CustomScOverrideEnv).SC_OVERRIDE_BRANCH_NAME ==='string' - && typeof (envVars as CustomScOverrideEnv).SC_OVERRIDE_IS_PR ==='string' + return ( + envVars !== null && + typeof (envVars as CustomScOverrideEnv).SC_OVERRIDE_BRANCH_NAME === 'string' && + typeof (envVars as CustomScOverrideEnv).SC_OVERRIDE_IS_PR === 'string' + ) } export function getBranchNameOverride(env: CustomScOverrideEnv): string { diff --git a/packages/publish-helper/src/prepare-dist.ts b/packages/publish-helper/src/prepare-dist.ts index 4d10f90..2685a5e 100644 --- a/packages/publish-helper/src/prepare-dist.ts +++ b/packages/publish-helper/src/prepare-dist.ts @@ -18,7 +18,7 @@ const argv = yargs(hideBin(process.argv)).option('include', { type: 'array', description: 'copy additional files into the dist folder', default: [], - string: true + string: true, }).argv function log(...args: any[]) { diff --git a/packages/utilities/src/lib/ts-guards/is-array.spec.ts b/packages/utilities/src/lib/ts-guards/is-array.spec.ts index 10dd2fc..02e36b1 100644 --- a/packages/utilities/src/lib/ts-guards/is-array.spec.ts +++ b/packages/utilities/src/lib/ts-guards/is-array.spec.ts @@ -1,23 +1,23 @@ -import { isArray } from './is-array.js'; +import { isArray } from './is-array.js' describe('isArray', () => { it('should return true for array values', () => { - expect(isArray([])).toBe(true); - expect(isArray([1, 2, 3])).toBe(true); - expect(isArray(['a', 'b', 'c'])).toBe(true); - expect(isArray([null, undefined])).toBe(true); + expect(isArray([])).toBe(true) + expect(isArray([1, 2, 3])).toBe(true) + expect(isArray(['a', 'b', 'c'])).toBe(true) + expect(isArray([null, undefined])).toBe(true) // eslint-disable-next-line @typescript-eslint/no-array-constructor - expect(isArray(new Array())).toBe(true); - }); + expect(isArray(new Array())).toBe(true) + }) it('should return false for non-array values', () => { - expect(isArray('array')).toBe(false); - expect(isArray(123)).toBe(false); - expect(isArray(true)).toBe(false); - expect(isArray(null)).toBe(false); - expect(isArray(undefined)).toBe(false); - expect(isArray({})).toBe(false); - expect(isArray(new Date())).toBe(false); - expect(isArray({ length: 0 })).toBe(false); - }); -}); \ No newline at end of file + expect(isArray('array')).toBe(false) + expect(isArray(123)).toBe(false) + expect(isArray(true)).toBe(false) + expect(isArray(null)).toBe(false) + expect(isArray(undefined)).toBe(false) + expect(isArray({})).toBe(false) + expect(isArray(new Date())).toBe(false) + expect(isArray({ length: 0 })).toBe(false) + }) +}) diff --git a/packages/utilities/src/lib/ts-guards/is-array.ts b/packages/utilities/src/lib/ts-guards/is-array.ts index 23caaca..b783132 100644 --- a/packages/utilities/src/lib/ts-guards/is-array.ts +++ b/packages/utilities/src/lib/ts-guards/is-array.ts @@ -1,3 +1,3 @@ export function isArray(value: unknown): value is unknown[] { - return Array.isArray(value); -} \ No newline at end of file + return Array.isArray(value) +} diff --git a/packages/utilities/src/lib/ts-guards/is-boolean.spec.ts b/packages/utilities/src/lib/ts-guards/is-boolean.spec.ts index 4ad5b0e..520d1f6 100644 --- a/packages/utilities/src/lib/ts-guards/is-boolean.spec.ts +++ b/packages/utilities/src/lib/ts-guards/is-boolean.spec.ts @@ -1,20 +1,20 @@ -import { isBoolean } from './is-boolean.js'; +import { isBoolean } from './is-boolean.js' describe('isBoolean', () => { it('should return true for boolean values', () => { - expect(isBoolean(true)).toBe(true); - expect(isBoolean(false)).toBe(true); - }); + expect(isBoolean(true)).toBe(true) + expect(isBoolean(false)).toBe(true) + }) it('should return false for non-boolean values', () => { - expect(isBoolean(1)).toBe(false); - expect(isBoolean(0)).toBe(false); - expect(isBoolean('true')).toBe(false); - expect(isBoolean('false')).toBe(false); - expect(isBoolean(null)).toBe(false); - expect(isBoolean(undefined)).toBe(false); - expect(isBoolean([])).toBe(false); - expect(isBoolean({})).toBe(false); - expect(isBoolean(new Date())).toBe(false); - }); -}); \ No newline at end of file + expect(isBoolean(1)).toBe(false) + expect(isBoolean(0)).toBe(false) + expect(isBoolean('true')).toBe(false) + expect(isBoolean('false')).toBe(false) + expect(isBoolean(null)).toBe(false) + expect(isBoolean(undefined)).toBe(false) + expect(isBoolean([])).toBe(false) + expect(isBoolean({})).toBe(false) + expect(isBoolean(new Date())).toBe(false) + }) +}) diff --git a/packages/utilities/src/lib/ts-guards/is-boolean.ts b/packages/utilities/src/lib/ts-guards/is-boolean.ts index b4bd29b..9e60021 100644 --- a/packages/utilities/src/lib/ts-guards/is-boolean.ts +++ b/packages/utilities/src/lib/ts-guards/is-boolean.ts @@ -1,3 +1,3 @@ export function isBoolean(value: unknown): value is boolean { - return typeof value === 'boolean'; -} \ No newline at end of file + return typeof value === 'boolean' +} diff --git a/packages/utilities/src/lib/ts-guards/is-class.spec.ts b/packages/utilities/src/lib/ts-guards/is-class.spec.ts index 2e29463..93356e0 100644 --- a/packages/utilities/src/lib/ts-guards/is-class.spec.ts +++ b/packages/utilities/src/lib/ts-guards/is-class.spec.ts @@ -1,26 +1,25 @@ -import { isClass } from './is-class.js'; +import { isClass } from './is-class.js' class TestClass { constructor() {} - x(){} + x() {} } describe('isClass', () => { it('should return true for classes', () => { - expect(isClass(TestClass)).toBe(true); - }); - + expect(isClass(TestClass)).toBe(true) + }) it('should return false for non-class values', () => { - expect(isClass('string')).toBe(false); - expect(isClass(123)).toBe(false); - expect(isClass(true)).toBe(false); - expect(isClass(null)).toBe(false); - expect(isClass(undefined)).toBe(false); - expect(isClass([])).toBe(false); - expect(isClass({})).toBe(false); - expect(isClass(function y(){})).toBe(false); - expect(isClass(new TestClass().x)).toBe(false); - }); -}); \ No newline at end of file + expect(isClass('string')).toBe(false) + expect(isClass(123)).toBe(false) + expect(isClass(true)).toBe(false) + expect(isClass(null)).toBe(false) + expect(isClass(undefined)).toBe(false) + expect(isClass([])).toBe(false) + expect(isClass({})).toBe(false) + expect(isClass(function y() {})).toBe(false) + expect(isClass(new TestClass().x)).toBe(false) + }) +}) diff --git a/packages/utilities/src/lib/ts-guards/is-class.ts b/packages/utilities/src/lib/ts-guards/is-class.ts index e47cc80..49bcd38 100644 --- a/packages/utilities/src/lib/ts-guards/is-class.ts +++ b/packages/utilities/src/lib/ts-guards/is-class.ts @@ -2,4 +2,4 @@ export function isClass any>(v: T): v is T export function isClass(value: unknown): value is new (...args: any[]) => any export function isClass(value: unknown): value is new (...args: any[]) => any { return typeof value === 'function' && /^\s*class\s+/.test(value.toString()) -} \ No newline at end of file +} diff --git a/packages/utilities/src/lib/ts-guards/is-date.spec.ts b/packages/utilities/src/lib/ts-guards/is-date.spec.ts index 4990656..4026291 100644 --- a/packages/utilities/src/lib/ts-guards/is-date.spec.ts +++ b/packages/utilities/src/lib/ts-guards/is-date.spec.ts @@ -1,22 +1,22 @@ -import { isDate } from './is-date.js'; +import { isDate } from './is-date.js' describe('isDate', () => { it('should return true for Date objects', () => { - expect(isDate(new Date())).toBe(true); - expect(isDate(new Date('2023-01-01'))).toBe(true); - expect(isDate(new Date(2023, 0, 1))).toBe(true); - expect(isDate(new Date(Date.now()))).toBe(true); - }); + expect(isDate(new Date())).toBe(true) + expect(isDate(new Date('2023-01-01'))).toBe(true) + expect(isDate(new Date(2023, 0, 1))).toBe(true) + expect(isDate(new Date(Date.now()))).toBe(true) + }) it('should return false for non-Date values', () => { - expect(isDate('2023-01-01')).toBe(false); - expect(isDate(1672531200000)).toBe(false); - expect(isDate(true)).toBe(false); - expect(isDate(false)).toBe(false); - expect(isDate(null)).toBe(false); - expect(isDate(undefined)).toBe(false); - expect(isDate([])).toBe(false); - expect(isDate({})).toBe(false); - expect(isDate('hello')).toBe(false); - }); -}); \ No newline at end of file + expect(isDate('2023-01-01')).toBe(false) + expect(isDate(1672531200000)).toBe(false) + expect(isDate(true)).toBe(false) + expect(isDate(false)).toBe(false) + expect(isDate(null)).toBe(false) + expect(isDate(undefined)).toBe(false) + expect(isDate([])).toBe(false) + expect(isDate({})).toBe(false) + expect(isDate('hello')).toBe(false) + }) +}) diff --git a/packages/utilities/src/lib/ts-guards/is-date.ts b/packages/utilities/src/lib/ts-guards/is-date.ts index 911dc58..e698d74 100644 --- a/packages/utilities/src/lib/ts-guards/is-date.ts +++ b/packages/utilities/src/lib/ts-guards/is-date.ts @@ -1,3 +1,3 @@ export function isDate(value: unknown): value is Date { - return value instanceof Date; -} \ No newline at end of file + return value instanceof Date +} diff --git a/packages/utilities/src/lib/ts-guards/is-defined.spec.ts b/packages/utilities/src/lib/ts-guards/is-defined.spec.ts index 6f1a2c8..8e54c8c 100644 --- a/packages/utilities/src/lib/ts-guards/is-defined.spec.ts +++ b/packages/utilities/src/lib/ts-guards/is-defined.spec.ts @@ -1,18 +1,18 @@ -import { isDefined } from './is-defined.js'; +import { isDefined } from './is-defined.js' describe('isDefined', () => { it('should return true for defined values', () => { - expect(isDefined('')).toBe(true); - expect(isDefined(0)).toBe(true); - expect(isDefined(false)).toBe(true); - expect(isDefined([])).toBe(true); - expect(isDefined({})).toBe(true); - expect(isDefined('hello')).toBe(true); - expect(isDefined(123)).toBe(true); - }); + expect(isDefined('')).toBe(true) + expect(isDefined(0)).toBe(true) + expect(isDefined(false)).toBe(true) + expect(isDefined([])).toBe(true) + expect(isDefined({})).toBe(true) + expect(isDefined('hello')).toBe(true) + expect(isDefined(123)).toBe(true) + }) it('should return false for undefined values', () => { - expect(isDefined(undefined)).toBe(false); - expect(isDefined(null)).toBe(false); - }); -}); \ No newline at end of file + expect(isDefined(undefined)).toBe(false) + expect(isDefined(null)).toBe(false) + }) +}) diff --git a/packages/utilities/src/lib/ts-guards/is-defined.ts b/packages/utilities/src/lib/ts-guards/is-defined.ts index 0ad014b..8ccf63b 100644 --- a/packages/utilities/src/lib/ts-guards/is-defined.ts +++ b/packages/utilities/src/lib/ts-guards/is-defined.ts @@ -2,5 +2,5 @@ * Checks if a value is defined (not undefined or null). */ export function isDefined(value: T | undefined | null): value is T { - return value !== undefined && value !== null; -} \ No newline at end of file + return value !== undefined && value !== null +} diff --git a/packages/utilities/src/lib/ts-guards/is-number.spec.ts b/packages/utilities/src/lib/ts-guards/is-number.spec.ts index cdd1001..2061ea1 100644 --- a/packages/utilities/src/lib/ts-guards/is-number.spec.ts +++ b/packages/utilities/src/lib/ts-guards/is-number.spec.ts @@ -1,27 +1,27 @@ -import { isNumber } from './is-number.js'; +import { isNumber } from './is-number.js' describe('isNumber', () => { it('should return true for valid number values', () => { - expect(isNumber(0)).toBe(true); - expect(isNumber(123)).toBe(true); - expect(isNumber(-456)).toBe(true); - expect(isNumber(3.14)).toBe(true); - expect(isNumber(Infinity)).toBe(true); - expect(isNumber(-Infinity)).toBe(true); - }); + expect(isNumber(0)).toBe(true) + expect(isNumber(123)).toBe(true) + expect(isNumber(-456)).toBe(true) + expect(isNumber(3.14)).toBe(true) + expect(isNumber(Infinity)).toBe(true) + expect(isNumber(-Infinity)).toBe(true) + }) it('should return false for NaN', () => { - expect(isNumber(NaN)).toBe(false); - }); + expect(isNumber(NaN)).toBe(false) + }) it('should return false for non-number values', () => { - expect(isNumber('123')).toBe(false); - expect(isNumber(true)).toBe(false); - expect(isNumber(false)).toBe(false); - expect(isNumber(null)).toBe(false); - expect(isNumber(undefined)).toBe(false); - expect(isNumber([])).toBe(false); - expect(isNumber({})).toBe(false); - expect(isNumber(new Date())).toBe(false); - }); -}); \ No newline at end of file + expect(isNumber('123')).toBe(false) + expect(isNumber(true)).toBe(false) + expect(isNumber(false)).toBe(false) + expect(isNumber(null)).toBe(false) + expect(isNumber(undefined)).toBe(false) + expect(isNumber([])).toBe(false) + expect(isNumber({})).toBe(false) + expect(isNumber(new Date())).toBe(false) + }) +}) diff --git a/packages/utilities/src/lib/ts-guards/is-number.ts b/packages/utilities/src/lib/ts-guards/is-number.ts index a46e001..432eac2 100644 --- a/packages/utilities/src/lib/ts-guards/is-number.ts +++ b/packages/utilities/src/lib/ts-guards/is-number.ts @@ -2,5 +2,5 @@ * Checks if the provided value is a number. (NaN is technically a number, but this function returns false for NaN.) */ export function isNumber(value: unknown): value is number { - return typeof value === 'number' && !isNaN(value); -} \ No newline at end of file + return typeof value === 'number' && !isNaN(value) +} diff --git a/packages/utilities/src/lib/ts-guards/is-string.spec.ts b/packages/utilities/src/lib/ts-guards/is-string.spec.ts index 859ecb3..75d4787 100644 --- a/packages/utilities/src/lib/ts-guards/is-string.spec.ts +++ b/packages/utilities/src/lib/ts-guards/is-string.spec.ts @@ -1,21 +1,21 @@ -import { isString } from './is-string.js'; +import { isString } from './is-string.js' describe('isString', () => { it('should return true for string values', () => { - expect(isString('')).toBe(true); - expect(isString('hello')).toBe(true); - expect(isString('123')).toBe(true); - expect(isString(' ')).toBe(true); - }); + expect(isString('')).toBe(true) + expect(isString('hello')).toBe(true) + expect(isString('123')).toBe(true) + expect(isString(' ')).toBe(true) + }) it('should return false for non-string values', () => { - expect(isString(123)).toBe(false); - expect(isString(true)).toBe(false); - expect(isString(false)).toBe(false); - expect(isString(null)).toBe(false); - expect(isString(undefined)).toBe(false); - expect(isString([])).toBe(false); - expect(isString({})).toBe(false); - expect(isString(new Date())).toBe(false); - }); -}); \ No newline at end of file + expect(isString(123)).toBe(false) + expect(isString(true)).toBe(false) + expect(isString(false)).toBe(false) + expect(isString(null)).toBe(false) + expect(isString(undefined)).toBe(false) + expect(isString([])).toBe(false) + expect(isString({})).toBe(false) + expect(isString(new Date())).toBe(false) + }) +}) diff --git a/packages/utilities/src/lib/ts-guards/is-string.ts b/packages/utilities/src/lib/ts-guards/is-string.ts index 2eac35e..3c257ba 100644 --- a/packages/utilities/src/lib/ts-guards/is-string.ts +++ b/packages/utilities/src/lib/ts-guards/is-string.ts @@ -1,3 +1,3 @@ export function isString(value: unknown): value is string { - return typeof value === 'string'; -} \ No newline at end of file + return typeof value === 'string' +} From 50efcc1f6151510febf9a9a12c3f8d9992d93825 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 9 Sep 2025 07:06:39 +0000 Subject: [PATCH 11/15] build(release): next version [skip_build] - @shiftcode/branch-utilities@5.0.1-pr53.0 - @shiftcode/eslint-config-recommended@5.0.1-pr53.0 - @shiftcode/eslint-plugin-rules@4.0.1-pr53.0 - @shiftcode/logger@3.0.1-pr53.4 - @shiftcode/publish-helper@4.1.1-pr53.0 - @shiftcode/utilities@4.1.0-pr53.4 --- package-lock.json | 18 +++++++++--------- packages/branch-utilities/package.json | 2 +- .../eslint-config-recommended/package.json | 4 ++-- packages/eslint-plugin-rules/package.json | 2 +- packages/logger/package.json | 4 ++-- packages/publish-helper/package.json | 4 ++-- packages/utilities/package.json | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 60977ba..b24b4a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14836,7 +14836,7 @@ }, "packages/branch-utilities": { "name": "@shiftcode/branch-utilities", - "version": "5.0.0", + "version": "5.0.1-pr53.0", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" @@ -14847,10 +14847,10 @@ }, "packages/eslint-config-recommended": { "name": "@shiftcode/eslint-config-recommended", - "version": "5.0.0", + "version": "5.0.1-pr53.0", "license": "UNLICENSED", "dependencies": { - "@shiftcode/eslint-plugin-rules": "^4.0.0", + "@shiftcode/eslint-plugin-rules": "^4.0.1-pr53.0", "@typescript-eslint/eslint-plugin": "^8.18.0", "@typescript-eslint/parser": "^8.18.0", "eslint": "^8.56.0", @@ -14888,7 +14888,7 @@ }, "packages/eslint-plugin-rules": { "name": "@shiftcode/eslint-plugin-rules", - "version": "4.0.0", + "version": "4.0.1-pr53.0", "license": "UNLICENSED", "dependencies": { "@eslint/eslintrc": "^2.1.4", @@ -14907,10 +14907,10 @@ }, "packages/logger": { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.3", + "version": "3.0.1-pr53.4", "license": "UNLICENSED", "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.3" + "@shiftcode/utilities": "^4.1.0-pr53.4" }, "engines": { "node": "^20.0.0 || ^22.0.0" @@ -14921,7 +14921,7 @@ }, "packages/publish-helper": { "name": "@shiftcode/publish-helper", - "version": "4.1.0", + "version": "4.1.1-pr53.0", "license": "MIT", "dependencies": { "conventional-changelog-angular": "^8.0.0", @@ -14932,7 +14932,7 @@ "publish-lib": "dist/publish-lib.js" }, "devDependencies": { - "@shiftcode/branch-utilities": "^5.0.0", + "@shiftcode/branch-utilities": "^5.0.1-pr53.0", "@types/yargs": "^17.0.32" }, "engines": { @@ -14957,7 +14957,7 @@ }, "packages/utilities": { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.3", + "version": "4.1.0-pr53.4", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" diff --git a/packages/branch-utilities/package.json b/packages/branch-utilities/package.json index bdbe945..d3ddfab 100644 --- a/packages/branch-utilities/package.json +++ b/packages/branch-utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/branch-utilities", - "version": "5.0.0", + "version": "5.0.1-pr53.0", "description": "Utilities for local and ci to get branch name and stage", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", diff --git a/packages/eslint-config-recommended/package.json b/packages/eslint-config-recommended/package.json index 6160d5c..b4dd6ef 100644 --- a/packages/eslint-config-recommended/package.json +++ b/packages/eslint-config-recommended/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/eslint-config-recommended", - "version": "5.0.0", + "version": "5.0.1-pr53.0", "description": "default shiftcode config for eslint", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -38,7 +38,7 @@ "test:ci": "npm run test" }, "dependencies": { - "@shiftcode/eslint-plugin-rules": "^4.0.0", + "@shiftcode/eslint-plugin-rules": "^4.0.1-pr53.0", "@typescript-eslint/eslint-plugin": "^8.18.0", "@typescript-eslint/parser": "^8.18.0", "eslint": "^8.56.0", diff --git a/packages/eslint-plugin-rules/package.json b/packages/eslint-plugin-rules/package.json index 0c9be24..8922768 100644 --- a/packages/eslint-plugin-rules/package.json +++ b/packages/eslint-plugin-rules/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/eslint-plugin-rules", - "version": "4.0.0", + "version": "4.0.1-pr53.0", "description": "eslint-rules for shiftcode-specific eslint rules", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", diff --git a/packages/logger/package.json b/packages/logger/package.json index 04a7e98..8f1d164 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.3", + "version": "3.0.1-pr53.4", "description": "logger for local and aws lambda execution", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -37,7 +37,7 @@ "test:watch": "npm run test -- --watch" }, "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.3" + "@shiftcode/utilities": "^4.1.0-pr53.4" }, "peerDependencies": { "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr53" diff --git a/packages/publish-helper/package.json b/packages/publish-helper/package.json index 4de502f..b1d54e6 100644 --- a/packages/publish-helper/package.json +++ b/packages/publish-helper/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/publish-helper", - "version": "4.1.0", + "version": "4.1.1-pr53.0", "description": "scripts for conventional (pre)releases", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", @@ -32,7 +32,7 @@ "yargs": "^17.7.2" }, "devDependencies": { - "@shiftcode/branch-utilities": "^5.0.0", + "@shiftcode/branch-utilities": "^5.0.1-pr53.0", "@types/yargs": "^17.0.32" }, "peerDependencies": { diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 2150f52..b31e7e7 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.3", + "version": "4.1.0-pr53.4", "description": "Contains some utilities", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", From 5832940bfc4bdda8b1a43f0d50e727bb368f9033 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 9 Sep 2025 09:20:02 +0200 Subject: [PATCH 12/15] refactor(*): rename lib specific names to format --- .github/workflows/main.yml | 4 ++-- package.json | 4 ++-- packages/branch-utilities/.lintstagedrc.yml | 2 +- packages/branch-utilities/package.json | 8 ++++---- packages/eslint-config-recommended/.lintstagedrc.yml | 2 +- packages/eslint-config-recommended/package.json | 8 ++++---- packages/eslint-plugin-rules/.lintstagedrc.yml | 2 +- packages/eslint-plugin-rules/package.json | 8 ++++---- packages/logger/.lintstagedrc.yml | 2 +- packages/logger/package.json | 8 ++++---- packages/publish-helper/.lintstagedrc.yml | 2 +- packages/publish-helper/package.json | 8 ++++---- packages/utilities/.lintstagedrc.yml | 2 +- packages/utilities/package.json | 8 ++++---- 14 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f838653..7bc2626 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,8 +94,8 @@ jobs: - name: Build lint plugins run: npm run build:lint:ci # check formatting - - name: Prettier Check - run: npm run prettier:check + - name: Check Formatting + run: npm run format:ci # lint - name: Lint run: npm run lint:ci diff --git a/package.json b/package.json index 5551106..7418ccc 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,10 @@ "scripts": { "build:ci": "lerna run build", "build:lint:ci": "lerna run build:lint:ci", + "format": "lerna run format", + "format:ci": "lerna run format:check", "lint:ci": "lerna run lint:ci", "prepare": "husky", - "prettier": "lerna run prettier", - "prettier:check": "lerna run prettier:check", "publish-libs": "node packages/publish-helper/dist/publish-lib", "test:ci": "lerna run test:ci" }, diff --git a/packages/branch-utilities/.lintstagedrc.yml b/packages/branch-utilities/.lintstagedrc.yml index bf45dc5..bc23b47 100644 --- a/packages/branch-utilities/.lintstagedrc.yml +++ b/packages/branch-utilities/.lintstagedrc.yml @@ -1,7 +1,7 @@ # we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) # and --files argument pointing to other files src/{**/,}*.ts,test/{**/,}*.ts: - - npm run prettier:staged + - npm run format:staged - npm run lint:staged # sort package.json keys diff --git a/packages/branch-utilities/package.json b/packages/branch-utilities/package.json index bdbe945..c5e137d 100644 --- a/packages/branch-utilities/package.json +++ b/packages/branch-utilities/package.json @@ -16,15 +16,15 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", + "format": "npm run prettier:base -- --write", + "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "format:check": "npm run prettier:base -- --check", + "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "npm run prettier:base -- --write", - "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "prettier:check": "npm run prettier:base -- --check", - "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js", "test:ci": "npm run test", diff --git a/packages/eslint-config-recommended/.lintstagedrc.yml b/packages/eslint-config-recommended/.lintstagedrc.yml index 69f89f4..f688345 100644 --- a/packages/eslint-config-recommended/.lintstagedrc.yml +++ b/packages/eslint-config-recommended/.lintstagedrc.yml @@ -1,7 +1,7 @@ # we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) # and --files argument pointing to other files src/{**/,}*.ts,test/{**/,}*.ts: - - npm run prettier:staged + - npm run format:staged - npm run lint:staged # sort package.json keys diff --git a/packages/eslint-config-recommended/package.json b/packages/eslint-config-recommended/package.json index 6160d5c..b70a83b 100644 --- a/packages/eslint-config-recommended/package.json +++ b/packages/eslint-config-recommended/package.json @@ -24,15 +24,15 @@ "prebuild": "rm -rf ./dist", "build": "tsc", "build:lint:ci": "npm run build", + "format": "npm run prettier:base -- --write", + "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "format:check": "npm run prettier:base -- --check", + "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "npm run prettier:base -- --write", - "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "prettier:check": "npm run prettier:base -- --check", - "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "echo 'Error: no test specificed'", "test:ci": "npm run test" diff --git a/packages/eslint-plugin-rules/.lintstagedrc.yml b/packages/eslint-plugin-rules/.lintstagedrc.yml index bf45dc5..bc23b47 100644 --- a/packages/eslint-plugin-rules/.lintstagedrc.yml +++ b/packages/eslint-plugin-rules/.lintstagedrc.yml @@ -1,7 +1,7 @@ # we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) # and --files argument pointing to other files src/{**/,}*.ts,test/{**/,}*.ts: - - npm run prettier:staged + - npm run format:staged - npm run lint:staged # sort package.json keys diff --git a/packages/eslint-plugin-rules/package.json b/packages/eslint-plugin-rules/package.json index 0c9be24..950a533 100644 --- a/packages/eslint-plugin-rules/package.json +++ b/packages/eslint-plugin-rules/package.json @@ -14,15 +14,15 @@ "prebuild": "rm -rf ./dist", "build": "tsc", "build:lint:ci": "npm run build", + "format": "npm run prettier:base -- --write", + "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "format:check": "npm run prettier:base -- --check", + "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "npm run prettier:base -- --write", - "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "prettier:check": "npm run prettier:base -- --check", - "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "jest", "test:ci": "npm run test" diff --git a/packages/logger/.lintstagedrc.yml b/packages/logger/.lintstagedrc.yml index 3830437..a033e03 100644 --- a/packages/logger/.lintstagedrc.yml +++ b/packages/logger/.lintstagedrc.yml @@ -1,6 +1,6 @@ # Reformat all .ts / .js "**/*.(t|j)s": - - npm run prettier:staged + - npm run format:staged - npm run lint:staged # sort package.json keys diff --git a/packages/logger/package.json b/packages/logger/package.json index 04a7e98..2f11296 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -20,6 +20,10 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", + "format": "npm run prettier:base -- --write", + "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "format:check": "npm run prettier:base -- --check", + "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix && npm run lint:test:fix", "lint:ci": "npm run lint:src && npm run lint:test", "lint:src": "eslint ./src", @@ -27,10 +31,6 @@ "lint:staged": "npm run lint", "lint:test": "eslint ./test", "lint:test:fix": "eslint ./test --cache --fix", - "prettier": "npm run prettier:base -- --write", - "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "prettier:check": "npm run prettier:base -- --check", - "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js", "test:ci": "npm run test", diff --git a/packages/publish-helper/.lintstagedrc.yml b/packages/publish-helper/.lintstagedrc.yml index bf45dc5..bc23b47 100644 --- a/packages/publish-helper/.lintstagedrc.yml +++ b/packages/publish-helper/.lintstagedrc.yml @@ -1,7 +1,7 @@ # we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) # and --files argument pointing to other files src/{**/,}*.ts,test/{**/,}*.ts: - - npm run prettier:staged + - npm run format:staged - npm run lint:staged # sort package.json keys diff --git a/packages/publish-helper/package.json b/packages/publish-helper/package.json index 4de502f..afce908 100644 --- a/packages/publish-helper/package.json +++ b/packages/publish-helper/package.json @@ -13,15 +13,15 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", + "format": "npm run prettier:base -- --write", + "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "format:check": "npm run prettier:base -- --check", + "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "npm run prettier:base -- --write", - "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "prettier:check": "npm run prettier:base -- --check", - "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ./dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js --passWithNoTests", "test:ci": "npm run test", diff --git a/packages/utilities/.lintstagedrc.yml b/packages/utilities/.lintstagedrc.yml index bf45dc5..bc23b47 100644 --- a/packages/utilities/.lintstagedrc.yml +++ b/packages/utilities/.lintstagedrc.yml @@ -1,7 +1,7 @@ # we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) # and --files argument pointing to other files src/{**/,}*.ts,test/{**/,}*.ts: - - npm run prettier:staged + - npm run format:staged - npm run lint:staged # sort package.json keys diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 2150f52..a21dfb6 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -16,15 +16,15 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", + "format": "npm run prettier:base -- --write", + "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", + "format:check": "npm run prettier:base -- --check", + "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", "lint:src": "eslint ./src", "lint:src:fix": "eslint ./src --cache --fix", "lint:staged": "eslint --fix --cache", - "prettier": "npm run prettier:base -- --write", - "prettier:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "prettier:check": "npm run prettier:base -- --check", - "prettier:staged": "prettier --write --config ../../.prettierrc.yml", "prepublish": "node ../publish-helper/dist/prepare-dist.js", "test": "NODE_OPTIONS=\"--experimental-vm-modules --trace-warnings\" npx jest --config jest.config.js", "test:ci": "npm run test", From 3329071e25ebf9c4bf703c6cbf91bff9f54dfdc9 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 9 Sep 2025 09:22:03 +0200 Subject: [PATCH 13/15] refactor(*): align lintstagedrc file pattern matching --- packages/branch-utilities/.lintstagedrc.yml | 5 ++--- packages/eslint-config-recommended/.lintstagedrc.yml | 5 ++--- packages/eslint-plugin-rules/.lintstagedrc.yml | 5 ++--- packages/publish-helper/.lintstagedrc.yml | 5 ++--- packages/utilities/.lintstagedrc.yml | 5 ++--- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/packages/branch-utilities/.lintstagedrc.yml b/packages/branch-utilities/.lintstagedrc.yml index bc23b47..a033e03 100644 --- a/packages/branch-utilities/.lintstagedrc.yml +++ b/packages/branch-utilities/.lintstagedrc.yml @@ -1,6 +1,5 @@ -# we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) -# and --files argument pointing to other files -src/{**/,}*.ts,test/{**/,}*.ts: +# Reformat all .ts / .js +"**/*.(t|j)s": - npm run format:staged - npm run lint:staged diff --git a/packages/eslint-config-recommended/.lintstagedrc.yml b/packages/eslint-config-recommended/.lintstagedrc.yml index f688345..bb9649d 100644 --- a/packages/eslint-config-recommended/.lintstagedrc.yml +++ b/packages/eslint-config-recommended/.lintstagedrc.yml @@ -1,6 +1,5 @@ -# we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) -# and --files argument pointing to other files -src/{**/,}*.ts,test/{**/,}*.ts: +# Reformat all .ts / .js +"**/*.(t|j)s": - npm run format:staged - npm run lint:staged diff --git a/packages/eslint-plugin-rules/.lintstagedrc.yml b/packages/eslint-plugin-rules/.lintstagedrc.yml index bc23b47..a033e03 100644 --- a/packages/eslint-plugin-rules/.lintstagedrc.yml +++ b/packages/eslint-plugin-rules/.lintstagedrc.yml @@ -1,6 +1,5 @@ -# we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) -# and --files argument pointing to other files -src/{**/,}*.ts,test/{**/,}*.ts: +# Reformat all .ts / .js +"**/*.(t|j)s": - npm run format:staged - npm run lint:staged diff --git a/packages/publish-helper/.lintstagedrc.yml b/packages/publish-helper/.lintstagedrc.yml index bc23b47..a033e03 100644 --- a/packages/publish-helper/.lintstagedrc.yml +++ b/packages/publish-helper/.lintstagedrc.yml @@ -1,6 +1,5 @@ -# we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) -# and --files argument pointing to other files -src/{**/,}*.ts,test/{**/,}*.ts: +# Reformat all .ts / .js +"**/*.(t|j)s": - npm run format:staged - npm run lint:staged diff --git a/packages/utilities/.lintstagedrc.yml b/packages/utilities/.lintstagedrc.yml index bc23b47..a033e03 100644 --- a/packages/utilities/.lintstagedrc.yml +++ b/packages/utilities/.lintstagedrc.yml @@ -1,6 +1,5 @@ -# we use eslint instead of ng lint, because we can't use --project (tsconfig specifying files with include, exclude) -# and --files argument pointing to other files -src/{**/,}*.ts,test/{**/,}*.ts: +# Reformat all .ts / .js +"**/*.(t|j)s": - npm run format:staged - npm run lint:staged From d588e2803a06210d3c5fbce6dd7887b655769410 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 9 Sep 2025 09:27:58 +0200 Subject: [PATCH 14/15] refactor(*): align script naming --- package.json | 2 +- packages/branch-utilities/package.json | 4 ++-- packages/eslint-config-recommended/package.json | 4 ++-- packages/eslint-plugin-rules/package.json | 4 ++-- packages/logger/package.json | 4 ++-- packages/publish-helper/package.json | 4 ++-- packages/utilities/package.json | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 7418ccc..1b203e0 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build:ci": "lerna run build", "build:lint:ci": "lerna run build:lint:ci", "format": "lerna run format", - "format:ci": "lerna run format:check", + "format:ci": "lerna run format:ci", "lint:ci": "lerna run lint:ci", "prepare": "husky", "publish-libs": "node packages/publish-helper/dist/publish-lib", diff --git a/packages/branch-utilities/package.json b/packages/branch-utilities/package.json index 19f9ae6..f6f2038 100644 --- a/packages/branch-utilities/package.json +++ b/packages/branch-utilities/package.json @@ -16,9 +16,9 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", - "format": "npm run prettier:base -- --write", + "format": "npm run format:base -- --write", "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "format:check": "npm run prettier:base -- --check", + "format:ci": "npm run format:base -- --check", "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", diff --git a/packages/eslint-config-recommended/package.json b/packages/eslint-config-recommended/package.json index 7295cbf..fbff0e7 100644 --- a/packages/eslint-config-recommended/package.json +++ b/packages/eslint-config-recommended/package.json @@ -24,9 +24,9 @@ "prebuild": "rm -rf ./dist", "build": "tsc", "build:lint:ci": "npm run build", - "format": "npm run prettier:base -- --write", + "format": "npm run format:base -- --write", "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "format:check": "npm run prettier:base -- --check", + "format:ci": "npm run format:base -- --check", "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", diff --git a/packages/eslint-plugin-rules/package.json b/packages/eslint-plugin-rules/package.json index ba248de..0fa58fa 100644 --- a/packages/eslint-plugin-rules/package.json +++ b/packages/eslint-plugin-rules/package.json @@ -14,9 +14,9 @@ "prebuild": "rm -rf ./dist", "build": "tsc", "build:lint:ci": "npm run build", - "format": "npm run prettier:base -- --write", + "format": "npm run format:base -- --write", "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "format:check": "npm run prettier:base -- --check", + "format:ci": "npm run format:base -- --check", "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", diff --git a/packages/logger/package.json b/packages/logger/package.json index f8dfc47..048df16 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -20,9 +20,9 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", - "format": "npm run prettier:base -- --write", + "format": "npm run format:base -- --write", "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "format:check": "npm run prettier:base -- --check", + "format:ci": "npm run format:base -- --check", "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix && npm run lint:test:fix", "lint:ci": "npm run lint:src && npm run lint:test", diff --git a/packages/publish-helper/package.json b/packages/publish-helper/package.json index cad93d5..2f06197 100644 --- a/packages/publish-helper/package.json +++ b/packages/publish-helper/package.json @@ -13,9 +13,9 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", - "format": "npm run prettier:base -- --write", + "format": "npm run format:base -- --write", "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "format:check": "npm run prettier:base -- --check", + "format:ci": "npm run format:base -- --check", "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 5e61715..0a60e15 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -16,9 +16,9 @@ "scripts": { "prebuild": "rm -rf ./dist", "build": "tsc", - "format": "npm run prettier:base -- --write", + "format": "npm run format:base -- --write", "format:base": "prettier --config ../../.prettierrc.yml '{src,e2e,test}/**/*.ts'", - "format:check": "npm run prettier:base -- --check", + "format:ci": "npm run format:base -- --check", "format:staged": "prettier --write --config ../../.prettierrc.yml", "lint": "npm run lint:src:fix", "lint:ci": "npm run lint:src", From 4763c67355489dc64695ece362a684d1a2578d03 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 9 Sep 2025 07:30:21 +0000 Subject: [PATCH 15/15] build(release): next version [skip_build] - @shiftcode/branch-utilities@5.0.1-pr53.1 - @shiftcode/eslint-config-recommended@5.0.1-pr53.1 - @shiftcode/eslint-plugin-rules@4.0.1-pr53.1 - @shiftcode/logger@3.0.1-pr53.5 - @shiftcode/publish-helper@4.1.1-pr53.1 - @shiftcode/utilities@4.1.0-pr53.5 --- package-lock.json | 18 +++++++++--------- packages/branch-utilities/package.json | 2 +- .../eslint-config-recommended/package.json | 4 ++-- packages/eslint-plugin-rules/package.json | 2 +- packages/logger/package.json | 4 ++-- packages/publish-helper/package.json | 4 ++-- packages/utilities/package.json | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index b24b4a9..438bb8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14836,7 +14836,7 @@ }, "packages/branch-utilities": { "name": "@shiftcode/branch-utilities", - "version": "5.0.1-pr53.0", + "version": "5.0.1-pr53.1", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" @@ -14847,10 +14847,10 @@ }, "packages/eslint-config-recommended": { "name": "@shiftcode/eslint-config-recommended", - "version": "5.0.1-pr53.0", + "version": "5.0.1-pr53.1", "license": "UNLICENSED", "dependencies": { - "@shiftcode/eslint-plugin-rules": "^4.0.1-pr53.0", + "@shiftcode/eslint-plugin-rules": "^4.0.1-pr53.1", "@typescript-eslint/eslint-plugin": "^8.18.0", "@typescript-eslint/parser": "^8.18.0", "eslint": "^8.56.0", @@ -14888,7 +14888,7 @@ }, "packages/eslint-plugin-rules": { "name": "@shiftcode/eslint-plugin-rules", - "version": "4.0.1-pr53.0", + "version": "4.0.1-pr53.1", "license": "UNLICENSED", "dependencies": { "@eslint/eslintrc": "^2.1.4", @@ -14907,10 +14907,10 @@ }, "packages/logger": { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.4", + "version": "3.0.1-pr53.5", "license": "UNLICENSED", "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.4" + "@shiftcode/utilities": "^4.1.0-pr53.5" }, "engines": { "node": "^20.0.0 || ^22.0.0" @@ -14921,7 +14921,7 @@ }, "packages/publish-helper": { "name": "@shiftcode/publish-helper", - "version": "4.1.1-pr53.0", + "version": "4.1.1-pr53.1", "license": "MIT", "dependencies": { "conventional-changelog-angular": "^8.0.0", @@ -14932,7 +14932,7 @@ "publish-lib": "dist/publish-lib.js" }, "devDependencies": { - "@shiftcode/branch-utilities": "^5.0.1-pr53.0", + "@shiftcode/branch-utilities": "^5.0.1-pr53.1", "@types/yargs": "^17.0.32" }, "engines": { @@ -14957,7 +14957,7 @@ }, "packages/utilities": { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.4", + "version": "4.1.0-pr53.5", "license": "MIT", "engines": { "node": "^20.0.0 || ^22.0.0" diff --git a/packages/branch-utilities/package.json b/packages/branch-utilities/package.json index f6f2038..a1f2c49 100644 --- a/packages/branch-utilities/package.json +++ b/packages/branch-utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/branch-utilities", - "version": "5.0.1-pr53.0", + "version": "5.0.1-pr53.1", "description": "Utilities for local and ci to get branch name and stage", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", diff --git a/packages/eslint-config-recommended/package.json b/packages/eslint-config-recommended/package.json index fbff0e7..b63127e 100644 --- a/packages/eslint-config-recommended/package.json +++ b/packages/eslint-config-recommended/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/eslint-config-recommended", - "version": "5.0.1-pr53.0", + "version": "5.0.1-pr53.1", "description": "default shiftcode config for eslint", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -38,7 +38,7 @@ "test:ci": "npm run test" }, "dependencies": { - "@shiftcode/eslint-plugin-rules": "^4.0.1-pr53.0", + "@shiftcode/eslint-plugin-rules": "^4.0.1-pr53.1", "@typescript-eslint/eslint-plugin": "^8.18.0", "@typescript-eslint/parser": "^8.18.0", "eslint": "^8.56.0", diff --git a/packages/eslint-plugin-rules/package.json b/packages/eslint-plugin-rules/package.json index 0fa58fa..d446a75 100644 --- a/packages/eslint-plugin-rules/package.json +++ b/packages/eslint-plugin-rules/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/eslint-plugin-rules", - "version": "4.0.1-pr53.0", + "version": "4.0.1-pr53.1", "description": "eslint-rules for shiftcode-specific eslint rules", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", diff --git a/packages/logger/package.json b/packages/logger/package.json index 048df16..44d0330 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/logger", - "version": "3.0.1-pr53.4", + "version": "3.0.1-pr53.5", "description": "logger for local and aws lambda execution", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "UNLICENSED", @@ -37,7 +37,7 @@ "test:watch": "npm run test -- --watch" }, "devDependencies": { - "@shiftcode/utilities": "^4.1.0-pr53.4" + "@shiftcode/utilities": "^4.1.0-pr53.5" }, "peerDependencies": { "@shiftcode/utilities": "^4.0.0 || ^4.0.0-pr53" diff --git a/packages/publish-helper/package.json b/packages/publish-helper/package.json index 2f06197..c2f570a 100644 --- a/packages/publish-helper/package.json +++ b/packages/publish-helper/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/publish-helper", - "version": "4.1.1-pr53.0", + "version": "4.1.1-pr53.1", "description": "scripts for conventional (pre)releases", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT", @@ -32,7 +32,7 @@ "yargs": "^17.7.2" }, "devDependencies": { - "@shiftcode/branch-utilities": "^5.0.1-pr53.0", + "@shiftcode/branch-utilities": "^5.0.1-pr53.1", "@types/yargs": "^17.0.32" }, "peerDependencies": { diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 0a60e15..162f5b4 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@shiftcode/utilities", - "version": "4.1.0-pr53.4", + "version": "4.1.0-pr53.5", "description": "Contains some utilities", "repository": "https://github.com/shiftcode/sc-commons-public", "license": "MIT",