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 110bb7c commit 1c8e2f7
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 60 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 @@ -30,21 +30,16 @@
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@run-z/eslint-config": "^4.2.0",
"@run-z/prettier-config": "^2.0.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",
"ts-jest": "^29.2.5",
Expand All @@ -59,7 +54,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;
10 changes: 4 additions & 6 deletions src/classify-route-capture.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import type { Mock } from 'jest-mock';
import { classifyRouteCapture } from './classify-route-capture.js';
import { rcaptureEntry } from './matchers/rcapture-entry.js';
import { PathRoute } from './path/path-route.js';
import type { RouteCaptor, RouteCaptorSignatureMap } from './route-captor.js';
import { routeMatch } from './route-match.js';
import { RouteMatcher } from './route-matcher.js';
import { rcaptureEntry } from './matchers/rcapture-entry.js';
import { PathRoute } from './path/path-route.js';
import { urlRoute } from './url/url-route.js';

describe('classifyRouteCapture', () => {
const pattern = [rcaptureEntry('out')];
let capture: Mock<
let capture: jest.Mock<
(
key: string | number,
...capture: Parameters<RouteCaptorSignatureMap<PathRoute>['capture']>
Expand Down Expand Up @@ -47,8 +46,7 @@ describe('classifyRouteCapture', () => {
key: string | number,
...capture: Parameters<RouteCaptorSignatureMap<PathRoute>['dirs']>
) => void
>(
);
>();
const match = routeMatch(urlRoute(new URL('route:/file')), pattern);

match?.(classifyRouteCapture({ dirs }, fallback));
Expand Down
3 changes: 2 additions & 1 deletion src/matchers/rcapture-any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export function rcaptureAny(name?: string): RouteMatcher {
// This is the last matcher in pattern.
// Always match.
return {
callback: captor => captor(
callback: captor =>
captor(
'capture',
key,
context.entry.name.substring(context.nameOffset, context.entry.name.length),
Expand Down
3 changes: 2 additions & 1 deletion src/matchers/rcapture-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export function rcaptureEntry(name?: string): RouteMatcher {
const key = name ?? 0;

return {
test: context => !context.nameOffset && {
test: context =>
!context.nameOffset && {
callback(captor) {
captor('capture', key, context.entry.name, context);
},
Expand Down
3 changes: 1 addition & 2 deletions src/matchers/rcapture-regexp.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import type { Mock } from 'jest-mock';
import { routeMatch } from '../route-match.js';
import { urlRoute } from '../url/url-route.js';
import { rcaptureAny } from './rcapture-any.js';
import { rcaptureRegExp } from './rcapture-regexp.js';
import { rmatchAny } from './rmatch-any.js';

describe('rcaptureRegExp', () => {
let captor: Mock<(kind: unknown, key: string | number, ...capture: any[]) => void>;
let captor: jest.Mock<(kind: unknown, key: string | number, ...capture: any[]) => void>;

beforeEach(() => {
captor = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion src/path/path-route-pattern.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function addPathEntryMatchers(pattern: string, matchers: RouteMatcher[]):

let patternOffset = 0;

for (let i = 0; i < pattern.length;) {
for (let i = 0; i < pattern.length; ) {
const c = pattern[i];
let matcher: RouteMatcher;
let nextOffset: number;
Expand Down
4 changes: 2 additions & 2 deletions src/route-match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ export function routeMatch<TRoute extends PathRoute>(
const matcher = pattern[matcherIndex];

if (
!matcher.tail
|| !matcher.tail({
!matcher.tail ||
!matcher.tail({
route,
entryIndex: path.length,
nameOffset: 0,
Expand Down
5 changes: 2 additions & 3 deletions src/url/url-route-pattern.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import { Mock } from 'jest-mock';
import { RouteCaptor } from '../route-captor.js';
import { routeMatch } from '../route-match.js';
import { URLRoute, urlRoute } from './url-route.js';
import { urlRoutePattern } from './url-route-pattern.js';
import { URLRoute, urlRoute } from './url-route.js';

describe('urlRoutePattern', () => {
let captor: RouteCaptor<URLRoute> & Mock<(...args: any[]) => void>;
let captor: RouteCaptor<URLRoute> & jest.Mock<(...args: any[]) => void>;

beforeEach(() => {
captor = jest.fn();
Expand Down

0 comments on commit 1c8e2f7

Please sign in to comment.