diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 470cfbe..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - root: true, - ignorePatterns: ['node_modules/', 'dist/', 'target/'], - extends: ['@run-z'], - overrides: [ - { - files: ['*.js', '*.cjs', '*.mjs'], - env: { - node: true, - }, - }, - { - files: ['*.ts'], - extends: ['@run-z/eslint-config/typescript'], - parser: '@typescript-eslint/parser', - parserOptions: { - tsconfigRootDir: __dirname, - project: './tsconfig.json', - }, - env: { - browser: true, - }, - }, - { - files: ['*.spec.ts'], - extends: ['@run-z/eslint-config/jest'], - parserOptions: { - tsconfigRootDir: __dirname, - project: './tsconfig.json', - }, - }, - ], -}; diff --git a/.prettierrc.cjs b/.prettierrc.cjs deleted file mode 100644 index 43069b8..0000000 --- a/.prettierrc.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@run-z/prettier-config'); diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..9775a12 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +import configs from '@run-z/eslint-config'; + +export default configs; diff --git a/package.json b/package.json index 715e438..1277273 100644 --- a/package.json +++ b/package.json @@ -35,22 +35,17 @@ "@hatsy/hatsy": "^3.0.0", "@jest/globals": "^29.7.0", "@proc7ts/async": "2.1.0", - "@run-z/eslint-config": "^4.2.0", + "@run-z/eslint-config": "^5.0.0", "@run-z/log-z": "^3.0.0", - "@run-z/prettier-config": "^2.0.0", + "@run-z/prettier-config": "^3.0.0", "@run-z/project-config": "^0.20.4", "@swc/core": "^1.7.26", "@swc/jest": "^0.2.36", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "@typescript-eslint/parser": "^7.18.0", - "eslint": "^8.57.1", - "eslint-plugin-jest": "^28.8.3", + "eslint": "^9.12.0", "gh-pages": "^6.1.1", "jest": "^29.7.0", "jest-junit": "^16.0.0", - "jest-mock": "^29.7.0", - "prettier": "^2.8.8", - "prettier-eslint-cli": "^7.1.0", + "prettier": "^3.3.3", "rollup": "^4.24.0", "run-z": "^2.1.0", "ts-jest": "^29.2.5", @@ -65,7 +60,7 @@ "clean": "run-z +z --then clean-z", "doc": "run-z +z --then typedoc", "doc:publish": "run-z doc --then gh-pages --dist target/typedoc --dotfiles", - "format": "run-z +z --then prettier-eslint --write --include-dot-files \"src/**/*.*\" \"*.{js,cjs,json,md}\"", + "format": "run-z +z --then prettier --write \"src/**/*.*\" \"*.{js,cjs,json,md}\"", "lint": "run-z +z --then eslint .", "test": "run-z +z env:NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" --then test-z", "z": "run-z +cmd:build-z,+cmd:typedoc,+cmd:eslint,+cmd:test-z" diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..3547697 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,3 @@ +import config from '@run-z/prettier-config'; + +export default config; diff --git a/src/error-logging.handler.impl.ts b/src/error-logging.handler.impl.ts index 0d4f8fe..b5927f0 100644 --- a/src/error-logging.handler.impl.ts +++ b/src/error-logging.handler.impl.ts @@ -15,7 +15,8 @@ export function errorLoggingHandler( ? config.logError.bind(config) : logImmediately; - return (context: RequestContext>) => context.next(handler).catch(async error => { + return (context: RequestContext>) => + context.next(handler).catch(async error => { await context.next( logError, requestExtension, ErrorMeans>({ error }), diff --git a/src/logging.spec.ts b/src/logging.spec.ts index 2887e22..a0ed90f 100644 --- a/src/logging.spec.ts +++ b/src/logging.spec.ts @@ -6,13 +6,12 @@ import { consoleLogger, processingLogger } from '@proc7ts/logger'; import { asis, noop, valueProvider } from '@proc7ts/primitives'; import type { ZLogRecorder, ZLogger } from '@run-z/log-z'; import { ZLogLevel, logZToLogger, zlogDetails, zlogINFO } from '@run-z/log-z'; -import type { Mock } from 'jest-mock'; import type { RequestZLogConfig } from './logging.js'; import { ZLogging } from './logging.js'; describe('ZLogging', () => { - let infoSpy: Mock<(...args: unknown[]) => void>; - let errorSpy: Mock<(...args: unknown[]) => void>; + let infoSpy: jest.Mock<(...args: unknown[]) => void>; + let errorSpy: jest.Mock<(...args: unknown[]) => void>; beforeEach(() => { infoSpy = jest.spyOn(consoleLogger, 'info').mockImplementation(noop) as typeof infoSpy; diff --git a/src/logging.ts b/src/logging.ts index f7c3326..b0d5ab8 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -91,8 +91,8 @@ export interface ZLogging */ class ZLoggingCapability extends RequestCapability> - implements ZLogging { - + implements ZLogging +{ readonly for: ( handler: RequestHandler>, ) => RequestHandler; @@ -106,7 +106,8 @@ class ZLoggingCapability this.for = ( handler: RequestHandler>, - ): RequestHandler => async context => { + ): RequestHandler => + async context => { const log = logZBy( logZRequest(config, forRequest(globalLogger, context as RequestContext)), ); @@ -125,7 +126,6 @@ class ZLoggingCapability with(config: RequestZLogConfig = {}): ZLogging { return new ZLoggingCapability(config); } - } /**