Skip to content

fix: globally enable eslint rule #3947

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

Conversation

bandhan-majumder
Copy link
Contributor

@bandhan-majumder bandhan-majumder commented Apr 22, 2025

What kind of change does this PR introduce?

bugfix

Issue Number:

Fixes #3945

Snapshots/Videos:

image

If relevant, did you update the documentation?

N/A

Summary

Enables eslint rules globally

Does this PR introduce a breaking change?

It prevents memory leaks and other potential issues

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Other information

N/A

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • Chores
    • Expanded linting coverage to include all TypeScript files in subdirectories.

Copy link
Contributor

coderabbitai bot commented Apr 22, 2025

Walkthrough

The change updates the ESLint configuration file to modify the file patterns for TypeScript linting. Previously, only TypeScript files in the root directory were targeted. The new configuration applies ESLint rules recursively to all TypeScript files in any subdirectory, ensuring comprehensive linting coverage throughout the project.

Changes

File(s) Change Summary
eslint.config.js Updated TypeScript file patterns from root-only (".ts", ".tsx") to recursive ("/*.ts", "/*.tsx") coverage.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant ESLint
    participant AllTypeScriptFiles

    Developer->>ESLint: Run lint
    ESLint->>AllTypeScriptFiles: Apply rules to **/*.ts, **/*.tsx
    AllTypeScriptFiles-->>ESLint: Lint results
    ESLint-->>Developer: Report issues for all TypeScript files
Loading

Assessment against linked issues

Objective Addressed Explanation
Ensure @typescript-eslint/no-unused-vars rule is applied to all TypeScript files, including existing ones (#3945)

Possibly related PRs

Suggested reviewers

  • palisadoes
  • noman2002

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3fee52 and a0d0d0f.

📒 Files selected for processing (1)
  • eslint.config.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (1)
eslint.config.js (1)

35-35: Great improvement to ESLint configuration!

This change modifies the file patterns from ["*.ts", "*.tsx"] to ["**/*.ts", "**/*.tsx"], which significantly improves linting coverage. The previous configuration only linted TypeScript files in the root directory, while this update correctly applies ESLint rules to all TypeScript files throughout the project recursively.

This directly addresses the PR's objective of enabling ESLint rules globally across the codebase, which will help prevent memory leaks and other potential issues by enforcing consistent code quality standards everywhere.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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.

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

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

codecov bot commented Apr 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.06%. Comparing base (81aa415) to head (e47fa92).
Report is 1 commits behind head on develop-postgres.

Additional details and impacted files
@@                Coverage Diff                @@
##           develop-postgres    #3947   +/-   ##
=================================================
  Coverage             87.06%   87.06%           
=================================================
  Files                   362      362           
  Lines                  9315     9315           
  Branches               1980     1980           
=================================================
  Hits                   8110     8110           
  Misses                  833      833           
  Partials                372      372           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bandhan-majumder
Copy link
Contributor Author

@palisadoes PTAL. It's ready to get merged. Something is wrong about coderabbit approval workflow check. It's not working as expected.

@bandhan-majumder
Copy link
Contributor Author

@palisadoes
as mentioned about the coderabbit workflow check, if the pr which made the change can't be reverted (bcoz of any reason) , I can go ahead and fix the issue.

@Cioppolo14
Copy link
Contributor

@disha1202 @noman2002 Can you review this PR ?

@palisadoes palisadoes merged commit c6102f5 into PalisadoesFoundation:develop-postgres Apr 24, 2025
19 checks passed
@NishantSinghhhhh
Copy link
Contributor

NishantSinghhhhh commented Apr 24, 2025

@bandhan-majumder

I just wanted to point out a few things: this PR definitely fixes the original unused-vars issue, but in addition it’s now triggering forbidden non-null-assertion errors (@typescript-eslint/no-non-null-assertion) as well as a host of TSDoc, naming-convention, duplicate-import, and no-undef failures in our existing files. Could we adjust the ESLint configuration (or update the affected code) to prevent those regressions?

Please have a look at Link , I made a commit after the recent changes you did and these eslint errors occurred

@bandhan-majumder
Copy link
Contributor Author

bandhan-majumder commented Apr 24, 2025

@NishantSinghhhh

I opened this issue focusing on unused vars. But the main problem was, every rule was checked only for the root directory. So I made it enabled globally (which must be done) with recursive search.

I saw your commit and the errors. Most of them are occuring because the correct convention of naming was not properly followed. It can be easily fixed. Do you want me to help fixing them?

@typescript-eslint/no-non-null-assertion typically asks you to avoid using ! . You can use something like nullish coalescing operator (??) to pass the check. TSDoc related checks are just warnings. We also used to have these warnings before. You can ignore them.

@NishantSinghhhhh
Copy link
Contributor

@bandhan-majumder

Talking about the convention of names, all the names in interface.ts have the word Interface in it which I believe is the conventional way, in December and January The initial commit checks that ran after we made a commit used to throw errors if the interfaces we defined were not having either Interface or I in-front of them , so I belive all names in interface are correctly written , maybe a little change in eslintric.json will remove this specific thing,

Also there are few things that I noticed, few errors are not right, here you can see that it shows errors related to that ./CategoryModal' I imported twice, but in the code this is not the case , see the 2nd image, maybe this is not an error from your PR but I guess we need to solve this

Screenshot from 2025-04-25 01-57-51

Screenshot from 2025-04-25 01-58-48

@bandhan-majumder
Copy link
Contributor Author

@NishantSinghhhhh

I think your changes passes the eslint check now. However, there were imports from the same file twice (not the same import, but from same file)..but that's fixed now..

image

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