refactor: Add lint rule for unsafe property access with lodash get/set (no-changelog) (#8587)
This commit is contained in:
@@ -176,11 +176,11 @@ function optionSelected(optionName: string) {
|
||||
// The "fixedCollection" entries are different as they save values
|
||||
// in an object and then underneath there is an array. So initialize
|
||||
// them differently.
|
||||
const retrievedObjectValue = get(props.nodeValues, `${props.path}.${optionName}`, {});
|
||||
const retrievedObjectValue = get(props.nodeValues, [props.path, optionName], {});
|
||||
newValue = retrievedObjectValue;
|
||||
} else {
|
||||
// Everything else saves them directly as an array.
|
||||
const retrievedArrayValue = get(props.nodeValues, `${props.path}.${optionName}`, []) as Array<
|
||||
const retrievedArrayValue = get(props.nodeValues, [props.path, optionName], []) as Array<
|
||||
typeof option.default
|
||||
>;
|
||||
if (Array.isArray(retrievedArrayValue)) {
|
||||
|
||||
@@ -297,7 +297,7 @@ export default defineComponent({
|
||||
// Multiple values are allowed so append option to array
|
||||
newParameterValue[optionParameter.name] = get(
|
||||
this.nodeValues,
|
||||
`${this.path}.${optionParameter.name}`,
|
||||
[this.path, optionParameter.name],
|
||||
[],
|
||||
);
|
||||
if (Array.isArray(optionParameter.default)) {
|
||||
|
||||
@@ -480,15 +480,15 @@ export default defineComponent({
|
||||
|
||||
const nodeResponseDataArray = get(
|
||||
this.workflowsStore.getWorkflowExecution?.data?.resultData.runData,
|
||||
`[${lastNodeExecuted}]`,
|
||||
lastNodeExecuted,
|
||||
) as ITaskData[];
|
||||
|
||||
const nodeResponseData = nodeResponseDataArray[nodeResponseDataArray.length - 1];
|
||||
|
||||
let responseMessage: string;
|
||||
|
||||
if (get(nodeResponseData, ['error'])) {
|
||||
responseMessage = '[ERROR: ' + get(nodeResponseData, ['error', 'message']) + ']';
|
||||
if (get(nodeResponseData, 'error')) {
|
||||
responseMessage = '[ERROR: ' + get(nodeResponseData, 'error.message') + ']';
|
||||
} else {
|
||||
const responseData = get(nodeResponseData, 'data.main[0][0].json');
|
||||
responseMessage = this.extractResponseMessage(responseData);
|
||||
|
||||
Reference in New Issue
Block a user