Skip to content

Commit 42bfbd7

Browse files
chore: fix npm run perf crashes (#16258)
* chore: fix `npm run perf` crashes it was crashing as eslint treat the `.eslintrc.yml` to be js. this commit changes the generated configs to `eslint.config.js`. refs: #16255 (comment) * fix: windows compat * Update Makefile.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
1 parent 279f0af commit 42bfbd7

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

Makefile.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ const NODE = "node ", // intentional extra space
7676
MARKDOWNLINT_IGNORE_INSTANCE = ignore().add(fs.readFileSync(path.join(__dirname, ".markdownlintignore"), "utf-8")),
7777
MARKDOWN_FILES_ARRAY = MARKDOWNLINT_IGNORE_INSTANCE.filter(find("docs/").concat(ls(".")).filter(fileType("md"))),
7878
TEST_FILES = "\"tests/{bin,conf,lib,tools}/**/*.js\"",
79-
PERF_ESLINTRC = path.join(PERF_TMP_DIR, "eslintrc.yml"),
79+
PERF_ESLINTRC = path.join(PERF_TMP_DIR, "eslint.config.js"),
8080
PERF_MULTIFILES_TARGET_DIR = path.join(PERF_TMP_DIR, "eslint"),
81-
PERF_MULTIFILES_TARGETS = `"${PERF_MULTIFILES_TARGET_DIR + path.sep}{lib,tests${path.sep}lib}${path.sep}**${path.sep}*.js"`,
81+
82+
/*
83+
* glob arguments with Windows separator `\` don't work:
84+
* https://github.com/eslint/eslint/issues/16259
85+
*/
86+
PERF_MULTIFILES_TARGETS = `"${TEMP_DIR}eslint/performance/eslint/{lib,tests/lib}/**/*.js"`,
8287

8388
// Settings
8489
MOCHA_TIMEOUT = parseInt(process.env.ESLINT_MOCHA_TIMEOUT, 10) || 10000;
@@ -911,19 +916,21 @@ function downloadMultifilesTestTarget(cb) {
911916
* @returns {void}
912917
*/
913918
function createConfigForPerformanceTest() {
914-
const content = [
915-
"root: true",
916-
"env:",
917-
" node: true",
918-
" es6: true",
919-
"rules:"
920-
];
919+
let rules = "";
921920

922921
for (const [ruleId] of builtinRules) {
923-
content.push(` ${ruleId}: 1`);
922+
rules += (` "${ruleId}": 1,\n`);
923+
}
924+
925+
const content = `
926+
module.exports = [{
927+
"languageOptions": {sourceType: "commonjs"},
928+
"rules": {
929+
${rules}
924930
}
931+
}];`;
925932

926-
content.join("\n").to(PERF_ESLINTRC);
933+
content.to(PERF_ESLINTRC);
927934
}
928935

929936
/**
@@ -983,7 +990,7 @@ function time(cmd, runs, runNumber, results, cb) {
983990
function runPerformanceTest(title, targets, multiplier, cb) {
984991
const cpuSpeed = os.cpus()[0].speed,
985992
max = multiplier / cpuSpeed,
986-
cmd = `${ESLINT}--config "${PERF_ESLINTRC}" --no-eslintrc --no-ignore ${targets}`;
993+
cmd = `${ESLINT}--config "${PERF_ESLINTRC}" --no-config-lookup --no-ignore ${targets}`;
987994

988995
echo("");
989996
echo(title);

0 commit comments

Comments
 (0)