Skip to content

Commit c7abaef

Browse files
authored
perf: using Node.js compile cache (#19012)
* perf: using Node.js compile cache it was introduced in node.js v22.8.0 https://nodejs.org/en/blog/release/v22.8.0#new-js-api-for-compile-cache fixes #18968 * chore: fix linting errors * chore: upgrade eslint-plugin-n v17.11.1 Signed-off-by: 唯然 <weiran.zsd@outlook.com> --------- Signed-off-by: 唯然 <weiran.zsd@outlook.com>
1 parent bf723bd commit c7abaef

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

bin/eslint.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
"use strict";
1111

12+
const mod = require("node:module");
13+
14+
// to use V8's code cache to speed up instantiation time
15+
mod.enableCompileCache?.();
16+
1217
// must do this initialization *before* other requires in order to work
1318
if (process.argv.includes("--debug")) {
1419
require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*");

eslint.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,5 +305,17 @@ module.exports = [
305305
rules: {
306306
"expect-type/expect": "error"
307307
}
308+
},
309+
{
310+
name: "eslint/bin",
311+
files: ["bin/eslint.js"],
312+
rules: {
313+
314+
/*
315+
* it was introduced in Node.js v22.8.0
316+
* refs: https://nodejs.org/en/blog/release/v22.8.0#new-js-api-for-compile-cache
317+
*/
318+
"n/no-unsupported-features/node-builtins": [2, { ignores: ["module.enableCompileCache"] }]
319+
}
308320
}
309321
];

packages/eslint-config-eslint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
3434
"@eslint/js": "^9.0.0",
3535
"eslint-plugin-jsdoc": "^48.2.3",
36-
"eslint-plugin-n": "^17.2.0",
36+
"eslint-plugin-n": "^17.11.1",
3737
"eslint-plugin-unicorn": "^52.0.0"
3838
},
3939
"keywords": [

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy