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 0916e25c27
commit c07a63117a
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) {