-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HLM-6172 shifting toast to create microplan #866
Conversation
WalkthroughWalkthroughThe updates primarily address the use of Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
Outside diff range and nitpick comments (27)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (1)
Line range hint
290-292
: Add akey
property to elements in a list to improve performance and consistency.- <p key={index} className="microplan-naming-convention-instruction-list text"> + <p key={`instruction-${index}`} className="microplan-naming-convention-instruction-list text">micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (5)
Line range hint
133-135
: This else clause can be omitted as the previous branches break early, simplifying the control flow.- else { + // Removed unnecessary else clause
Line range hint
397-405
: Ensure that actions triggered by mouse events also have corresponding keyboard events to accommodate users who rely on keyboard navigation.+ onKeyUp={yourKeyUpHandler}
Also applies to: 420-420
Line range hint
379-379
: Explicitly define thetype
attribute for button elements to prevent unexpected form submissions.- <button className="delete-button invisible" onClick={() => deleteHandler(item)}> + <button type="button" className="delete-button invisible" onClick={() => deleteHandler(item)"> - <button className="delete-button delete-button-help-locator" onClick={() => deleteHandler(item)}> + <button type="button" className="delete-button delete-button-help-locator" onClick={() => deleteHandler(item)}>Also applies to: 420-420
Line range hint
580-580
: ReplaceisNaN
withNumber.isNaN
to avoid type coercion and ensure more reliable checks.- if (isNaN(value)) + if (Number.isNaN(value))Also applies to: 585-585
260-262
: The commented-out toast display logic should be removed if it is no longer needed, to keep the code clean and maintainable.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (5)
Line range hint
146-146
: Consider using optional chaining to safely access nested properties.- if (state?.tourStateData?.name === page) return; + if (state?.tourStateData?.name === page) return;Note: The code provided is already correct but ensure consistency in accessing nested properties throughout the codebase.
Line range hint
505-512
: Ensure that actions triggered by mouse events have corresponding keyboard events to support accessibility.+ onKeyPress={handleKeyPress}
Line range hint
829-838
: ReplaceflatMap
withflat
since the callback function identity results in unnecessary complexity.- .flatMap((item) => item) + .flat()
Line range hint
869-874
: Theelse
clause is unnecessary as previous branches terminate early.- else { + // Removed unnecessary else clause
Line range hint
494-494
: Specify thetype
attribute for buttons to prevent unintended form submissions.- <button ...> + <button type="button" ...>Also applies to: 578-578
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (9)
24-24
: Consider using TypeScript for better type safety and easier maintenance.Adopting TypeScript could help improve the robustness of your code by providing compile-time type checking and better editor integration for autocomplete and error detection.
Line range hint
130-130
: Use optional chaining to prevent runtime errors.- if (campaignData?.hierarchyType) { + if (campaignData?.hierarchyType?) {This change ensures that the code does not throw an error if
campaignData
is undefined.
Line range hint
275-275
: Declare variables at the top of the function scope to improve readability.+ var keys; var keys = Object.keys(fileData?.data.features[0].properties);
Moving variable declarations to the top of their scope makes the code cleaner and easier to understand.
Line range hint
374-374
: Remove duplicate object property to prevent potential bugs.- padding: 0, - padding: "1rem", + padding: "1rem",Ensure that object properties are not declared multiple times as it may lead to unexpected behaviors.
Line range hint
706-708
: Remove unnecessary else clause to simplify control flow.- } else { - return innerJoinLists(accumulator, currentData, commonColumn, filteredSchemaColumns); - } + return innerJoinLists(accumulator, currentData, commonColumn, filteredSchemaColumns);Simplifying control structures can make the code easier to read and maintain.
Line range hint
725-734
: ReplaceflatMap
withflat
where no transformation is needed.- tempdata = filteredSchemas?.map((item) => item).flatMap((item) => item); + tempdata = filteredSchemas?.map((item) => item).flat();Using
flat
directly is more appropriate here since no transformation is being applied in theflatMap
.
Line range hint
614-614
: ReplaceisNaN
withNumber.isNaN
for accurate checks.- if (isNaN(parseInt(aggregate))) { + if (Number.isNaN(parseInt(aggregate))) {
Number.isNaN
provides a more accurate check as it does not force a type conversion unlike the globalisNaN
.Also applies to: 947-947, 1128-1128, 1215-1215
Line range hint
1128-1128
: UseNumber.isFinite
instead ofisFinite
for type-safe checks.- if (isFinite(value) && value !== "") { + if (Number.isFinite(value) && value !== "") {
Number.isFinite
is safer as it does not coerce the type, unlike the globalisFinite
.
396-398
: Ensure that commented-out code is necessary before merging.Consider removing or revising this commented-out code if it's no longer needed. Keeping the codebase clean from unused code snippets helps maintainability.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (5)
Line range hint
38-38
: ReplacehasOwnProperty
withObject.hasOwn
for better safety and future compatibility.- if (obj.hasOwnProperty(key)) { + if (Object.hasOwn(obj, key)) {
Line range hint
530-530
: Ensure that clickable elements are accessible via keyboard by adding corresponding keyboard events.<div className="icon" onClick={() => setShowChoroplethOptions((previous) => !previous)} + onKeyUp={() => setShowChoroplethOptions((previous) => !previous)} tabIndex={0} >
Line range hint
535-535
: RemovetabIndex
from non-interactive elements to improve accessibility.- <div className="icon" tabIndex={0}> + <div className="icon">
Line range hint
583-583
: Ensure that all clickable elements are accessible via keyboard by adding corresponding keyboard events.+ onKeyUp={handleClick} + onKeyDown={handleClick}Also applies to: 584-584, 722-729, 837-837, 847-853
Line range hint
1068-1068
: Declare variables at the root of the function or wrap them in blocks within switch clauses to avoid scope leakage and potential bugs.function exampleFunction() { + let variable; switch(condition) { case 'case1': + { let scopedVariable = 'value'; + } break; case 'case2': + { let anotherScopedVariable = 'anotherValue'; + } break; } }Also applies to: 1079-1079, 1079-1079, 1083-1093, 1108-1108
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (2)
Line range hint
1125-1125
: Please ensure that actions triggered via mouse events also have corresponding keyboard events to support accessibility for keyboard-only users.+ onKeyUp={handleKeyUp} + onKeyDown={handleKeyDown} + onKeyPress={handleKeyPress}Also applies to: 1148-1148
Line range hint
1238-1238
: It's important to explicitly specify thetype
attribute for button elements to prevent unexpected form submissions. The default type for button elements is "submit", which can cause forms to submit unintentionally.+ type="button"
Also applies to: 1277-1277, 1294-1294, 1298-1298
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (4 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (2 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Nagivator.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js (4 hunks)
Additional context used
Path-based instructions (8)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Nagivator.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (1)
Pattern
**/*.js
: check
Learnings (1)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (1)
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#691 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:16-17 Timestamp: 2024-05-24T06:50:09.317Z Learning: The components `Loader`, `Toast`, and `Modal` are from different libraries in the DIGIT-Frontend project, as clarified by the user.
Biome
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js
[error] 93-93: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 113-113: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 148-148: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 225-225: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 226-226: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 227-227: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 234-234: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js
[error] 118-118: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 149-154: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 290-290: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
[error] 292-292: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js
[error] 62-62: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 74-74: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 133-135: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 397-405: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 502-502: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 508-508: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 379-379: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 420-420: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 580-580: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 585-585: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js
[error] 146-146: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 158-158: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 505-512: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 695-695: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 716-716: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 829-838: Avoid unnecessary callback in flatMap call. (lint/correctness/noFlatMapIdentity)
You can just use flat to flatten the array.
Safe fix: Replace unnecessary flatMap call to flat instead.
[error] 869-874: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 494-494: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 578-578: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or resetmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js
[error] 130-130: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 275-275: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 374-374: This property value named padding is later overwritten by an object member with the same name. (lint/suspicious/noDuplicateObjectKeys)
Overwritten with this value.
If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property value named padding
[error] 706-708: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 725-734: Avoid unnecessary callback in flatMap call. (lint/correctness/noFlatMapIdentity)
You can just use flat to flatten the array.
Safe fix: Replace unnecessary flatMap call to flat instead.
[error] 738-745: Avoid unnecessary callback in flatMap call. (lint/correctness/noFlatMapIdentity)
You can just use flat to flatten the array.
Safe fix: Replace unnecessary flatMap call to flat instead.
[error] 803-803: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 867-867: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1049-1051: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1064-1064: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1080-1080: Avoid unnecessary callback in flatMap call. (lint/correctness/noFlatMapIdentity)
You can just use flat to flatten the array.
Safe fix: Replace unnecessary flatMap call to flat instead.
[error] 1096-1096: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 1096-1096: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 1099-1108: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 1110-1110: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 614-614: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 947-947: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 1128-1128: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 1128-1128: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead. (lint/suspicious/noGlobalIsFinite)
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.
[error] 1215-1215: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js
[error] 38-38: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 530-530: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 535-535: The HTML element div is non-interactive. Do not use tabIndex. (lint/a11y/noNoninteractiveTabindex)
Adding non-interactive elements to the keyboard navigation flow can confuse users.
Unsafe fix: Remove the tabIndex attribute.
[error] 573-573: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
[error] 583-583: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 584-584: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 722-729: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 837-837: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 847-853: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 928-928: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 937-937: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 938-938: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 967-968: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1068-1068: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 1069-1069: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1071-1071: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1079-1079: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 1079-1079: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 1083-1093: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 1108-1108: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js
[error] 219-219: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 282-282: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 555-555: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 697-702: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1125-1125: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1148-1148: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1216-1219: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1364-1366: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 1384-1384: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 1394-1447: Promise executor functions should not be
async
. (lint/suspicious/noAsyncPromiseExecutor)
[error] 1461-1463: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1587-1589: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1700-1700: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 1809-1809: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 704-704: Reassigning a catch parameter is confusing. (lint/suspicious/noCatchAssign)
The catch parameter is declared here:
Use a local variable instead.
[error] 1146-1146: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
[error] 1238-1238: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 1277-1277: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 1294-1294: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 1298-1298: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
Additional comments not posted (17)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js (2)
174-182
: Ensure error handling is robust in asynchronous operations.Also applies to: 208-216
Verification successful
The verification process indicates that the error message "ERROR_DATA_NOT_SAVED" is used consistently across the application in various files. Additionally, the extracted error handling blocks show that errors are being caught and appropriate actions are being taken, such as setting toast messages and handling loaders.
CreateMicroplan.js
andMicroplanPreview.js
both have robust error handling where the error message "ERROR_DATA_NOT_SAVED" is used.- Other files also demonstrate structured error handling practices.
Given this evidence, the error handling in the provided code snippet and across the application appears to be robust and consistent.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify correct error messages are used across the application for consistency. rg "ERROR_DATA_NOT_SAVED" --type jsLength of output: 926
Script:
#!/bin/bash # Extract all error handling code in CreateMicroplan.js ast-grep --lang javascript --pattern $'try { $$$ } catch (error) { $$$ }' --json | jq -r '.[] | select(.path | contains("CreateMicroplan.js")) | .match' # Extract all error handling code in MicroplanPreview.js ast-grep --lang javascript --pattern $'try { $$$ } catch (error) { $$$ }' --json | jq -r '.[] | select(.path | contains("MicroplanPreview.js")) | .match'Length of output: 528
Script:
#!/bin/bash # Extract all error handling code in CreateMicroplan.js with improved jq handling ast-grep --lang javascript --pattern $'try { $$$ } catch (error) { $$$ }' --json | jq -r 'map(select(.path != null and .path | contains("CreateMicroplan.js")) | .match)' # Extract all error handling code in MicroplanPreview.js with improved jq handling ast-grep --lang javascript --pattern $'try { $$$ } catch (error) { $$$ }' --json | jq -r 'map(select(.path != null and .path | contains("MicroplanPreview.js")) | .match)'Length of output: 570
Script:
#!/bin/bash # Extract all error handling code in CreateMicroplan.js and output the entire JSON for inspection ast-grep --lang javascript --pattern $'try { $$$ } catch (error) { $$$ }' --json > create_microplan_error_handling.json cat create_microplan_error_handling.json # Extract all error handling code in MicroplanPreview.js and output the entire JSON for inspection ast-grep --lang javascript --pattern $'try { $$$ } catch (error) { $$$ }' --json > microplan_preview_error_handling.json cat microplan_preview_error_handling.jsonLength of output: 279308
43-43
: Consider using optional chaining for state access to improve safety.- const { state } = useMyContext(); + const { state } = useMyContext() ?? {};Likely invalid or redundant comment.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Nagivator.js (1)
50-53
: Ensure error handling is robust in navigation events.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (3)
22-22
: ThesetToast
function is now passed as a prop to theHypothesis
component, aligning with the changes described in the PR summary.
33-33
: The local toast state has been commented out, which is consistent with the PR's objective to usesetToast
from props. Ensure that all references to the local toast state are removed or replaced throughout the component.
Line range hint
62-62
: Consider using optional chaining to improve the robustness of your code against null and undefined values.
[REFACTOR_Suggestion]- if (previouspage?.checkForCompleteness && !microplanData?.status?.[previouspage?.name]) + if (previouspage?.checkForCompleteness && !microplanData?.status?.[previouspage?.name]?) - if (item && item.key && !filteredOptions.includes(item.key)) + if (item?.key && !filteredOptions?.includes(item.key))Also applies to: 74-74, 502-502, 508-508
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (2)
23-23
: EnsuresetToast
is properly propagated through all components that require it.
40-40
: The commented-out state initialization fortoast
aligns with the PR's objective to shift toast handling to a prop-based approach. However, ensure that all instances wheretoast
was used are now correctly usingsetToast
from props.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (4)
56-56
: ThesetToast
function is now passed as a prop to standardize toast handling across components. This change aligns with the modification in other components as noted in the PR summary.
114-114
: The commented-out initialization oftoast
andsetToast
is consistent with the changes described in the summary where internal toast state management is being deprecated in favor of prop-based handling.
Line range hint
928-928
: Refactor to use optional chaining for safer and cleaner access to nested properties.
[REFACTOR_SUGGESTion]- if (someObject && someObject.someProperty && someObject.someProperty.someNestedProperty) { + if (someObject?.someProperty?.someNestedProperty) {Also applies to: 937-937, 938-938, 967-968, 1069-1069, 1071-1071
441-446
: Commented-out toast rendering logic is appropriate given the shift to prop-based toast handling as described in the PR summary.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (5)
46-46
: The addition ofsetToast
as a prop to this component aligns with the PR's objective to centralize toast management. This is a good architectural move as it promotes reusability and modularity by handling toasts at a higher level rather than managing state within each component.
60-60
: The commented-out line forsetToast
state initialization is consistent with the changes made across other components as per the PR's description. This ensures thatsetToast
is now being managed externally and passed as a prop, which is a cleaner and more maintainable approach.
Line range hint
219-219
: Consider using optional chaining in these lines to prevent potential runtime errors when accessing properties on undefined or null objects. This will enhance the robustness of the code.
[REFACTOR_SUGGESTion]- if (state?.tourStateData?.name === page) return; + if (state?.tourStateData?.name !== page) return; - if (!fileDataList || checkDataCompletion !== "true" || !setCheckDataCompletion) return; + if (!fileDataList || checkDataCompletion !== "true" || !setCheckDataCompletion) return; - if (!fileDataList || !setMicroplanData) return; + if (!fileDataList || !setMicroplanData) return; - if (previewUploadedData) setPreviewUploadedData(undefined); + if (previewUploadedData) setPreviewUploadedData(undefined); - if (modal !== "upload-guidelines") return; + if (modal !== "upload-guidelines") return;Also applies to: 282-282, 555-555, 1216-1219, 1809-1809
Line range hint
697-702
: Theseelse
clauses are redundant as the precedingif
statements already break the control flow withreturn
. Removing these will simplify the code and improve readability.
[REFACTOR_SUGGESTion]- else { - if (navigationEvent?.name === "next") { - if (currentSectionIndex < sections.length - 1) { - setSelectedSection(sections[currentSectionIndex + 1]); - setCheckDataCompletion("false"); - return; - } - } else if (navigationEvent?.name === "previousStep") { - if (currentSectionIndex > 0) { - setSelectedSection(sections[currentSectionIndex - 1]); - setCheckDataCompletion("false"); - return; - } - } - }Also applies to: 1461-1463, 1587-1589
Line range hint
1364-1366
: This function expression can be converted into an arrow function for consistency and to reduce the function's verbosity.
[REFACTOR_SUGGESTion]- const trimJSON = function(jsonObject) { + const trimJSON = (jsonObject) => {
...web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js
Show resolved
Hide resolved
.../micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js
Show resolved
Hide resolved
.../micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Nagivator.js
Show resolved
Hide resolved
...web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js
Show resolved
Hide resolved
...web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range and nitpick comments (13)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (1)
Line range hint
71-71
: ReplaceisNaN
andisFinite
withNumber.isNaN
andNumber.isFinite
to avoid type coercion and ensure more accurate checks.- !isNaN(rowData[cellIndex]) && isFinite(rowData[cellIndex]) + !Number.isNaN(rowData[cellIndex]) && Number.isFinite(rowData[cellIndex])micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (6)
Line range hint
38-38
: Replaceobj.hasOwnProperty(key)
withObject.hasOwn(obj, key)
to avoid issues related to the prototype chain.- if (obj.hasOwnProperty(key)) { + if (Object.hasOwn(obj, key)) {
Line range hint
530-530
: Ensure that all clickable elements triggered by mouse events are accessible via keyboard by adding appropriate keyboard event handlers.+ onKeyUp={() => setShowChoroplethOptions((previous) => !previous)}
Also applies to: 583-584, 722-729, 837-837, 847-853
Line range hint
535-535
: Remove thetabIndex
attribute from non-interactive elements to maintain proper accessibility standards.- <div - className="icon" - onClick={() => setShowChoroplethOptions((previous) => !empty)} - onKeyUp={() => setShowChoroplethOptions((previous) => !empty)} - tabIndex={0} - > + <div + className="icon" + onClick={() => setShowChoroplethOptions((previous) => !empty)} + onKeyUp={() => setShowChoroplethOptions((previous) => !empty)} + >
Line range hint
573-573
: Avoid using assignments within expressions to reduce complexity and improve code clarity.- let check = true; - check = check && columnList.includes(t(colName)); // Check if columns exist in the file + let check = columnList.includes(t(colName)); // Check if columns exist in the file
Line range hint
928-928
: Utilize optional chaining to simplify property access and avoid potential runtime errors due to undefined or null values.- if (fileData?.data?.features[0].properties) + if (fileData?.data?.features[0]?.properties)Also applies to: 937-937, 938-938, 967-968, 1069-1069, 1071-1071
Line range hint
1068-1068
: Move variable declarations to the root of the enclosing function to enhance readability and maintain standard JavaScript practices.+ let keys; + let values; ... - var keys = Object.keys(fileData?.data.features[0].properties); - var values = fileData?.data?.features.map((feature) => {Also applies to: 1079-1079
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (6)
Line range hint
219-219
: Consider using optional chaining to enhance code safety and readability.- if (navigationEvent?.name !== "step") { + if (navigationEvent?.name !== "step") {
Line range hint
697-702
: Theelse
clause afterreturn
statements is redundant and can be removed to simplify the control flow.- } else if (navigationEvent?.name === "previousStep") { + if (navigationEvent?.name === "previousStep") {
Line range hint
1132-1132
: Consider adding keyboard event handlers (likeonKeyUp
,onKeyDown
, oronKeyPress
) to complement theonClick
event for accessibility.
Line range hint
1155-1155
: Keyboard event handlers are recommended to accompanyonClick
events to ensure accessibility for users relying on keyboard navigation.
Line range hint
1416-1418
: This function can be converted to an arrow function to make the code more concise and improve readability.- const checkProjection = async (zip) => { + const checkProjection = async (zip) => {
Line range hint
1436-1436
: ReplacehasOwnProperty
withObject.hasOwn()
for better safety and to avoid issues with prototype chain properties.- if (jsonObject.hasOwnProperty(key)) { + if (Object.hasOwn(jsonObject, key)) {
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (13)
micro-ui/web/micro-ui-internals/packages/css/package.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/AutoFilledRuleConfigurations.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/BaseMapLayers.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/HierarchyConfigurations.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/HypothesisAssumptions.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/MapFilters.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/MicroplanPreviewAggregates.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/NumberFormatMappingForTranslation.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/Resources.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/RuleConfigureOutput.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/Schemas.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/UIConfiguration.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMS/UploadConfiguration.json
is excluded by!**/*.json
Files selected for processing (9)
- micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (2 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (4 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (5 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (4 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (15 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js (2 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (5 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js (1 hunks)
- micro-ui/web/public/index.html (1 hunks)
Files not summarized due to errors (3)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js: Error: Server error. Please try again later.
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js: Error: Server error. Please try again later.
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js: Error: Server error. Please try again later.
Files skipped from review due to trivial changes (1)
- micro-ui/web/public/index.html
Additional context used
Path-based instructions (7)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (1)
Pattern
**/*.js
: check
Learnings (2)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (1)
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#720 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js:7-7 Timestamp: 2024-05-28T16:57:07.490Z Learning: In `excelValidations.js`, the variables `locationDataColumns`, `errors`, `hasDataErrors`, `missingColumnsList`, and `errorMessages` are reassigned later in the code, making the use of `let` appropriate.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (2)
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#845 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:460-461 Timestamp: 2024-06-12T08:18:44.708Z Learning: Error handling for Shapefile parsing in `Upload.js` is managed commonly and is handled elsewhere in the codebase, as clarified by the user.
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#204 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:0-0 Timestamp: 2024-03-13T05:11:36.400Z Learning: A more detailed message for file parsing errors in the `Upload.js` file is displayed elsewhere in the code, as clarified by the user.
Biome
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js
[error] 10-52: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 54-57: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js
[error] 71-71: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 71-71: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead. (lint/suspicious/noGlobalIsFinite)
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js
[error] 126-126: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
[error] 168-175: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js
[error] 118-118: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 149-154: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 291-291: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
[error] 293-293: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js
[error] 38-38: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 300-300: This is an unexpected use of the debugger statement. (lint/suspicious/noDebugger)
Unsafe fix: Remove debugger statement
[error] 530-530: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 535-535: The HTML element div is non-interactive. Do not use tabIndex. (lint/a11y/noNoninteractiveTabindex)
Adding non-interactive elements to the keyboard navigation flow can confuse users.
Unsafe fix: Remove the tabIndex attribute.
[error] 573-573: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
[error] 583-583: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 584-584: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 722-729: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 837-837: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 847-853: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 928-928: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 937-937: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 938-938: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 967-968: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1068-1068: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 1069-1069: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1071-1071: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1079-1079: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 1079-1079: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 1083-1093: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js
[error] 219-219: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 282-282: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 555-555: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 697-702: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1132-1132: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1155-1155: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1223-1226: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1361-1361: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1416-1418: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 1436-1436: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 1446-1499: Promise executor functions should not be
async
. (lint/suspicious/noAsyncPromiseExecutor)
[error] 1513-1515: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1639-1641: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1752-1752: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 1861-1861: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 704-704: Reassigning a catch parameter is confusing. (lint/suspicious/noCatchAssign)
The catch parameter is declared here:
Use a local variable instead.
[error] 1153-1153: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
[error] 1245-1245: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 1317-1317: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 1334-1334: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
Additional comments not posted (12)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js (1)
85-85
: Ensure that the integration ofUIConfiguration
andSchemas
into the state is handled correctly and efficiently, particularly regarding re-renders and data flow.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (3)
33-33
: Consider passingsetToast
directly to maintain consistency and avoid prop drilling.
40-40
: It's good practice to remove commented code if it's no longer needed, as it keeps the codebase clean and maintainable.
305-307
: Consider removing commented code that handles toast display if it's no longer needed.micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (2)
302-302
: Correct usage of class naming conventions for better specificity and maintainability.
580-597
: Improved the structure of the.file-upload-error-container
for better readability and maintenance.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (4)
56-56
: The addition ofsetToast
in the function parameters allows for better control over toast messages from parent components, enhancing modularity and reusability.
114-114
: Commenting out the localsetToast
state initialization aligns with the changes to usesetToast
passed as props, preventing redundant state management.
Line range hint
1079-1079
: Wrap declarations within switch cases in blocks to limit their scope and avoid potential conflicts with other cases.
[REFACTOR_SUGGESTion]case EXCEL: { + let columnList = Object.values(fileData?.data)?.[0]?.[0]; ... } break;
Also applies to: 1083-1093
441-446
: The commented-out toast rendering logic seems to be a part of the transition to using thesetToast
from props. Ensure this is intentional and that all toast functionalities are tested in the new implementation.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (2)
46-46
: The addition of thesetToast
parameter to theUpload
component aligns with the changes described in the summary, centralizing toast management. This is a good practice for consistency and maintainability.
60-60
: Commenting out local toast state management is consistent with the centralization of toast handling. Ensure that all toast functionality is adequately handled by the new centralized approach.
...web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js
Outdated
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js
Show resolved
Hide resolved
...o-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siddhant-nawale-egov merging for now since ui/ux fixes are here. We should create another PR for addressing the comments/changes on this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (8)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (8)
Line range hint
38-38
: ReplacehasOwnProperty
withObject.hasOwn()
for better security and performance.- if (obj.hasOwnProperty(key)) { + if (Object.hasOwn(obj, key)) {
Line range hint
530-530
: Ensure accessibility by adding keyboard event handlers alongside mouse event handlers.- <div onClick={...}> + <div onClick={...} onKeyUp={...} onKeyDown={...}>
Line range hint
535-535
: RemovetabIndex
from non-interactive elements to improve accessibility.- <div tabIndex={0}> + <div>
Line range hint
573-573
: Avoid assignments within expressions for clearer code.- if (condition = checkFunction()) { + const condition = checkFunction(); + if (condition) {
Line range hint
583-584
: Add keyboard event handlers for accessibility.- <div onClick={handleClick}> + <div onClick={handleClick} onKeyUp={handleKeyUp} onKeyDown={handleKeyDown}>Also applies to: 722-729, 837-837, 847-853
Line range hint
928-928
: Use optional chaining for safer property access.- if (obj && obj.prop && obj.prop.subProp) { + if (obj?.prop?.subProp) {Also applies to: 937-937, 938-938, 967-968, 1069-1069, 1071-1071
Line range hint
1068-1068
: Declare variables at the function root to avoid confusion and potential bugs.function example() { + var declaration; if (condition) { - var declaration = value; + declaration = value; } }Also applies to: 1079-1079, 1079-1079
Line range hint
1079-1079
: Wrap declarations in a block to restrict access to the respective switch clause.switch(expression) { case 'example': + { let declaration = value; + } break; }Also applies to: 1083-1093, 1108-1108
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (4 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (4 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (15 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (5 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/geojsonValidations.js (2 hunks)
Files not reviewed due to errors (5)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (Error: Server error. Please try again later.)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (Error: Server error. Please try again later.)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/geojsonValidations.js (Error: Server error. Please try again later.)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (Error: Server error. Please try again later.)
- micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (Error: Server error. Please try again later.)
Additional context used
Path-based instructions (6)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/geojsonValidations.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (1)
Pattern
**/*.js
: check
Learnings (4)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (1)
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#720 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js:48-49 Timestamp: 2024-05-28T17:07:29.411Z Learning: In `JsonPreviewInExcelForm.js`, the variables `headerName` and `error` are only assigned once within the scope of the `map` function, making the use of `const` appropriate.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (1)
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#720 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js:7-7 Timestamp: 2024-05-28T16:57:07.490Z Learning: In `excelValidations.js`, the variables `locationDataColumns`, `errors`, `hasDataErrors`, `missingColumnsList`, and `errorMessages` are reassigned later in the code, making the use of `let` appropriate.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/geojsonValidations.js (1)
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#214 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:14-17 Timestamp: 2024-03-15T12:20:50.090Z Learning: The `geojsonValidations` is a utility developed within the DIGIT-Frontend project, not an external dependency.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (1)
User: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#845 File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js:460-461 Timestamp: 2024-06-12T08:18:44.708Z Learning: Error handling for Shapefile parsing in `Upload.js` is managed commonly and is handled elsewhere in the codebase, as clarified by the user.
Biome
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js
[error] 71-71: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 71-71: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead. (lint/suspicious/noGlobalIsFinite)
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js
[error] 128-128: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
[error] 170-177: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/geojsonValidations.js
[error] 28-32: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 30-32: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 170-170: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js
[error] 118-118: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 149-154: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 291-291: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
[error] 293-293: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js
[error] 38-38: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 530-530: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 535-535: The HTML element div is non-interactive. Do not use tabIndex. (lint/a11y/noNoninteractiveTabindex)
Adding non-interactive elements to the keyboard navigation flow can confuse users.
Unsafe fix: Remove the tabIndex attribute.
[error] 573-573: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
[error] 583-583: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 584-584: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 722-729: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 837-837: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 847-853: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 928-928: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 937-937: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 938-938: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 967-968: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1068-1068: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 1069-1069: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1071-1071: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1079-1079: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 1079-1079: This var should be declared at the root of the enclosing function. (lint/correctness/noInnerDeclarations)
The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.
[error] 1083-1093: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
[error] 1108-1108: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js
[error] 219-219: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 282-282: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 555-555: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 697-702: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1132-1132: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1155-1155: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1223-1226: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 1361-1361: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)
Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
[error] 1416-1418: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)
Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.
[error] 1436-1436: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 1446-1499: Promise executor functions should not be
async
. (lint/suspicious/noAsyncPromiseExecutor)
[error] 1513-1515: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1639-1641: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1752-1752: Do not access Object.prototype method 'hasOwnProperty' from target object. (lint/suspicious/noPrototypeBuiltins)
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.
[error] 1861-1861: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
[error] 704-704: Reassigning a catch parameter is confusing. (lint/suspicious/noCatchAssign)
The catch parameter is declared here:
Use a local variable instead.
[error] 1153-1153: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
[error] 1245-1245: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 1317-1317: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
[error] 1334-1334: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
form
element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
No description provided.