Skip to content

Commit

Permalink
ESLint v9 & Prettier v4
Browse files Browse the repository at this point in the history
  • Loading branch information
surol committed Oct 9, 2024
1 parent 76eb509 commit 50047bb
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 52 deletions.
33 changes: 0 additions & 33 deletions .eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion .prettierrc.cjs

This file was deleted.

3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import configs from '@run-z/eslint-config';

export default configs;
15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from '@run-z/prettier-config';

export default config;
3 changes: 2 additions & 1 deletion src/error-logging.handler.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function errorLoggingHandler<TInput>(
? config.logError.bind(config)
: logImmediately;

return (context: RequestContext<TInput & LoggerMeans<ZLogger>>) => context.next(handler).catch(async error => {
return (context: RequestContext<TInput & LoggerMeans<ZLogger>>) =>
context.next(handler).catch(async error => {
await context.next(
logError,
requestExtension<TInput & LoggerMeans<ZLogger>, ErrorMeans>({ error }),
Expand Down
5 changes: 2 additions & 3 deletions src/logging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export interface ZLogging<TInput = unknown>
*/
class ZLoggingCapability<TInput>
extends RequestCapability<TInput, LoggerMeans<ZLogger>>
implements ZLogging<TInput> {

implements ZLogging<TInput>
{
readonly for: <TMeans extends TInput>(
handler: RequestHandler<TMeans & LoggerMeans<ZLogger>>,
) => RequestHandler<TMeans>;
Expand All @@ -106,7 +106,8 @@ class ZLoggingCapability<TInput>
this.for =
<TMeans extends TInput>(
handler: RequestHandler<TMeans & LoggerMeans<ZLogger>>,
): RequestHandler<TMeans> => async context => {
): RequestHandler<TMeans> =>
async context => {
const log = logZBy(
logZRequest(config, forRequest(globalLogger, context as RequestContext<TInput>)),
);
Expand All @@ -125,7 +126,6 @@ class ZLoggingCapability<TInput>
with<TNewInput>(config: RequestZLogConfig<TNewInput> = {}): ZLogging<TNewInput> {
return new ZLoggingCapability(config);
}

}

/**
Expand Down

0 comments on commit 50047bb

Please sign in to comment.