Skip to content

Commit 0bc5489

Browse files
committed
f
1 parent 40e8695 commit 0bc5489

File tree

8 files changed

+101
-84
lines changed

8 files changed

+101
-84
lines changed

.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,5 @@
138138
"jsdoc/require-returns": "allow",
139139
"jsdoc/require-param": "allow"
140140
},
141-
"ignorePatterns": ["index.d.ts", "test/fixtures/**", "__snapshots__"]
141+
"ignorePatterns": ["index.d.ts", "test/fixtures/**", "__snapshots__", "test", "benchmark"]
142142
}

benchmark/middleware/app/middleware/async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
let index = 0;
44

5-
module.exports = function () {
5+
module.exports = function exports() {
66
return async (ctx, next) => {
77
await next();
88
ctx.body.push(`async middleware #${++index}`);

example/middleware/hello.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MiddlewareFunc } from '../../src/index.js';
1+
import type { MiddlewareFunc } from '../../src/index.js';
22

33
export const hello: MiddlewareFunc = async (ctx, next) => {
44
console.log('Hello middleware');

src/egg.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ import type {
99
MiddlewareFunc as KoaMiddlewareFunc,
1010
Next,
1111
} from '@eggjs/koa';
12-
import { EggConsoleLogger, Logger } from 'egg-logger';
13-
import { RegisterOptions, ResourcesController, EggRouter as Router } from '@eggjs/router';
12+
import type { Logger } from 'egg-logger';
13+
import { EggConsoleLogger } from 'egg-logger';
14+
import type { RegisterOptions, ResourcesController} from '@eggjs/router';
15+
import { EggRouter as Router } from '@eggjs/router';
1416
import type { ReadyFunctionArg } from 'get-ready';
1517
import { BaseContextClass } from './base_context_class.js';
1618
import { Timing } from './utils/timing.js';
1719
import type { Fun } from './utils/index.js';
1820
import { Lifecycle } from './lifecycle.js';
1921
import { EggLoader } from './loader/egg_loader.js';
2022
import utils from './utils/index.js';
21-
import { EggAppConfig } from './types.js';
23+
import type { EggAppConfig } from './types.js';
2224
import {
2325
Singleton, type SingletonCreateMethod, type SingletonOptions,
2426
} from './singleton.js';

src/lifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export class Lifecycle extends EventEmitter {
368368
}) {
369369
const { scope, ready, timingKeyPrefix, scopeFullName } = args;
370370
if (typeof scope !== 'function') {
371-
throw new Error('boot only support function');
371+
throw new TypeError('boot only support function');
372372
}
373373

374374
// get filename from stack if scopeFullName is undefined

0 commit comments

Comments
 (0)