Files
node/benchmark/eslint.config_partial.mjs
Murat Kirazkaya 8175dc3c05 tools: add lint rule for unread benchmark n
If a benchmark declares `n` in its configs, main() must read it.
nodejs/node#59872 renamed a config key from `num` to `n` but left
`{ num: n }` in main(), so `n` resolved to undefined and the
benchmark silently reported near-zero results until #62084 fixed
it.

The rule also found `async_hooks/async-resource-vs-destroy.js`,
which has declared `n: [1e6]` since it was added but never read
it. Remove the unused key.

Refs: https://github.com/nodejs/node/pull/59872
Refs: https://github.com/nodejs/node/pull/62084
Signed-off-by: Murat Kirazkaya <groophylifefor@gmail.com>
Assisted-by: Claude Code
PR-URL: https://github.com/nodejs/node/pull/66807
Refs: https://github.com/nodejs/performance/issues/187
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2026-10-19 15:51:08 +00:00

17 lines
329 B
JavaScript

import { globals } from '../tools/eslint/eslint.config_utils.mjs';
export default [
{
files: ['benchmark/**/*.{js,mjs,cjs}'],
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
'node-core/benchmark-n-config': 'error',
'prefer-arrow-callback': 'error',
},
},
];