Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Francesco Trotta <[email protected]>
  • Loading branch information
JoshuaKGoldberg and fasttime authored Jul 26, 2024
1 parent d76f47e commit c9a60fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/shared/config-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default class ConfigValidator {
const validateRule = ruleValidators.get(rule);

if (validateRule) {
const mergedOptions = deepMergeArrays(rule.meta && rule.meta.defaultOptions, localOptions);
const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions);

validateRule(mergedOptions);

Expand Down
8 changes: 4 additions & 4 deletions lib/shared/deep-merge-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @returns {boolean} Whether value is an object
*/
function isObjectNotArray(value) {
return typeof value === "object" && value !== null && value !== void 0 && !Array.isArray(value);
return typeof value === "object" && value !== null && !Array.isArray(value);
}

/**
Expand Down Expand Up @@ -40,8 +40,8 @@ function deepMergeObjects(first, second) {

/**
* Deeply merges second on top of first, creating a new [] array if needed.
* @param {T[]} first Base, default values.
* @param {U[]} second User-specified values.
* @param {T[] | undefined} first Base, default values.
* @param {U[] | undefined} second User-specified values.
* @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first.
*/
function deepMergeArrays(first, second) {
Expand All @@ -50,7 +50,7 @@ function deepMergeArrays(first, second) {
}

return [
...first.map((value, i) => deepMergeObjects(value, i < second.length ? second[i] : void 0)),
...first.map((value, i) => deepMergeObjects(value, second[i])),
...second.slice(first.length)
];
}
Expand Down

0 comments on commit c9a60fd

Please sign in to comment.