mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Harden code to snapshot rule definitions against mutation, add comments to some helper functions.
This commit is contained in:
parent
8fe7c109ed
commit
9897863130
4 changed files with 154 additions and 36 deletions
|
@ -872,7 +872,14 @@ function lintInput(options, synchronous, callback) {
|
|||
const customRuleList =
|
||||
[ options.customRules || [] ]
|
||||
.flat()
|
||||
.map((rule) => ({ ...rule }));
|
||||
.map((rule) => ({
|
||||
"names": helpers.cloneIfArray(rule.names),
|
||||
"description": rule.description,
|
||||
"information": helpers.cloneIfUrl(rule.information),
|
||||
"tags": helpers.cloneIfArray(rule.tags),
|
||||
"asynchronous": rule.asynchronous,
|
||||
"function": rule.function
|
||||
}));
|
||||
// eslint-disable-next-line unicorn/prefer-spread
|
||||
const ruleList = rules.concat(customRuleList);
|
||||
const ruleErr = validateRuleList(ruleList, synchronous);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue