Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10e7ae2

Browse files
authored
fix: update uncloneable options error message (#20059)
* refactor: updated uncloneable-options error message to give more clarity * updated tests to match error message change * fix: language clean-up for clarity
1 parent 42761fa commit 10e7ae2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/eslint/eslint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ function validateOptionCloneability(options) {
547547
})
548548
.sort();
549549
const error = new TypeError(
550-
`The ${uncloneableOptionKeys.length === 1 ? "option" : "options"} ${new Intl.ListFormat("en-US").format(uncloneableOptionKeys.map(key => `"${key}"`))} cannot be cloned. When concurrency is enabled, all options must be cloneable. Remove uncloneable options or use an options module.`,
550+
`The ${uncloneableOptionKeys.length === 1 ? "option" : "options"} ${new Intl.ListFormat("en-US").format(uncloneableOptionKeys.map(key => `"${key}"`))} cannot be cloned. When concurrency is enabled, all options must be cloneable values (JSON values). Remove uncloneable options or use an options module.`,
551551
);
552552
error.code = "ESLINT_UNCLONEABLE_OPTIONS";
553553
throw error;

tests/lib/eslint/eslint.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ describe("ESLint", () => {
426426
constructor: TypeError,
427427
code: "ESLINT_UNCLONEABLE_OPTIONS",
428428
message:
429-
'The options "baseConfig", "fix", and "plugins" cannot be cloned. When concurrency is enabled, all options must be cloneable. Remove uncloneable options or use an options module.',
429+
'The options "baseConfig", "fix", and "plugins" cannot be cloned. When concurrency is enabled, all options must be cloneable values (JSON values). Remove uncloneable options or use an options module.',
430430
},
431431
);
432432
});
@@ -445,7 +445,7 @@ describe("ESLint", () => {
445445
constructor: TypeError,
446446
code: "ESLINT_UNCLONEABLE_OPTIONS",
447447
message:
448-
'The option "ruleFilter" cannot be cloned. When concurrency is enabled, all options must be cloneable. Remove uncloneable options or use an options module.',
448+
'The option "ruleFilter" cannot be cloned. When concurrency is enabled, all options must be cloneable values (JSON values). Remove uncloneable options or use an options module.',
449449
},
450450
);
451451
});
@@ -9778,13 +9778,13 @@ describe("ESLint", () => {
97789778
const optionsSrc = `
97799779
import assert from "node:assert";
97809780
import { isMainThread } from "node:worker_threads";
9781-
9781+
97829782
if (!isMainThread) {
97839783
if (process.env.ESLINT_TEST_ENV !== "test") {
97849784
assert.fail("Environment variable ESLINT_TEST_ENV is not set as expected in worker threads.");
97859785
}
97869786
}
9787-
9787+
97889788
export default {
97899789
concurrency: 2,
97909790
cwd: ${JSON.stringify(fixtureDir)},
@@ -9803,11 +9803,11 @@ describe("ESLint", () => {
98039803
it("should propagate environment variables from worker threads to the controlling thread", async () => {
98049804
const optionsSrc = `
98059805
import { isMainThread } from "node:worker_threads";
9806-
9806+
98079807
if (!isMainThread) {
98089808
process.env.ESLINT_TEST_ENV = "test";
98099809
}
9810-
9810+
98119811
export default {
98129812
concurrency: 2,
98139813
cwd: ${JSON.stringify(fixtureDir)},

0 commit comments

Comments
 (0)