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 b4ff21c commit ded12b8
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 46 deletions.
30 changes: 0 additions & 30 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;
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,16 @@
"sideEffects": false,
"devDependencies": {
"@jest/globals": "^29.7.0",
"@run-z/eslint-config": "^4.2.0",
"@run-z/eslint-config": "^5.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-bootstrap",
"ts-jest": "^29.2.5",
Expand All @@ -56,7 +52,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;
4 changes: 2 additions & 2 deletions src/loggable/loggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface Loggable<TTarget extends DueLog.Target = DueLog.Target> {
*/
export function isLoggable(value: unknown): value is Loggable {
return (
((typeof value === 'object' && !!value) || typeof value === 'function')
&& typeof (value as Partial<Loggable>).toLog === 'function'
((typeof value === 'object' && !!value) || typeof value === 'function') &&
typeof (value as Partial<Loggable>).toLog === 'function'
);
}
3 changes: 1 addition & 2 deletions src/loggers/console-logger.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals';
import { Mock } from 'jest-mock';
import { Loggable } from '../loggable/mod.js';
import { consoleLogger } from './console-logger.js';

describe('consoleLogger', () => {
let logSpy: Mock<(...args: unknown[]) => void>;
let logSpy: jest.Mock<(...args: unknown[]) => void>;

afterEach(() => {
logSpy.mockRestore();
Expand Down
3 changes: 2 additions & 1 deletion src/loggers/console-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { HeadlessLogger } from '../headless-logger.js';
import { processingLogger } from './processing-logger.js';

const consoleLogger$log =
(log: (...args: unknown[]) => void) => (...args: unknown[]) => {
(log: (...args: unknown[]) => void) =>
(...args: unknown[]) => {
if (typeof args[0] === 'string') {
// Avoid formatting.
log('%s', ...args);
Expand Down
3 changes: 2 additions & 1 deletion src/loggers/processing-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { Logger } from '../logger.js';
*/
export function processingLogger(logger: Logger, { on }: { on?: string } = {}): HeadlessLogger {
const logMethod =
(log: (...args: unknown[]) => void): ((...args: unknown[]) => void) => (...args) => {
(log: (...args: unknown[]) => void): ((...args: unknown[]) => void) =>
(...args) => {
const { line } = dueLog({ on, line: args });

log(...line);
Expand Down

0 comments on commit ded12b8

Please sign in to comment.