Skip to content

Commit fb7a46f

Browse files
author
Sharma
committed
Upgraded typedef to 3.2.2, removed a bunch of ts-ignore and eslint statements
1 parent a65e972 commit fb7a46f

File tree

28 files changed

+2306
-4027
lines changed

28 files changed

+2306
-4027
lines changed

package-lock.json

Lines changed: 2294 additions & 3946 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575
},
7676
"devDependencies": {
7777
"@pega/configs": "^0.7.1",
78-
"@pega/constellationjs": "~0.242.5",
78+
"@pega/constellationjs": "~24.2.1",
7979
"@pega/eslint-config": "^0.7.2",
80-
"@pega/pcore-pconnect-typedefs": "~3.2.1",
80+
"@pega/pcore-pconnect-typedefs": "~3.2.2",
8181
"@pega/tsconfig": "^0.6.0",
8282
"@playwright/test": "^1.52.0",
8383
"@testing-library/jest-dom": "^5.17.0",

packages/react-sdk-components/src/auth.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// 3) Awaits a message from the host page and when received immediately postMessages back with the code
1111

1212
// For enabling logging via debugger (do not let it be a const...then can't change in debugger)
13-
// eslint-disable-next-line prefer-const
1413
let bDebug = false;
1514

1615
const queryString = window.location.search;
@@ -20,14 +19,12 @@
2019
const error = urlParams.get('error');
2120
const errorDesc = urlParams.get('error_description');
2221
// Silent authentication will work with just regular console.log
23-
// eslint-disable-next-line no-console
2422
let fnLog = console.log;
2523
try {
2624
// Check if in a popup window. If so use main window console.
2725
if (window.opener.console.log) {
2826
fnLog = window.opener.console.log;
2927
}
30-
// eslint-disable-next-line no-empty
3128
} catch (e0) {}
3229
const doLog = arg => {
3330
if (bDebug) {
@@ -44,15 +41,13 @@
4441
if (state) {
4542
embedOrigin = window.atob(state.split('.')[0]);
4643
}
47-
// eslint-disable-next-line no-empty
4844
} catch (e) {}
4945
if (!embedOrigin) {
5046
embedOrigin = window.location.origin;
5147
}
5248
return embedOrigin;
5349
};
5450

55-
// eslint-disable-next-line sonarjs/cognitive-complexity
5651
function main() {
5752
if (code || error) {
5853
try {

packages/react-sdk-components/src/components/field/CancelAlert/CancelAlert.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,12 @@ export default function CancelAlert(props: CancelAlertProps) {
5858
function cancelHandler() {
5959
if (isReverseCoexistence) {
6060
dismiss(true);
61-
// @ts-ignore - An argument for 'payload' was not provided.
6261
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
6362
} else if (!isDataObject && !isLocalAction && !isBulkAction) {
6463
disableButton(btnIds.DELETE);
6564
actionsAPI
6665
.deleteCaseInCreateStage(containerItemID, hideDelete)
6766
.then(() => {
68-
// @ts-ignore - An argument for 'payload' was not provided.
6967
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
7068
})
7169
.catch(() => {
@@ -84,7 +82,6 @@ export default function CancelAlert(props: CancelAlertProps) {
8482
actionsAPI.cancelBulkAction(containerItemID);
8583
} else {
8684
dismiss(true);
87-
// @ts-ignore - Argument of type '{ containerItemID: string; skipReleaseLockRequest: any; }' is not assignable to parameter of type 'ContainerInfo'.
8885
containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
8986
}
9087
}

packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ export default function Dropdown(props: DropdownProps) {
169169
return (
170170
<FieldValueList
171171
name={hideLabel ? '' : label}
172-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
173172
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
174173
/>
175174
);
@@ -179,7 +178,6 @@ export default function Dropdown(props: DropdownProps) {
179178
return (
180179
<FieldValueList
181180
name={hideLabel ? '' : label}
182-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
183181
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
184182
variant='stacked'
185183
/>
@@ -224,7 +222,6 @@ export default function Dropdown(props: DropdownProps) {
224222
>
225223
{options.map((option: any) => (
226224
<MenuItem key={option.key} value={option.key}>
227-
{/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
228225
{thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
229226
</MenuItem>
230227
))}

packages/react-sdk-components/src/components/field/RadioButtons/RadioButtons.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
6565
return (
6666
<FieldValueList
6767
name={hideLabel ? '' : label}
68-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
6968
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
7069
/>
7170
);
@@ -75,7 +74,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
7574
return (
7675
<FieldValueList
7776
name={hideLabel ? '' : label}
78-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
7977
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
8078
variant='stacked'
8179
/>
@@ -102,7 +100,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
102100
label={thePConn.getLocalizedValue(
103101
theOption.value,
104102
localePath,
105-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
106103
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
107104
)}
108105
control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}

packages/react-sdk-components/src/components/field/ScalarList/ScalarList.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ export default function ScalarList(props: ScalarListProps) {
3636
{
3737
type: componentType,
3838
config: {
39-
// @ts-ignore - Type '{ readOnly: true; displayInModal: boolean; value: any; displayMode: string; label: string; }' is not assignable to type 'ComponentMetadataConfig'.
4039
value: scalarValue,
4140
displayMode: 'DISPLAY_ONLY',
4241
label,
4342
...restProps,
44-
// @ts-ignore - Type 'string' is not assignable to type 'boolean | undefined'.
4543
readOnly: 'true'
4644
}
4745
},

packages/react-sdk-components/src/components/field/UserReference/UserReference.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ const UserReference = (props: UserReferenceProps) => {
8080
};
8181

8282
PCore.getRestClient()
83-
// @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
84-
// @ts-ignore - Expected 3 arguments, but got 2
8583
.invokeRestApi('getListData', { queryPayload })
86-
.then((res: any) => {
84+
.then(res => {
8785
const ddDataSource = res.data.data.map(listItem => ({
8886
key: listItem.pyUserIdentifier,
8987
value: listItem.pyUserName

packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
174174

175175
savePromise
176176
.then(() => {
177-
// @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
178177
const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
179178
onSaveActionSuccess({ caseType, caseID, assignmentID });
180179
})
@@ -189,10 +188,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
189188
// check if create stage (modal)
190189
const { PUB_SUB_EVENTS } = PCore.getConstants();
191190
const { publish } = PCore.getPubSubUtils();
192-
// @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
193191
const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
194192
const isLocalAction =
195-
// @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
196193
thePConn.getCaseInfo().isLocalAction() ||
197194
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
198195
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
@@ -275,7 +272,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
275272
}
276273

277274
// expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
278-
// @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
279275
const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
280276
const context = thePConn.getContextName();
281277
const pageReference = thePConn.getPageReference();

packages/react-sdk-components/src/components/infra/Containers/FlowContainer/FlowContainer.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
117117
if (caseViewMode && caseViewMode === 'review') {
118118
return true;
119119
}
120-
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
121-
if (caseViewMode && caseViewMode === 'perform') {
122-
return false;
123-
}
124-
125-
return true;
120+
return !(caseViewMode && caseViewMode === 'perform');
126121
}
127122

128123
function initComponent() {
@@ -181,11 +176,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
181176

182177
const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
183178
// const allAssignments = [];
184-
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
185-
if (childCases && childCases.length > 0) {
186-
return true;
187-
}
188-
return false;
179+
return !!(childCases && childCases.length > 0);
189180
}
190181

191182
function hasAssignments() {
@@ -276,7 +267,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
276267
setShowConfirm(true);
277268

278269
// publish this "assignmentFinished" for mashup, need to get approved as a standard
279-
// @ts-ignore - second parameter “payload” for publish method should be optional
280270
PCore.getPubSubUtils().publish('assignmentFinished');
281271

282272
// debugger;

0 commit comments

Comments
 (0)