Update custom rule params.config object to be a copy of the configuration object to prevent modification of user data by custom rule, add test case to validate config.params value for custom rules in different scenarios.

This commit is contained in:
David Anson 2025-09-21 15:25:25 -07:00
parent 4b66433231
commit 82f7f6a2f9
2 changed files with 58 additions and 22 deletions

View file

@ -545,7 +545,7 @@ function lintContent(
...paramsBase,
...tokens,
parsers,
"config": effectiveConfig[ruleName]
"config": (typeof effectiveConfig[ruleName] === "object") ? { ...effectiveConfig[ruleName] } : effectiveConfig[ruleName]
};
// eslint-disable-next-line jsdoc/require-jsdoc
function throwError(property) {