Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion app/extend/context.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { performance } = require('perf_hooks');
const { performance } = require('node:perf_hooks');
const delegate = require('delegates');
const { assign } = require('utility');
const eggUtils = require('egg-core').utils;
Expand Down
2 changes: 1 addition & 1 deletion app/extend/helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const url = require('url');
const url = require('node:url');


module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion app/extend/request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const querystring = require('querystring');
const querystring = require('node:querystring');
const accepts = require('accepts');

const _querycache = Symbol('_querycache');
Expand Down
2 changes: 1 addition & 1 deletion app/middleware/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* meta middleware, should be the first middleware
*/

const { performance } = require('perf_hooks');
const { performance } = require('node:perf_hooks');

module.exports = options => {
return async function meta(ctx, next) {
Expand Down
2 changes: 1 addition & 1 deletion app/middleware/site_file.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const path = require('path');
const path = require('node:path');

module.exports = options => {
return async function siteFile(ctx, next) {
Expand Down
4 changes: 2 additions & 2 deletions config/config.default.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const fs = require('fs');
const path = require('path');
const fs = require('node:fs');
const path = require('node:path');

/**
* The configuration of egg application, can be access by `app.config`
Expand Down
25 changes: 25 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

export default [
{
ignores: [
'test/fixtures/**',
'examples/**/app/public/**',
'logs/**',
'run/**',
'docs/node_modules/**',
'site/**',
],
},
...fixupConfigRules(compat.extends('eslint-config-egg')),
];
2 changes: 1 addition & 1 deletion lib/agent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const path = require('path');
const path = require('node:path');
const ms = require('ms');
const EggApplication = require('./egg');
const AgentWorkerLoader = require('./loader').AgentWorkerLoader;
Expand Down
6 changes: 3 additions & 3 deletions lib/application.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

const path = require('path');
const fs = require('fs');
const path = require('node:path');
const fs = require('node:fs');
const ms = require('ms');
const is = require('is-type-of');
const graceful = require('graceful');
const http = require('http');
const http = require('node:http');
const cluster = require('cluster-client');
const onFinished = require('on-finished');
const { assign } = require('utility');
Expand Down
2 changes: 1 addition & 1 deletion lib/core/base_hook_class.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const INSTANCE = Symbol('BaseHookClass#instance');

class BaseHookClass {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/fetch_factory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const debug = require('util').debuglog('egg:lib:core:fetch_factory');
const debug = require('node:util').debuglog('egg:lib:core:fetch_factory');

const mainNodejsVersion = parseInt(process.versions.node.split('.')[0]);
let FetchFactory;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/httpclient_next.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const debug = require('util').debuglog('egg:lib:core:httpclient_next');
const debug = require('node:util').debuglog('egg:lib:core:httpclient_next');
const ms = require('humanize-ms');

const SSRF_HTTPCLIENT = Symbol('SSRF_HTTPCLIENT');
Expand Down
6 changes: 3 additions & 3 deletions lib/core/messenger/ipc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

const debug = require('util').debuglog('egg:util:messenger:ipc');
const debug = require('node:util').debuglog('egg:util:messenger:ipc');
const is = require('is-type-of');
const workerThreads = require('worker_threads');
const workerThreads = require('node:worker_threads');
const sendmessage = require('sendmessage');
const EventEmitter = require('events');
const EventEmitter = require('node:events');

/**
* Communication between app worker and agent worker by IPC channel
Expand Down
4 changes: 2 additions & 2 deletions lib/core/messenger/local.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

const debug = require('util').debuglog('egg:util:messenger:local');
const debug = require('node:util').debuglog('egg:util:messenger:local');
const is = require('is-type-of');
const EventEmitter = require('events');
const EventEmitter = require('node:events');

/**
* Communication between app worker and agent worker with EventEmitter
Expand Down
4 changes: 2 additions & 2 deletions lib/core/singleton.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const is = require('is-type-of');

class Singleton {
Expand Down Expand Up @@ -112,7 +112,7 @@ class Singleton {
}
extendable.createInstance = this.createInstance.bind(this);
extendable.createInstanceAsync = this.createInstanceAsync.bind(this);
} catch (err) {
} catch {
this.app.logger.warn('egg:singleton %s dynamic create is disabled because of client is unextensible', this.name);
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/core/utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

const util = require('util');
const util = require('node:util');
const is = require('is-type-of');
const URL = require('url').URL;
const URL = require('node:url').URL;

module.exports = {
convertObject,
Expand Down Expand Up @@ -87,7 +87,7 @@
function safeParseURL(url) {
try {
return new URL(url);
} catch (err) {
} catch {
return null;
}
}
Expand All @@ -100,10 +100,10 @@
* - Allows overriding properties on the proxy target (overlay) to take effect.
* - Delegates everything else to the real object.
*
* @param {Object} options

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 24)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 24)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 24)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 24)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 24)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 24)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Missing JSDoc @param "options" description

Check warning on line 103 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Missing JSDoc @param "options" description
* @param {Function} options.createReal Create the real object (lazy)
* @param {boolean} [options.bindFunctions=true] Bind real methods to the real object
* @return {Proxy}

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 24)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 24)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 20)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 24)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 24)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 18)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 22)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (macos-latest, 20)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (ubuntu-latest, 18)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 24)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 24)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 22)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 20)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Missing JSDoc @return description

Check warning on line 106 in lib/core/utils.js

View workflow job for this annotation

GitHub Actions / Node.js / Test (windows-latest, 18)

Missing JSDoc @return description
*/
function createTransparentProxy({ createReal, bindFunctions = true }) {
if (typeof createReal !== 'function') {
Expand Down
15 changes: 7 additions & 8 deletions lib/egg.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { performance } = require('perf_hooks');
const path = require('path');
const fs = require('fs');
const { performance } = require('node:perf_hooks');
const path = require('node:path');
const fs = require('node:fs');
const ms = require('ms');
const http = require('http');
const http = require('node:http');
const EggCore = require('egg-core').EggCore;
const cluster = require('cluster-client');
const extend = require('extend2');
Expand Down Expand Up @@ -119,7 +119,7 @@ class EggApplication extends EggCore {
isLeader: this.type === 'agent',
logger: this.coreLogger,
// debug mode does not check heartbeat
isCheckHeartbeat: this.config.env === 'prod' ? true : require('inspector').url() === undefined,
isCheckHeartbeat: this.config.env === 'prod' ? true : require('node:inspector').url() === undefined,
});
const client = cluster(clientClass, options);
this._patchClusterClient(client);
Expand Down Expand Up @@ -413,14 +413,14 @@ class EggApplication extends EggCore {
try {
// support array and set
ignoreList = Array.from(this.config.dump.ignore);
} catch (_) {
} catch {
ignoreList = [];
}

let ignoreKeyPaths;
try {
ignoreKeyPaths = this.config.dump.ignoreKeyPaths;
} catch (e) {
} catch {
ignoreKeyPaths = {};
}

Expand Down Expand Up @@ -520,7 +520,6 @@ class EggApplication extends EggCore {
this.deprecate('please use app.config.proxy instead');
return this.config.proxy;
}
/* eslint no-empty-function: off */
set proxy(_) { }

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/start.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const path = require('path');
const path = require('node:path');

module.exports = async (options = {}) => {

Expand All @@ -11,7 +11,7 @@ module.exports = async (options = {}) => {
if (!options.framework) {
try {
options.framework = require(path.join(options.baseDir, 'package.json')).egg.framework;
} catch (_) {
} catch {
// ignore
}
}
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@
"egg-plugin-puml": "^2.4.0",
"egg-tracer": "^2.0.0",
"egg-view-nunjucks": "^2.3.0",
"eslint": "^8.23.1",
"eslint-config-egg": "^12.0.0",
"@eslint/compat": "^2.0.3",
"@eslint/eslintrc": "^3.3.5",
"@eslint/js": "^9.39.4",
"eslint": "^9.39.4",
"eslint-config-egg": "^14.1.0",
"globals": "^16.2.0",
Comment on lines +79 to +84
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The versions for several new ESLint-related dependencies appear to be incorrect as they do not correspond to any published versions on npm. This will likely cause the npm install command to fail.

Please verify the versions for @eslint/compat, @eslint/eslintrc, @eslint/js, eslint, and globals and update them to valid, published versions from the npm registry.

"formstream": "^1.1.1",
"jsdoc": "^3.6.11",
"koa": "^2.13.4",
Expand Down
4 changes: 2 additions & 2 deletions test/agent.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const mock = require('egg-mock');
const path = require('path');
const path = require('node:path');
const utils = require('./utils');

describe('test/agent.test.js', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/app/extend/agent.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');

const mm = require('egg-mock');
const utils = require('../../utils');
Expand Down
6 changes: 3 additions & 3 deletions test/app/extend/application.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

const assert = require('assert');
const fs = require('fs');
const path = require('path');
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const utils = require('../../utils');

describe('test/app/extend/application.test.js', () => {
Expand Down
6 changes: 3 additions & 3 deletions test/app/extend/context.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const fs = require('node:fs');
const path = require('node:path');
const mm = require('egg-mock');
const assert = require('assert');
const assert = require('node:assert');
const utils = require('../../utils');

describe('test/app/extend/context.test.js', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/app/extend/request.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const mm = require('egg-mock');
const urllib = require('urllib');
const utils = require('../../utils');
Expand Down
2 changes: 1 addition & 1 deletion test/app/extend/response.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const mm = require('egg-mock');
const utils = require('../../utils');

Expand Down
4 changes: 2 additions & 2 deletions test/app/middleware/body_parser.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert');
const querystring = require('querystring');
const assert = require('node:assert');
const querystring = require('node:querystring');
const utils = require('../../utils');

describe('test/app/middleware/body_parser.test.js', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/app/middleware/meta.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assert = require('assert');
const assert = require('node:assert');
const mm = require('egg-mock');
const fs = require('fs/promises');
const fs = require('node:fs/promises');
const utils = require('../../utils');

describe('test/app/middleware/meta.test.js', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/app/middleware/site_file.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const utils = require('../../utils');

describe('test/app/middleware/site_file.test.js', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/asyncSupport.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const mm = require('egg-mock');
const utils = require('./utils');

Expand Down
4 changes: 2 additions & 2 deletions test/bench/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const http = require('http');
const path = require('path');
const http = require('node:http');
const path = require('node:path');
const mock = require('egg-mock');

const appName = process.argv[2];
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const assert = require('assert');
const assert = require('node:assert');
const egg = require('..');

describe('test/index.test.js', () => {
Expand Down
8 changes: 4 additions & 4 deletions test/lib/agent.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

const assert = require('assert');
const fs = require('fs');
const path = require('path');
const execSync = require('child_process').execSync;
const assert = require('node:assert');
const fs = require('node:fs');
const path = require('node:path');
const execSync = require('node:child_process').execSync;
const mm = require('egg-mock');
const utils = require('../utils');

Expand Down
Loading
Loading