Skip to content

Commit 1c00a90

Browse files
committed
Merge branch 'bugfix/FE-linting-fixes' into 'develop'
Bugfix/fe linting fixes See merge request genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator!375
2 parents 058ae07 + e892f18 commit 1c00a90

File tree

4 files changed

+30
-23
lines changed

4 files changed

+30
-23
lines changed

src/ui/.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
{
5757
"ignore": ["\\.css$"]
5858
}
59-
]
59+
],
60+
"react/require-default-props": "off",
61+
"react/default-props-match-prop-types": "off"
6062
}
6163
}

src/ui/src/components/common/confidence-alerts-utils.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,15 @@ export const getFieldConfidenceInfo = (fieldName, explainabilityInfo, path = [],
293293
// Handle array indices
294294
const index = parseInt(pathSegment, 10);
295295
if (!Number.isNaN(index) && index >= 0 && index < currentExplainabilityData.length) {
296-
currentExplainabilityData = currentExplainabilityData[index]; // nosemgrep: javascript.lang.security.audit.prototype-pollution.prototype-pollution-loop.prototype-pollution-loop - Index from controlled array iteration
296+
// nosemgrep: javascript.lang.security.audit.prototype-pollution.prototype-pollution-loop
297+
currentExplainabilityData = currentExplainabilityData[index];
297298
} else {
298299
return { hasConfidenceInfo: false };
299300
}
300301
} else {
301302
// Handle object properties
302-
currentExplainabilityData = currentExplainabilityData[pathSegment]; // nosemgrep: javascript.lang.security.audit.prototype-pollution.prototype-pollution-loop.prototype-pollution-loop - Index from controlled array iteration
303+
// nosemgrep: javascript.lang.security.audit.prototype-pollution.prototype-pollution-loop
304+
currentExplainabilityData = currentExplainabilityData[pathSegment];
303305
}
304306
} else {
305307
return { hasConfidenceInfo: false };

src/ui/src/components/common/debug-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const debugSectionStructure = (section, sectionId = 'Unknown') => {
2929
);
3030

3131
if (hasConfidenceFields) {
32-
console.log(`Found confidence data in Output.${key}:`, value); // nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring - Data from trusted internal source only
32+
console.log(`Found confidence data in Output.${key}:`, value); // nosemgrep: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring - Data from trusted internal source only
3333
}
3434
}
3535
});

src/ui/src/hooks/use-graphql-api.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,32 @@ const useGraphQlApi = ({ initialPeriodsToLoad = DOCUMENT_LIST_SHARDS_PER_DAY * 2
4343
});
4444
}, []);
4545

46-
const getDocumentDetailsFromIds = useCallback(async (objectKeys) => {
47-
// prettier-ignore
48-
logger.debug('getDocumentDetailsFromIds', objectKeys);
49-
const getDocumentPromises = objectKeys.map((objectKey) =>
50-
client.graphql({ query: getDocument, variables: { objectKey } }),
51-
);
52-
const getDocumentResolutions = await Promise.allSettled(getDocumentPromises);
53-
const getDocumentRejected = getDocumentResolutions.filter((r) => r.status === 'rejected');
54-
if (getDocumentRejected.length) {
55-
setErrorMessage('failed to get document details - please try again later');
56-
logger.error('get document promises rejected', getDocumentRejected);
57-
}
58-
const documentValues = getDocumentResolutions
59-
.filter((r) => r.status === 'fulfilled')
60-
.map((r) => r.value?.data?.getDocument);
46+
const getDocumentDetailsFromIds = useCallback(
47+
async (objectKeys) => {
48+
// prettier-ignore
49+
logger.debug('getDocumentDetailsFromIds', objectKeys);
50+
const getDocumentPromises = objectKeys.map((objectKey) =>
51+
client.graphql({ query: getDocument, variables: { objectKey } }),
52+
);
53+
const getDocumentResolutions = await Promise.allSettled(getDocumentPromises);
54+
const getDocumentRejected = getDocumentResolutions.filter((r) => r.status === 'rejected');
55+
if (getDocumentRejected.length) {
56+
setErrorMessage('failed to get document details - please try again later');
57+
logger.error('get document promises rejected', getDocumentRejected);
58+
}
59+
const documentValues = getDocumentResolutions
60+
.filter((r) => r.status === 'fulfilled')
61+
.map((r) => r.value?.data?.getDocument);
6162

62-
return documentValues;
63-
}, [setErrorMessage]);
63+
return documentValues;
64+
},
65+
[setErrorMessage],
66+
);
6467

6568
useEffect(() => {
6669
if (subscriptionsRef.current.onCreate) {
6770
logger.debug('onCreateDocument subscription already exists, skipping');
68-
return;
71+
return undefined;
6972
}
7073

7174
logger.debug('onCreateDocument subscription');
@@ -105,7 +108,7 @@ const useGraphQlApi = ({ initialPeriodsToLoad = DOCUMENT_LIST_SHARDS_PER_DAY * 2
105108
useEffect(() => {
106109
if (subscriptionsRef.current.onUpdate) {
107110
logger.debug('onUpdateDocument subscription already exists, skipping');
108-
return;
111+
return undefined;
109112
}
110113

111114
logger.debug('onUpdateDocument subscription setup');

0 commit comments

Comments
 (0)