Skip to content
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 campaigntype automation #775

Merged
merged 8 commits into from
Jun 5, 2024
Merged

Conversation

siddhant-nawale-egov
Copy link
Contributor

No description provided.

Copy link
Contributor

coderabbitai bot commented Jun 4, 2024

Warning

Rate limit exceeded

@siddhant-nawale-egov has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 48 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 43a77c0 and 55560bd.

Walkthrough

The recent updates focus on refining the micro-ui project by enhancing styling, adjusting default value assignments for campaignType, improving session storage handling, and updating data processing logic. Additionally, the changes involve adopting the ExcelJS library for Excel file generation, improving user interface elements, and refining error handling and display logic.

Changes

Files/Directories Change Summary
.../microplanning.scss Added and adjusted styling for various components.
.../Hypothesis.js, .../Mapping.js, .../MicroplanDetails.js, .../MicroplanPreview.js, .../RuleEngine.js, .../Upload.js, .../CreateMicroplan.js, .../SavedMicroplans.js Updated campaignType default value assignment to retrieve data from Digit.SessionStorage.
.../MicroplanningHeader.js Updated zIndex and added primaryColor to Tutorial component.
.../resourceMapping.js Adjusted scroll behavior calculation.
.../JsonPreviewInExcelForm.js Added conditional rendering for error messages and updated row styling logic.
.../MicroplanCreatedScreen.js Made downloadMicroplan function asynchronous and updated function call.
.../tourSteps.js Added disableOverlay: true to various objects in tourSteps configuration.
.../index.js Imported various JSON files and updated SETINITDATA action.
.../updateSessionUtils.js Modified findSchema function call to use dynamic campaignType value.
.../exceltojson.js Removed unnecessary FileReader line.
public/index.html Updated CSS file version for @egovernments/digit-ui-css.
.../constants.js Added new constants: BOUNDARY_DATA_SHEET and FACILITY_DATA_SHEET.
.../createTemplate.js Refactored multiple functions, updated logic for boundary and facility data handling.
.../index.js (utils) Added conditional check in mapDataForApi function.
.../jsonToExcelBlob.js Switched to ExcelJS for Excel file generation, updated data formatting and column width settings.

Poem

In the land of micro UI,
Changes flutter, updates fly high,
From styling tweaks to session's call,
New features stand proud and tall.
Excel sheets now shine with glee,
Thanks to ExcelJS, data flows free.
A rabbit's joy, in code's sweet song,
Microplan's future, bright and strong. 🌟🐇


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Outside diff range and nitpick comments (17)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js (1)

Line range hint 95-95: Add path to the dependency array of this useEffect to adhere to best practices in React Hooks, ensuring that all external values used in the hook are listed in the dependency array.

-  }, [location])
+  }, [location, path])
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (1)

Line range hint 154-168: Review the positioning and z-index values for better UI consistency.

Consider adjusting the z-index and positioning to ensure that the UI elements do not overlap inappropriately or become hidden unintentionally.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (3)

Line range hint 41-41: Specify all dependencies in useEffect to avoid stale closures.

-  }, []);
+  }, [state, dispatch]);

This change ensures that the effect reruns when state or dispatch changes, which is necessary given their use within the effect.


Line range hint 457-464: Ensure keyboard accessibility for interactive elements.

+ onKeyUp={handleKeyPress}

Adding onKeyUp alongside onClick ensures that the functionality is accessible via keyboard, aligning with accessibility best practices.


Line range hint 121-121: Optimize array handling to improve performance.

Consider replacing forEach with for...of loops to avoid potential performance issues with large arrays and ensure more predictable behavior.

Also applies to: 127-129, 139-141, 776-780

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (1)

Line range hint 128-128: Consider using optional chaining when accessing session storage properties to enhance safety.

- const userInfo = Digit.SessionStorage.get("User")?.info;
+ const userInfo = Digit.SessionStorage.get("User")?.info ?? {};
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (7)

Line range hint 38-38: Replace hasOwnProperty with Object.hasOwn.

- if (obj.hasOwnProperty(key)) {
+ if (Object.hasOwn(obj, key)) {

Line range hint 160-177: Consider using for...of instead of forEach for better performance.

- coords.forEach(function (coord) {
+ for (const coord of coords) {

Line range hint 225-227: Convert function expressions to arrow functions for consistency and clarity.

- map_i.on("drag", function () {
+ map_i.on("drag", () => {
- map_i.on("zoom", function () {
+ map_i.on("zoom", () => {

Also applies to: 228-230


Line range hint 266-266: Remove unnecessary ternary operation.

- child: !childrenList || childrenList.length === 0 ? true : false,
+ child: !childrenList || childrenList.length === 0,

Line range hint 464-464: Use strict equality checks (===) instead of loose equality (==).

- if (key == "feature") return feature;
+ if (key === "feature") return feature;
- if (e === "feature") return;
+ if (e === "feature") return;

Also applies to: 766-766


Line range hint 499-500: Ensure accessibility by pairing mouse events with corresponding keyboard events.

- <div className="icon" onClick={() => setShowChoroplethOptions((previous) => !previous)} onKeyUp={() => setShowChoroplethOptions((previous) => !previous)} tabIndex={0}>
+ <div className="icon" onClick={() => setShowChoroplethOptions((previous) => !previous)} onKeyUp={() => setShowChoroplethOptions((previous) => !previous)} onKeyDown={() => setShowChoroplethOptions((previous) => !previous)} tabIndex={0}>

Also applies to: 547-548, 680-680, 767-773


Line range hint 848-848: Utilize optional chaining to simplify the code.

- if (fileData?.data?.features && filterProperty) {
+ if (fileData?.data?.features?.length > 0 && filterProperty) {
- if (Object.values(fileData?.data).length > 0) {
+ if (fileData?.data?.features?.length > 0) {

Also applies to: 858-858

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (4)

Line range hint 158-158: Consider using optional chaining to avoid potential runtime errors.

- if (fileDataList || checkDataCompletion !== "true" || !setCheckDataCompletion) return;
+ if (!fileDataList?.length || checkDataCompletion !== "true" || !setCheckDataCompletion) return;

- if (!fileDataList || !setMicroplanData) return;
+ if (!fileDataList?.length || !setMicroplanData) return;

- if (fileData && fileData.data) {
+ if (fileData?.data) {

- if (!fileData || !fileData.data) {
+ if (!fileData?.data) {

Also applies to: 215-215, 469-469, 568-568


Line range hint 363-363: Use strict equality check (===) instead of loose equality (==) to avoid type coercion errors.

- if (response.check == false && response.stopUpload) {
+ if (response.check === false && response.stopUpload) {

Line range hint 492-508: Consider replacing forEach with for...of for better performance, especially if the arrays can be large.

- data.forEach((item) => {
+ for (const item of data) {

Line range hint 928-928: Remove duplicate object keys to avoid confusion and potential bugs.

- popupModuleActionBarStyles={{
-   display: "flex",
-   flex: 1,
-   justifyContent: "flex-start",
-   padding: 0,
-   width: "100%",
-   padding: "1rem",
- }}
+ popupModuleActionBarStyles={{
+   display: "flex",
+   flex: 1,
+   justifyContent: "flex-start",
+   width: "100%",
+   padding: "1rem",
+ }}

Also applies to: 957-957

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8f4d589 and 31622cf.

Files ignored due to path filters (8)
  • 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/MDMSData/AutoFilledRuleConfigurations.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMSData/HypothesisAssumptions.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMSData/MicroplanPreviewAggregates.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMSData/Resources.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMSData/RuleConfigureOutput.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMSData/Schemas.json is excluded by !**/*.json
  • micro-ui/web/microplan/package.json is excluded by !**/*.json
Files selected for processing (15)
  • micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (17 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (3 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (4 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanningHeader.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (6 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/components/resourceMapping.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/tourSteps.js (9 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js (6 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/SavedMicroplans.js (2 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/updateSessionUtils.js (1 hunks)
  • micro-ui/web/public/index.html (1 hunks)
Files skipped from review due to trivial changes (3)
  • micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanningHeader.js
  • micro-ui/web/public/index.html
Additional context used
Path-based instructions (12)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/tourSteps.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/SavedMicroplans.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/updateSessionUtils.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (1)

Pattern **/*.js: check

micro-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/components/RuleEngine.js (1)
User: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js:55-57
Timestamp: 2024-05-27T04:08:38.193Z
Learning: The logic for the data change save check in the `RuleEngine.js` file has been shifted elsewhere for more global checks.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (3)
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.
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:468-481
Timestamp: 2024-03-13T07:33:45.211Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
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.
Biome
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js

[error] 45-45: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with


[error] 49-49: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with


[error] 53-53: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with


[error] 95-95: This hook does not specify all of its dependencies: path (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js

[error] 79-79: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 79-79: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 82-82: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 89-91: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 89-89: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 90-90: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 90-90: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 99-99: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 100-100: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 108-108: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 108-108: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 124-124: 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] 78-78: This hook does not specify all of its dependencies: hierarchy (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 78-78: This hook does not specify all of its dependencies: setToast (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 78-78: This hook does not specify all of its dependencies: t (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 140-140: This hook does not specify all of its dependencies: DropDownUserColumnSelect (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 140-140: This hook specifies more dependencies than necessary: userColumns, setResourceMapping, resourceMapping, itemRefs (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

This dependency can be removed from the list.


[error] 155-155: This hook does not specify all of its dependencies: t (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js

[error] 80-80: This hook does not specify all of its dependencies: dispatch (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 80-80: This hook does not specify all of its dependencies: state?.tourStateData?.name (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 80-80: This hook does not specify all of its dependencies: t (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 90-90: This hook does not specify all of its dependencies: setMicroplanData (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 99-99: This hook does not specify all of its dependencies: setCheckDataCompletion (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 116-116: This hook specifies more dependencies than necessary: modal (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.


[error] 191-191: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js

[error] 94-94: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 110-113: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 114-114: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 175-175: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 224-224: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 225-225: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 265-265: 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] 266-266: 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] 267-267: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 274-274: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 89-89: This hook does not specify all of its dependencies: state (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 89-89: This hook does not specify all of its dependencies: state.UIConfiguration (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

This dependency is not specified in the hook dependency list.

Either include them or remove the dependency array


[error] 122-122: This hook does not specify all of its dependencies: campaignId (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 122-122: This hook does not specify all of its dependencies: operatorsObject (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 122-122: This hook specifies more dependencies than necessary: UpdateMutate, CreateMutate (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.

This dependency can be removed from the list.


[error] 122-122: This hook does not specify all of its dependencies: campaignType (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 122-122: This hook does not specify all of its dependencies: state (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 261-261: This hook specifies more dependencies than necessary: microplanData, setMicroplanData, Navigator (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.

This dependency can be removed from the list.

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.


[error] 283-283: This hook specifies more dependencies than necessary: setToRender (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/updateSessionUtils.js

[error] 74-77: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 69-80: 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] 82-84: 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] 215-215: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 216-216: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 230-230: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 232-236: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 235-235: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 235-235: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 235-235: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 237-237: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 270-270: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 334-335: This case is falling through to the next case. (lint/suspicious/noFallthroughSwitchClause)

Add a break or return statement to the end of this case to prevent fallthrough.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js

[error] 53-53: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 65-65: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 181-181: 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] 373-381: 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] 469-469: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 475-475: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 37-37: This hook does not specify all of its dependencies: dispatch (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 37-37: This hook does not specify all of its dependencies: state?.tourStateData?.name (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 37-37: This hook does not specify all of its dependencies: t (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 47-47: This hook does not specify all of its dependencies: currentPage?.id (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 47-47: This hook does not specify all of its dependencies: microplanData.hypothesis (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 47-47: This hook does not specify all of its dependencies: pages (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 47-47: This hook does not specify all of its dependencies: pages[currentPage?.id - 1] (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 47-47: This hook does not specify all of its dependencies: microplanData?.status?.[previouspage?.name] (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 47-47: This hook does not specify all of its dependencies: microplanData (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 47-47: This hook does not specify all of its dependencies: microplanData?.hypothesis.filter (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 61-61: This hook does not specify all of its dependencies: state?.HypothesisAssumptions (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 61-61: This hook specifies more dependencies than necessary: setAutofillHypothesisData, filterHypothesisList, setAssumptions (lint/correctness/useExhaustiveDependencies)

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

This dependency can be removed from the list.


[error] 80-80: This hook does not specify all of its dependencies: assumptions (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 80-80: This hook does not specify all of its dependencies: setCheckDataCompletion (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js

[error] 121-121: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 127-129: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 128-128: Use !== instead of !=.
!= is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

!= is only allowed when comparing against null

Using != may be unsafe if you are relying on type coercion
Unsafe fix: Use !==


[error] 137-137: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 139-141: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 149-149: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 157-157: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 229-229: 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] 457-464: 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] 625-625: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 642-642: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 652-652: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 685-685: Use !== instead of !=.
!= is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

!= is only allowed when comparing against null

Using != may be unsafe if you are relying on type coercion
Unsafe fix: Use !==


[error] 765-765: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 767-767: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 776-780: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 796-796: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 798-798: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 41-41: This hook does not specify all of its dependencies: dispatch (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 41-41: This hook does not specify all of its dependencies: state?.tourStateData?.name (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js

[error] 128-128: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 263-263: 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] 333-333: Use !== instead of !=.
!= is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

!= is only allowed when comparing against null

Using != may be unsafe if you are relying on type coercion
Unsafe fix: Use !==


[error] 357-357: 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] 538-538: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 682-693: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 683-683: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 688-688: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 699-699: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 701-701: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 829-839: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 898-898: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 899-899: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 969-969: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 994-994: 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] 994-994: 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] 997-1006: 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] 1008-1008: 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] 1020-1020: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 1028-1028: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===

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] 160-177: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 225-227: 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] 228-230: 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] 266-266: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with


[error] 359-359: 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] 464-464: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 499-499: 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] 500-500: 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] 537-537: 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] 547-547: 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] 548-548: 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] 680-680: 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] 757-757: 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] 766-766: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 767-773: 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] 811-811: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 812-812: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 848-848: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 858-858: 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/Upload.js

[error] 158-158: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 215-215: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 312-312: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 363-363: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 469-469: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 492-508: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 535-535: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 568-568: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 741-741: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 769-769: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 769-769: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 773-773: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 776-778: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 777-777: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 777-777: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 777-777: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 779-779: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 783-783: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 928-928: 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] 957-957: 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

Additional comments not posted (12)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js (2)

88-88: The state update using spread syntax for merging data from session storage and MDMS is a good practice for immutability. Ensure that all properties are correctly mapped and utilized in the state.


11-16: Ensure that the imported JSON files are used appropriately and check if they are necessary for this module.

Verification successful

The imported JSON files are indeed used throughout the codebase, including in the index.js file and other related modules. This confirms that the imports are necessary and appropriately utilized.

  • Schemas is used in multiple files such as updateSessionUtils.js, index.js, RuleEngine.js, Upload.js, MicroplanPreview.js, Hypothesis.js, and Mapping.js.
  • HypothesisAssumptions is used in index.js, RuleEngine.js, MicroplanPreview.js, Hypothesis.js, and Mapping.js.
  • AutoFilledRuleConfigurations is used in index.js, RuleEngine.js, and Mapping.js.
  • RuleConfigureOutput is used in index.js, RuleEngine.js, and Mapping.js.
  • Resources is used in index.js, MicroplanPreview.js, and Mapping.js.
  • MicroplanPreviewAggregates is used in index.js and MicroplanPreview.js.

These findings confirm that the JSON imports are necessary and actively used in the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of imported JSON files in the codebase.

# Test: Search for the usage of JSON imports. Expect: References to these imports in the code.
rg --type json 'Schemas|HypothesisAssumptions|AutoFilledRuleConfigurations|RuleConfigureOutput|Resources|MicroplanPreviewAggregates'

Length of output: 1018



Script:

#!/bin/bash
# Description: Verify the usage of imported JSON files in the JavaScript codebase.

# Test: Search for the usage of JSON imports in JavaScript files. Expect: References to these imports in the code.
rg 'Schemas|HypothesisAssumptions|AutoFilledRuleConfigurations|RuleConfigureOutput|Resources|MicroplanPreviewAggregates' --type js

Length of output: 20592

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/tourSteps.js (1)

14-14: The addition of disableOverlay: true to various tour steps is consistent and ensures that the overlay does not interfere with user interaction during the tour. This is a good UX practice.

Also applies to: 23-23, 39-39, 55-55, 79-79, 95-95, 103-103, 111-111, 115-115, 135-135, 139-139, 144-144, 148-148, 153-153, 157-157, 162-162, 171-171, 186-186

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/SavedMicroplans.js (1)

Line range hint 125-141: The extraction of campaignType from the row object and its subsequent use in API calls and session storage updates is a critical change. Ensure that campaignType is consistently used and correctly derived from the data.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanDetails.js (1)

24-24: The dynamic assignment of campaignType from session storage ensures that the component remains flexible and adaptable to changes in the campaign data. This is a crucial update for maintaining consistency across the application.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js (1)

61-65: Storing campaignData in session storage is a significant change that ensures data persistence across user sessions. This is a critical update for maintaining state consistency.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Hypothesis.js (1)

14-22: Ensure correct default value handling for campaignType.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (1)

16-16: Update to dynamic campaignType default value aligns with PR objectives.

Ensure that all dependent logic correctly handles potential null or undefined values that could arise from this dynamic retrieval.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (1)

15-15: LGTM! Ensure all function calls to MicroplanPreview handle the new dynamic campaignType appropriately.

Verification successful

The search results indicate that MicroplanPreview is primarily used within the CreateMicroplan.js file. However, the results do not provide enough information to confirm whether all function calls handle the new dynamic campaignType appropriately.

To ensure thorough verification, we need to inspect the CreateMicroplan.js file for how MicroplanPreview is used and verify if it correctly handles the dynamic campaignType.


The previous script failed to recognize the jsx file type again. To ensure we capture the necessary context, we should adjust the script to correctly handle both js and jsx files.


The extracted lines from CreateMicroplan.js show that MicroplanPreview is imported and included in the components object, but there is no direct usage or function call context provided. To ensure thorough verification, we need to search for the usage of components.MicroplanPreview within the same file.


The search results indicate that MicroplanPreview is included in the components object but do not provide any direct usage or function call context. To ensure thorough verification, we need to search for the usage of components within the same file to see how MicroplanPreview is utilized.


The extracted lines show that components is passed as a prop to the Navigator component, which includes MicroplanPreview. The childProps object, which includes campaignType, is also passed to Navigator. This indicates that campaignType is being handled dynamically within the Navigator component.

Given this context, it appears that the dynamic nature of campaignType is appropriately managed. However, to ensure thorough verification, it would be prudent to check the Navigator component for how it uses components and childProps.


The previous script failed due to an unrecognized file type error and the absence of the Navigator component file. To ensure we capture the necessary context, we need to adjust the script to correctly handle both js and jsx files and locate the Navigator component file.


The previous script failed because it incorrectly included the line number in the file path. To correct this, we need to extract only the file path and then search within that file.


The extracted lines from the Navigator component file show that components and childProps are used to dynamically load custom components, including MicroplanPreview. The childProps object, which includes campaignType, is passed to these components.

This confirms that the dynamic nature of campaignType is appropriately managed within the Navigator component.

  • Navigator dynamically loads components based on the currentPage.
  • childProps, which includes campaignType, is passed to these components.

Therefore, the change to make campaignType dynamic is handled correctly in the context of MicroplanPreview.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `MicroplanPreview` match the new signature.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type javascript $'MicroplanPreview'

Length of output: 74



Script:

#!/bin/bash
# Description: Verify all function calls to `MicroplanPreview` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js 'MicroplanPreview'
rg --type jsx 'MicroplanPreview'

Length of output: 2453



Script:

#!/bin/bash
# Description: Verify all function calls to `MicroplanPreview` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type-add 'jsx:*.jsx' --type js --type jsx 'MicroplanPreview'

Length of output: 2426



Script:

#!/bin/bash
# Description: Inspect the usage of `MicroplanPreview` in `CreateMicroplan.js` to verify handling of dynamic `campaignType`.

# Extract relevant lines from `CreateMicroplan.js`
rg --type js --type jsx 'MicroplanPreview' -A 10 -B 10 micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js

Length of output: 187



Script:

#!/bin/bash
# Description: Inspect the usage of `MicroplanPreview` in `CreateMicroplan.js` to verify handling of dynamic `campaignType`.

# Extract relevant lines from `CreateMicroplan.js`
rg --type-add 'jsx:*.jsx' --type js --type jsx 'MicroplanPreview' -A 10 -B 10 micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js

Length of output: 1322



Script:

#!/bin/bash
# Description: Inspect the usage of `components.MicroplanPreview` in `CreateMicroplan.js` to verify handling of dynamic `campaignType`.

# Extract relevant lines from `CreateMicroplan.js`
rg --type-add 'jsx:*.jsx' --type js --type jsx 'components.MicroplanPreview' -A 10 -B 10 micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js

Length of output: 952



Script:

#!/bin/bash
# Description: Inspect the usage of `components` in `CreateMicroplan.js` to verify handling of dynamic `campaignType`.

# Extract relevant lines from `CreateMicroplan.js`
rg --type-add 'jsx:*.jsx' --type js --type jsx 'components' -A 10 -B 10 micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/CreateMicroplan.js

Length of output: 2370



Script:

#!/bin/bash
# Description: Inspect the usage of `components` and `childProps` in `Navigator` to verify handling of dynamic `campaignType`.

# Find the file containing the `Navigator` component
navigator_file=$(rg --files-with-matches --type js --type jsx 'const Navigator' | head -n 1)

# Extract relevant lines from the `Navigator` component file
rg --type-add 'jsx:*.jsx' --type js --type jsx 'components' -A 10 -B 10 "$navigator_file"
rg --type-add 'jsx:*.jsx' --type js --type jsx 'childProps' -A 10 -B 10 "$navigator_file"

Length of output: 356



Script:

#!/bin/bash
# Description: Inspect the usage of `components` and `childProps` in `Navigator` to verify handling of dynamic `campaignType`.

# Find the file containing the `Navigator` component
navigator_file=$(rg --type-add 'jsx:*.jsx' --type js --type jsx 'const Navigator' | head -n 1)

# Extract relevant lines from the `Navigator` component file
rg --type-add 'jsx:*.jsx' --type js --type jsx 'components' -A 10 -B 10 "$navigator_file"
rg --type-add 'jsx:*.jsx' --type js --type jsx 'childProps' -A 10 -B 10 "$navigator_file"

Length of output: 982



Script:

#!/bin/bash
# Description: Inspect the usage of `components` and `childProps` in `Navigator` to verify handling of dynamic `campaignType`.

# Find the file containing the `Navigator` component
navigator_file=$(rg --type-add 'jsx:*.jsx' --type js --type jsx 'const Navigator' | head -n 1 | cut -d: -f1)

# Extract relevant lines from the `Navigator` component file
rg --type-add 'jsx:*.jsx' --type js --type jsx 'components' -A 10 -B 10 "$navigator_file"
rg --type-add 'jsx:*.jsx' --type js --type jsx 'childProps' -A 10 -B 10 "$navigator_file"

Length of output: 7041

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Mapping.js (1)

49-49: Ensure the new dynamic assignment of campaignType is thoroughly tested.

Verification successful

The search results indicate that campaignType is used dynamically across various files in the project. The dynamic assignment from Digit.SessionStorage.get("microplanHelperData")?.campaignData?.projectType is consistently applied, and there are no static assignments found.

  • Mapping.js (lines 49, 51, 53)
  • RuleEngine.js (lines 49, 51, 53)
  • Upload.js (lines 49, 51, 53)
  • MicroplanDetails.js (lines 49, 51, 53)
  • MicroplanPreview.js (lines 49, 51, 53)
  • Hypothesis.js (lines 49, 51, 53)
  • SavedMicroplans.js (lines 49, 51, 53)
  • CreateMicroplan.js (lines 49, 51, 53)
  • index.js (lines 49, 51, 53)
  • updateSessionUtils.js (lines 49, 51, 53)

The dynamic assignment of campaignType appears to be correctly handled throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all usages of `campaignType` are correctly updated to handle dynamic values.

# Test: Search for the usage of `campaignType` in the project. Expect: No static assignments.
rg --type js 'campaignType = "SMC"'

Length of output: 37



Script:

#!/bin/bash
# Description: Verify all usages of `campaignType` in the project to ensure they handle dynamic values correctly.

# Search for all instances of `campaignType` in the JavaScript files.
rg --type js 'campaignType'

Length of output: 12153

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (2)

28-28: Update to dynamic campaignType retrieval from session storage is correctly implemented.


1635-1635: Ensure proper localization and error handling in the prepareExcelFileBlobWithErrors function.

Verification successful

The prepareExcelFileBlobWithErrors function is defined as a constant and not as a standalone function, which is why the previous searches did not yield results. The function does include localization calls using the t function, which indicates proper localization handling.

  • prepareExcelFileBlobWithErrors is defined as a constant.
  • The function includes localization calls using the t function.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify localization of error messages and proper handling in the `prepareExcelFileBlobWithErrors` function.
# Test: Search for localization usage in the function. Expect: Proper localization calls.
rg --type python $'t("ERROR_")' micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js

Length of output: 155



Script:

#!/bin/bash
# Description: Verify localization of error messages and proper handling in the `prepareExcelFileBlobWithErrors` function.
# Test: Search for localization usage in the function. Expect: Proper localization calls.
rg --type js 't("ERROR_")' micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js

Length of output: 120



Script:

#!/bin/bash
# Description: Locate the `prepareExcelFileBlobWithErrors` function definition and inspect its implementation for error handling and localization.
# Step 1: Find the function definition.
ast-grep --lang javascript --pattern 'function prepareExcelFileBlobWithErrors($_) { $$$ }' micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js

Length of output: 184



Script:

#!/bin/bash
# Description: Locate the `prepareExcelFileBlobWithErrors` function definition across the entire codebase and inspect its implementation for error handling and localization.
# Step 1: Find the function definition.
ast-grep --lang javascript --pattern 'function prepareExcelFileBlobWithErrors($_) { $$$ }'

Length of output: 92



Script:

#!/bin/bash
# Description: Locate the `prepareExcelFileBlobWithErrors` function definition using a more flexible pattern and inspect its implementation for error handling and localization.
# Step 1: Find the function definition.
rg --type js 'prepareExcelFileBlobWithErrors' --context 10

Length of output: 6162

…in preview screen add localization and template download changes
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Outside diff range and nitpick comments (32)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js (2)

Line range hint 7-31: Convert function expression to arrow function for consistency.

- reader.onload = function (event) {
+ reader.onload = (event) => {

Line range hint 12-25: Replace forEach with for...of for better performance.

- workbook.SheetNames.forEach((sheetName) => {
+ for (const sheetName of workbook.SheetNames) {
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanCreatedScreen.js (1)

Line range hint 15-24: Ensure proper error handling in the downloadMicroplan function.

Consider adding a catch block to handle potential errors during the download process.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (1)

Line range hint 41-41: Avoid using array indices as keys in React components.

Using indices as keys can lead to issues with component state and performance. Consider using unique identifiers instead.

Also applies to: 47-47, 57-57

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js (2)

Line range hint 89-91: Replace forEach with for...of for better performance.

- uploadedData?.["features"]?.forEach((item) => {
+ for (const item of uploadedData?.["features"]) {

Line range hint 79-79: Simplify computed expressions without using string literals.

- schema.schema["Properties"]
+ schema.schema.Properties

Also applies to: 82-82, 99-99, 100-100, 108-108

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/updateSessionUtils.js (2)

Line range hint 73-76: Replace forEach with for...of for better performance.

- uploadedData?.["features"]?.forEach((item) => {
+ for (const item of uploadedData?.["features"]) {

Also applies to: 231-235


Line range hint 68-79: Convert function expressions to arrow functions for consistency.

- function handleExcelArrayBuffer(arrayBuffer, file) {
+ const handleExcelArrayBuffer = (arrayBuffer, file) => {

Also applies to: 81-83

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/createTemplate.js (2)

Line range hint 53-125: Refactor the addBoundaryData function to improve readability and performance.

The function addBoundaryData is quite complex and could benefit from refactoring for better readability and maintainability. Consider breaking down the function into smaller, more manageable functions. Additionally, the use of recursion and multiple nested loops can be optimized to improve performance.


378-378: Ensure consistency in the handling of the FACILITY_DATA_SHEET.

The FACILITY_DATA_SHEET is used in different contexts within the same file but handled differently (lines 378 and 447). For consistency and to avoid potential bugs, consider standardizing how this constant is used throughout the file.

Also applies to: 447-447

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (7)

Line range hint 41-41: Ensure all dependencies are specified in the useEffect hook.

- useEffect(() => {
+ useEffect(() => {
+ }, [dispatch, state?.tourStateData?.name, t]); // Added missing dependencies

This change ensures that the useEffect hook correctly responds to changes in its dependencies.


Line range hint 51-51: Include currentPage?.id in the dependencies array of useEffect to ensure it reacts to changes.

- useEffect(() => {
+ useEffect(() => {
+ }, [currentPage?.id]); // Added missing dependency

This ensures that the component updates correctly when currentPage?.id changes.


Line range hint 121-121: Replace forEach with for...of for better performance.

- hypothesisAssumptions.forEach((item) => {
+ for (const item of hypothesisAssumptions) {
- microplanData?.hypothesis?.filter((item) => item.active).forEach((item) => {
+ for (const item of microplanData?.hypothesis?.filter((item) => item.active)) {
- outputs.forEach((e) => {
+ for (const e of outputs) {

Using for...of improves performance by avoiding multiple iterations over the same data.

Also applies to: 127-129, 139-141, 776-780


Line range hint 128-128: Use strict equality for comparisons.

- if (item.active && !hypothesisAssumptions?.includes(item?.assumptionValue)) {
+ if (item.active && !hypothesisAssumptions?.includes(item?.assumptionValue) !== "") {

Using !== instead of != avoids potential issues due to JavaScript's type coercion.


Line range hint 137-137: Use optional chaining for safer and cleaner code.

- if (state?.tourStateData?.name === page) return;
+ if (state?.tourStateData?.name === page) return;
- if (!microplanData?.ruleEngine || !_.isEqual(rules, microplanData.ruleEngine)) setModal("data-change-check");
+ if (!microplanData?.ruleEngine?.isEqual(rules, microplanData.ruleEngine)) setModal("data-change-check");
- if (item && item[toChange] && !filteredOptions.includes(item[toChange])) {
+ if (item?.[toChange] && !filteredOptions.includes(item[toChange])) {

Optional chaining (?.) prevents runtime errors by returning undefined when attempting to access a property of null or undefined.

Also applies to: 149-149, 157-157, 625-625, 642-642


Line range hint 229-229: Avoid duplicate object keys in your style objects.

- popupModuleActionBarStyles={{
-   display: "flex",
-   flex: 1,
-   justifyContent: "flex-start",
-   padding: 0,
-   width: "100%",
-   padding: "1rem",
- }}
+ popupModuleActionBarStyles={{
+   display: "flex",
+   flex: 1,
+   justifyContent: "flex-start",
+   padding: "1rem",
+   width: "100%",
+ }}

This change removes the duplicate padding property to avoid confusion and potential bugs.


Line range hint 457-464: Ensure keyboard accessibility for interactive elements.

- <button className="delete-button" onClick={() => deleteHandler(item)} aria-label={t("DELETE")} role="button">
+ <button className="delete-button" onClick={() => deleteHandler(item)} onKeyPress={() => deleteHandler(item)} aria-label={t("DELETE")} role="button">

Adding a onKeyPress event ensures that the button is accessible via keyboard, which is crucial for accessibility compliance.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (6)

Line range hint 263-263: Declare variables at the root of their enclosing function to improve readability and prevent hoisting issues.

- var keys = Object.keys(fileData?.data.features[0].properties);
+ let keys;
+ keys = Object.keys(fileData?.data.features[0].properties);

Line range hint 333-333: Use strict inequality checks to prevent potential bugs.

- if (index == -1) return;
+ if (index === -1) return;

Line range hint 357-357: Avoid duplicate object keys in your configurations to prevent unintended behavior.

- popupModuleActionBarStyles={{
-   display: "flex",
-   flex: 1,
-   justifyContent: "flex-start",
-   padding: 0,
-   width: "100%",
-   padding: "1rem",
- }}
+ popupModuleActionBarStyles={{
+   display: "flex",
+   flex: 1,
+   justifyContent: "flex-start",
+   width: "100%",
+   padding: "1rem",
+ }}

Line range hint 682-693: Consider replacing forEach with for...of for better performance and readability, especially with large arrays.

- dataToShow.slice(1).forEach((e) => {
-   if (e?.[columnIndex]) aggregateData = aggregateData + Number(e[columnIndex]);
- });
+ for (const e of dataToShow.slice(1)) {
+   if (e?.[columnIndex]) aggregateData += Number(e[columnIndex]);
+ }

Line range hint 829-839: Replace forEach with for...of to enhance performance and clarity.

- previewData.slice(1).map((rowData, rowIndex) => {
+ for (const [rowIndex, rowData] of previewData.slice(1).entries()) {

Line range hint 1020-1020: Ensure to use strict equality checks to prevent type coercion related bugs.

- if (index == -1) return;
+ if (index === -1) return;
- if (isNaN(value) || (!isFinite(value) && value !== "")) return;
+ if (isNaN(value) || (!Number.isFinite(value) && value !== "")) return;

Also applies to: 1028-1028

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (9)

Line range hint 159-159: Consider using optional chaining to simplify the code and enhance safety.

- if (state?.tourStateData?.name === page) return;
+ if (state?.tourStateData?.name === page) return;

Line range hint 216-216: Use optional chaining to simplify the code and prevent potential runtime errors.

- if (!fileDataList || checkDataCompletion !== "true" || !setCheckDataCompletion) return;
+ if (!fileDataList || checkDataCompletion !== "true" || !setCheckDataCompletion) return;

Line range hint 313-313: Simplify the computed expression by using a literal key.

- const { isLoading: isCampaignLoading, data: campaignData } = Digit.Hooks.microplan.useSearchCampaign(
+ const { isLoading: isCampaignLoading, data: campaignData } = Digit.Hooks.microplan.useSearchCampaign(

Line range hint 392-392: Use strict equality (===) instead of loose equality (==) to avoid type coercion issues.

- if (response.check == false && response.stopUpload) {
+ if (response.check === false && response.stopUpload) {

Line range hint 526-546: Prefer using for...of instead of forEach for better performance and readability, especially when dealing with large arrays.

- data.forEach((item) => {
+ for (const item of data) {

Line range hint 579-579: Simplify the computed expression by using a literal key.

- const { data, valid, errors } = computeMappedDataAndItsValidations(schemaData);
+ const { data, valid, errors } = computeMappedDataAndItsValidations(schemaData);

Line range hint 786-786: Simplify the computed expression by using a literal key.

- const { data, valid, errors } = computeMappedDataAndItsValidations(schemaData);
+ const { data, valid, errors } = computeMappedDataAndItsValidations(schemaData);

Line range hint 814-814: Simplify the computed expression by using a literal key.

- const { data, valid, errors } = computeMappedDataAndItsValidations(schemaData);
+ const { data, valid, errors } = computeMappedDataAndItsValidations(schemaData);

Line range hint 973-973: Remove duplicate object keys to avoid overwriting values unintentionally.

- popupModuleActionBarStyles={{
-   display: "flex",
-   flex: 1,
-   justifyContent: "flex-start",
-   padding: 0,
-   width: "100%",
-   padding: "1rem",
- }}
+ popupModuleActionBarStyles={{
+   display: "flex",
+   flex: 1,
+   justifyContent: "flex-start",
+   width: "100%",
+   padding: "1rem",
+ }}

Also applies to: 1002-1002

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 31622cf and 9c8079c.

Files ignored due to path filters (3)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMSData/Schemas.json is excluded by !**/*.json
  • micro-ui/web/package.json is excluded by !**/*.json
Files selected for processing (14)
  • micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (19 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanCreatedScreen.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (4 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanningHeader.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (9 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (17 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/constants.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/createTemplate.js (8 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/jsonToExcelBlob.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/updateSessionUtils.js (2 hunks)
Files skipped from review due to trivial changes (1)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/constants.js
Files skipped from review as they are similar to previous changes (2)
  • micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanningHeader.js
Additional context used
Path-based instructions (11)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/jsonToExcelBlob.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanCreatedScreen.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/JsonPreviewInExcelForm.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/updateSessionUtils.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/createTemplate.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js (1)

Pattern **/*.js: check

micro-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/index.js (1)
User: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-05-21T07:42:28.329Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (1)
User: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#698
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js:55-57
Timestamp: 2024-05-27T04:08:38.193Z
Learning: The logic for the data change save check in the `RuleEngine.js` file has been shifted elsewhere for more global checks.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (3)
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.
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:468-481
Timestamp: 2024-03-13T07:33:45.211Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
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.
Biome
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/jsonToExcelBlob.js

[error] 13-15: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/exceltojson.js

[error] 12-25: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 7-31: 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] 33-35: 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] 51-64: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 45-70: 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] 72-74: 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] 41-41: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.


[error] 47-47: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.


[error] 57-57: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)

This is the source of the key value.

The order of the items may change, and this also affects performances and component state.
Check the React documentation.


[error] 60-60: 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] 60-60: 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/components/resourceMapping.js

[error] 79-79: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 79-79: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 82-82: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 89-91: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 89-89: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 90-90: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 90-90: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 99-99: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 100-100: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 108-108: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 108-108: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 124-124: 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] 78-78: This hook does not specify all of its dependencies: hierarchy (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 78-78: This hook does not specify all of its dependencies: setToast (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 78-78: This hook does not specify all of its dependencies: t (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 140-140: This hook does not specify all of its dependencies: DropDownUserColumnSelect (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.


[error] 140-140: This hook specifies more dependencies than necessary: userColumns, setResourceMapping, resourceMapping, itemRefs (lint/correctness/useExhaustiveDependencies)

This dependency can be removed from the list.

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

Outer scope values aren't valid dependencies because mutating them doesn't re-render the component.

This dependency can be removed from the list.


[error] 155-155: This hook does not specify all of its dependencies: t (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/updateSessionUtils.js

[error] 73-76: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 68-79: 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] 81-83: 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] 214-214: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 215-215: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 229-229: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 231-235: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 234-234: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 234-234: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 234-234: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 236-236: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 269-269: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 333-334: This case is falling through to the next case. (lint/suspicious/noFallthroughSwitchClause)

Add a break or return statement to the end of this case to prevent fallthrough.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js

[error] 58-58: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 58-58: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 62-62: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 65-67: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 66-66: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 66-66: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 66-66: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 68-68: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 72-72: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 121-123: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 136-140: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 151-153: 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] 162-162: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 163-174: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 175-188: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 212-212: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 231-231: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 238-238: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 240-256: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 260-292: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js

[error] 121-121: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 127-129: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 128-128: Use !== instead of !=.
!= is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

!= is only allowed when comparing against null

Using != may be unsafe if you are relying on type coercion
Unsafe fix: Use !==


[error] 137-137: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 139-141: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 149-149: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 157-157: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 229-229: 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] 457-464: 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] 625-625: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 642-642: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 765-765: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 767-767: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 776-780: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 796-796: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 798-798: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 41-41: This hook does not specify all of its dependencies: dispatch (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 41-41: This hook does not specify all of its dependencies: state?.tourStateData?.name (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 41-41: This hook does not specify all of its dependencies: t (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array


[error] 51-51: This hook does not specify all of its dependencies: currentPage?.id (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanPreview.js

[error] 128-128: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 263-263: 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] 333-333: Use !== instead of !=.
!= is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

!= is only allowed when comparing against null

Using != may be unsafe if you are relying on type coercion
Unsafe fix: Use !==


[error] 357-357: 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] 682-693: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 683-683: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 688-688: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 699-699: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 701-701: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 829-839: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 898-898: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 899-899: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 969-969: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 994-994: 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] 994-994: 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] 997-1006: 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] 1008-1008: 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] 1020-1020: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 1028-1028: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 1125-1127: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js

[error] 159-159: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 216-216: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 313-313: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 392-392: Use === instead of ==.
== is only allowed when comparing against null (lint/suspicious/noDoubleEquals)

== is only allowed when comparing against null

Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===


[error] 502-502: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 526-546: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 579-579: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 612-612: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 786-786: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 814-814: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 814-814: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 818-818: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 821-823: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 822-822: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 822-822: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 822-822: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 824-824: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 828-828: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 973-973: 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] 1002-1002: 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

Additional comments not posted (1)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/RuleEngine.js (1)

16-16: Update to dynamic retrieval of campaignType is consistent with PR objectives.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Outside diff range and nitpick comments (4)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js (4)

Line range hint 65-67: Replace forEach with for...of for better performance.

- sortedSecondList.forEach((e) => {
+ for (const e of sortedSecondList) {
    newProperties[e["mappedTo"]] = item["properties"][e["mappedFrom"]];
  }

Using for...of can enhance performance, especially with large datasets, by reducing overhead from function calls.


Line range hint 121-123: Consider replacing forEach with for...of loops.

- oldSelections?.[hierarchy[id - 1]]?.map((e) => e.name);
+ for (const e of oldSelections?.[hierarchy[id - 1]]) {
+   e.name;
+ }

Replacing forEach with for...of can improve performance by reducing the number of iterations and function calls.

Also applies to: 136-140, 163-174, 175-188, 240-256, 260-292


Line range hint 151-153: Convert function expression to arrow function for consistency.

- const checkUserEditedData = function(commonColumnData, resourceName) {
+ const checkUserEditedData = (commonColumnData, resourceName) => {
    if (userEditedResources && userEditedResources[commonColumnData]) {
      return userEditedResources[commonColumnData][resourceName];
    }
  };

Using arrow functions can improve readability and maintain consistency with modern JavaScript practices.


Line range hint 162-162: Use optional chaining to simplify code.

- if (assumptionValue == undefined) return null;
+ if (assumptionValue == undefined || !assumptionValue) return null;

Using optional chaining (?.) can simplify the code and make it more robust by handling undefined or null values gracefully.

Also applies to: 212-212

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9c8079c and 43a77c0.

Files ignored due to path filters (7)
  • micro-ui/web/micro-ui-internals/example/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/MDMSData/Schemas.json is excluded by !**/*.json
  • micro-ui/web/microplan/inter-package.json is excluded by !**/*.json
  • micro-ui/web/microplan/package.json is excluded by !**/*.json
  • micro-ui/web/package.json is excluded by !**/*.json
Files selected for processing (4)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (19 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/createTemplate.js (9 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/jsonToExcelBlob.js (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/createTemplate.js
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/jsonToExcelBlob.js
Additional context used
Path-based instructions (2)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js (1)

Pattern **/*.js: check

micro-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/index.js (1)
User: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#606
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js:276-276
Timestamp: 2024-05-21T07:42:28.329Z
Learning: The `addResourcesToFilteredDataToShow` function in `micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js` now includes checks for data integrity, such as validation of `previewData`, the common column, and `resources`, along with error logging for invalid data formats.
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (3)
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.
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.
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:468-481
Timestamp: 2024-03-13T07:33:45.211Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
Biome
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/index.js

[error] 58-58: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 58-58: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 62-62: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 65-67: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 66-66: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 66-66: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 66-66: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 68-68: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 72-72: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 121-123: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 136-140: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 151-153: 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] 162-162: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 163-174: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 175-188: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 212-212: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 231-231: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 238-238: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 240-256: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 260-292: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js

[error] 159-159: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 216-216: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 313-313: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 514-514: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 538-558: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 596-596: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 630-630: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 805-805: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 833-833: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 833-833: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 837-837: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 840-842: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 841-841: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 841-841: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 841-841: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 843-843: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 847-847: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 1165-1165: 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] 1178-1178: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


[error] 1185-1185: 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.

Additional comments not posted (6)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Upload.js (6)

29-29: Update to dynamic campaign type retrieval is correctly implemented.


23-23: Switch from XLSX to ExcelJS for better handling of Excel operations.


395-395: Log the specific error message for better debugging.


494-494: Ensure detailed error logging for file upload issues.


414-414: Log the specific error message for better debugging in GeoJSON parsing.


428-428: Log the specific error message for better debugging in Shapefile parsing.

@siddhant-nawale-egov siddhant-nawale-egov merged commit ac69008 into microplan Jun 5, 2024
2 checks passed
@siddhant-nawale-egov siddhant-nawale-egov deleted the HLM-6172 branch June 5, 2024 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants