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

Follow Up: Upgrade Eslint version to v9 #10180

Merged

Conversation

AdityaJ2305
Copy link
Contributor

@AdityaJ2305 AdityaJ2305 commented Jan 25, 2025

Proposed Changes

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • Tests

    • Enhanced Cypress command with improved element attachment validation
  • Chores

    • Updated TypeScript configuration to include additional directories
    • Removed unnecessary ESLint comments in configuration files
  • Refactor

    • Improved type safety for icon path tracking
    • Standardized import paths across multiple test files for clarity and maintainability
    • Minor configuration adjustments across various project files

@AdityaJ2305 AdityaJ2305 requested a review from a team as a code owner January 25, 2025 10:42
Copy link
Contributor

coderabbitai bot commented Jan 25, 2025

Walkthrough

This pull request introduces several modifications across different parts of the project. Changes include updating import paths to use absolute references instead of relative paths in multiple Cypress test files, enhancing the getAttached command with DOM attachment validation, adding a TypeScript parser configuration in ESLint, specifying a type annotation for a variable in a plugin, removing ESLint comments from various files, and expanding the TypeScript compiler's include property to encompass additional directories.

Changes

File Change Summary
cypress/e2e/login_spec/loginpage.cy.ts Updated import path for LoginPage class
cypress/e2e/facility_spec/facility_creation.cy.ts Updated import paths for FacilityCreation, generatePhoneNumber, and generateFacilityData
cypress/e2e/patient_spec/patient_creation.cy.ts Updated import paths for patientCreation, patientDashboard, patientVerify, and FacilityCreation
cypress/e2e/patient_spec/patient_encounter.cy.ts Updated import paths for PatientEncounter and FacilityCreation
cypress/e2e/users_spec/user_creation.cy.ts Updated import paths for UserCreation, FacilityCreation, and utility functions
cypress/support/commands.ts Added assertion to check if the first HTMLElement is attached in getAttached command
cypress/support/e2e.ts Updated import path for commands module
cypress/support/index.ts Updated import path for ErrorMessageItem
eslint.config.mjs Added TypeScript parser configuration for JavaScript and TypeScript files
plugins/treeShakeCareIcons.ts Added type annotation for treeshakenCareIconPaths variable
scripts/sort-locales.js Removed ESLint comment
tailwind.config.js Removed ESLint comment
tsconfig.json Expanded include property to cover additional TypeScript directories
cypress/tsconfig.json Added paths configuration for aliasing

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • rithviknishad
  • khavinshankar

Poem

🐰 A rabbit's tale of code so bright,
Testing login with all my might.
Validators dance, errors take flight,
TypeScript parsing, configuration tight.
Another pull request, coded just right! 🔍


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

netlify bot commented Jan 25, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit a8635ba
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6798c3ef24c610000760d728
😎 Deploy Preview https://deploy-preview-10180--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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: 2

🧹 Nitpick comments (2)
cypress/e2e/login_spec/loginpage.cy.ts (1)

Line range hint 10-12: Break down the test case into smaller, focused scenarios.

The current test chains multiple verifications into a single test case. This makes it harder to identify which specific verification failed. Consider breaking it down into separate test cases for better maintainability and clearer failure messages.

-  it("should validate login form elements and display validation errors", () => {
-    loginPage.verifyFormElements().clickSubmit().verifyValidationErrors();
-  });
+  it("should display all required form elements", () => {
+    loginPage.verifyFormElements();
+  });
+
+  it("should display validation errors when submitting empty form", () => {
+    loginPage.clickSubmit();
+    loginPage.verifyValidationErrors();
+  });
tsconfig.json (1)

27-27: Add spaces after commas for better readability.

The change to include additional TypeScript files is good, but the formatting could be improved.

-  "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "care.config.ts","scripts/**/*.ts","cypress.config.ts","plugins/**/*.ts"],
+  "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "care.config.ts", "scripts/**/*.ts", "cypress.config.ts", "plugins/**/*.ts"],
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 131111f and 9c07bb9.

📒 Files selected for processing (7)
  • cypress/e2e/login_spec/loginpage.cy.ts (1 hunks)
  • cypress/support/commands.ts (1 hunks)
  • eslint.config.mjs (1 hunks)
  • plugins/treeShakeCareIcons.ts (1 hunks)
  • scripts/sort-locales.js (0 hunks)
  • tailwind.config.js (0 hunks)
  • tsconfig.json (1 hunks)
💤 Files with no reviewable changes (2)
  • scripts/sort-locales.js
  • tailwind.config.js
🔇 Additional comments (4)
plugins/treeShakeCareIcons.ts (1)

64-64: LGTM! Type annotation improves type safety.

The addition of the type annotation { [key: string]: string } makes the object's structure explicit and helps catch potential type-related issues early.

eslint.config.mjs (1)

37-37: LGTM! Parser configuration aligns with ESLint v9 requirements.

The addition of the TypeScript parser configuration is correct and necessary for the ESLint upgrade.

cypress/support/commands.ts (1)

Line range hint 64-69: LGTM! DOM attachment check improves test reliability.

The addition of the DOM attachment check helps prevent flaky tests by ensuring elements are properly attached before interaction.

tsconfig.json (1)

27-27: Verify the existence of newly included directories.

Let's ensure that all the newly included directories exist and contain TypeScript files.

✅ Verification successful

All specified directories and files exist and are valid

  • scripts/ directory contains 3 TypeScript files
  • cypress.config.ts exists at root level
  • plugins/ directory contains 1 TypeScript file
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the newly included directories exist and contain TypeScript files

echo "Checking for TypeScript files in newly included paths..."

# Check scripts directory
echo "Checking scripts directory:"
fd -e ts . scripts/

# Check cypress config
echo -e "\nChecking cypress config:"
[ -f cypress.config.ts ] && echo "✓ cypress.config.ts exists" || echo "✗ cypress.config.ts not found"

# Check plugins directory
echo -e "\nChecking plugins directory:"
fd -e ts . plugins/

Length of output: 581

cypress/e2e/login_spec/loginpage.cy.ts Outdated Show resolved Hide resolved
cypress/support/commands.ts Show resolved Hide resolved
@AdityaJ2305 AdityaJ2305 requested a review from sainak January 28, 2025 08:54
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: 0

🧹 Nitpick comments (1)
cypress/tsconfig.json (1)

17-19: Consider scoping the path alias more precisely.

While the path alias configuration works, consider restricting it to specific subdirectories to prevent unintended access to files outside the test scope:

  "paths": {
-    "@/*": ["./*"],
+    "@/*": ["./support/*", "./pageObject/*", "./e2e/*"]
  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f6d7db and d7303a4.

📒 Files selected for processing (8)
  • cypress/e2e/facility_spec/facility_creation.cy.ts (1 hunks)
  • cypress/e2e/login_spec/loginpage.cy.ts (1 hunks)
  • cypress/e2e/patient_spec/patient_creation.cy.ts (1 hunks)
  • cypress/e2e/patient_spec/patient_encounter.cy.ts (1 hunks)
  • cypress/e2e/users_spec/user_creation.cy.ts (1 hunks)
  • cypress/support/e2e.ts (1 hunks)
  • cypress/support/index.ts (1 hunks)
  • cypress/tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • cypress/support/e2e.ts
  • cypress/support/index.ts
  • cypress/e2e/patient_spec/patient_encounter.cy.ts
  • cypress/e2e/patient_spec/patient_creation.cy.ts
  • cypress/e2e/users_spec/user_creation.cy.ts
  • cypress/e2e/facility_spec/facility_creation.cy.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • cypress/e2e/login_spec/loginpage.cy.ts
🔇 Additional comments (1)
cypress/tsconfig.json (1)

17-19: Verify path alias usage across test files.

The configuration looks good for enabling absolute imports. Let's verify that all test files are consistently using the new @/* alias pattern.

✅ Verification successful

Path aliases are consistently used across all test files

All TypeScript files in the Cypress directory are properly using the @/* path alias for imports. No relative paths were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining relative imports in Cypress test files
# that should be using the new @/* alias

# Look for relative imports (../) in Cypress test files
echo "Checking for relative imports that could use @/* alias:"
rg -t ts "from ['\"]\.\./" cypress/

# Look for current directory imports (./) in Cypress test files
echo -e "\nChecking for current directory imports that could use @/* alias:"
rg -t ts "from ['\"]\./" cypress/

Length of output: 343


Script:

#!/bin/bash
# First, check if TypeScript files exist
echo "TypeScript files in cypress directory:"
fd -e ts . cypress/

echo -e "\nChecking for any kind of imports in TypeScript files:"
rg -t ts "^import .* from" cypress/

echo -e "\nChecking for @/* alias usage:"
rg -t ts "from ['\"]\@\/" cypress/

Length of output: 2628

@rithviknishad rithviknishad merged commit 9858102 into ohcnetwork:develop Jan 28, 2025
15 of 16 checks passed
Copy link

@AdityaJ2305 Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

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.

4 participants