-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
BugFix : Fixed failing ESLint and Prettier tests in scripts/githooks/check-localstorage-usage.js file #3186
BugFix : Fixed failing ESLint and Prettier tests in scripts/githooks/check-localstorage-usage.js file #3186
Conversation
WalkthroughThis pull request introduces a minor modification to the ESLint configuration in Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.eslintrc.json (1)
157-163
: Consider disabling other TypeScript-specific rules for JS files.While this fix addresses the immediate issue with function return types, there are other TypeScript-specific rules in the configuration that might cause similar issues with JavaScript files. Consider adding these rules to the override:
@typescript-eslint/explicit-module-boundary-types
@typescript-eslint/no-inferrable-types
@typescript-eslint/consistent-type-imports
"overrides": [ { "files": ["*.js"], "rules": { - "@typescript-eslint/explicit-function-return-type": "off" + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/consistent-type-imports": "off" } } ]
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.eslintrc.json
(1 hunks)scripts/githooks/check-localstorage-usage.js
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- scripts/githooks/check-localstorage-usage.js
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test Application
- GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (2)
.eslintrc.json (2)
157-163
: LGTM! The override correctly addresses the TypeScript rule conflict.The added override section properly disables the TypeScript return type requirement for JavaScript files, which aligns with the PR objective to fix ESLint failures.
157-163
: Verify the fix resolves all ESLint errors in JavaScript files.Let's ensure this change fixes all TypeScript-related ESLint errors in JavaScript files.
✅ Verification successful
ESLint override for JavaScript files is appropriate
The override to disable
@typescript-eslint/explicit-function-return-type
for JavaScript files is correct. Current JavaScript files in the codebase are simple configuration and utility files that don't contain complex function implementations, but this override ensures TypeScript-specific rules won't affect any JavaScript files added in the future.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for remaining TypeScript-related ESLint errors in JavaScript files # Find all JavaScript files echo "JavaScript files that might be affected:" fd -e js # Run ESLint on JavaScript files and check for TypeScript-related errors echo -e "\nChecking for remaining TypeScript-related ESLint errors:" fd -e js -x eslint {} | grep -i typescript || echo "No TypeScript-related errors found"Length of output: 774
Script:
#!/bin/bash # Search for function declarations and expressions in JavaScript files echo "Checking function declarations:" ast-grep --pattern 'function $NAME($_) { $$$ }' --lang js echo -e "\nChecking function expressions and arrow functions:" ast-grep --pattern '$_ = function($_) { $$$ }' --lang js ast-grep --pattern '$_ = ($_) => $_' --lang jsLength of output: 357
Script:
#!/bin/bash # Search for various function patterns in JavaScript files echo "Checking module.exports functions:" ast-grep --pattern 'module.exports = $_' --lang js echo -e "\nChecking object methods:" ast-grep --pattern '{ $NAME($_) { $$$ } }' --lang js echo -e "\nChecking exported arrow functions:" ast-grep --pattern 'exports.$_ = $_' --lang js ast-grep --pattern 'module.exports.$_ = $_' --lang js echo -e "\nChecking direct function declarations:" rg "function" -A 2 --type jsLength of output: 1550
Hello @palisadoes, I hope you're doing well. Could you please review the PR whenever you get a chance? Let me know if there are any changes or adjustments I need to make. Thank you! |
68d6193
into
PalisadoesFoundation:develop-postgres
* prevented unnecessary page reload with complementary test * Update jest.config.js * Fixes #2986 - Multiple UI Updates (#3165) * UI fixes on organisation pages * Added TSDoc for Truncated Text * Added Debouncer * Update src/components/OrgListCard/OrgListCard.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Added code rabbit suggestions * Fixed test error --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * refactore src/screens/OrgList from jest to vitest (#3200) * Improved Code Coverage in src/components/Venues/VenueModal.tsx (#3203) * Improved Code Coverage in src/components/Venues/VenueModal.tsx * removed the ignore statements from VenueModal.tsx * Removed istanbul ignore lines. Code coverage remians 100% (#3207) * refactored src/screens/FundCampaignPledge from jest to vitest (#3208) * prettier formatting and disabled ts-specific rules for js in eslint (#3186) * Improve Code Coverage in src/screens/UserPortal/Settings/Settings.tsx (#3189) * Preventing Overflow of images in Advertisement and Venue Post modals (#3204) * improve code coverage of src/screens/EventManagement (#3149) * code coverage * jest global coverage decreased * global jest coverage * rename file problem solved * changes requested resolved * fix: update Chat section title to 'Chats' (#3216) * removed stale comment line * Revert "removed stale comment line" This reverts commit e0fa894. * removed stale comment line --------- Co-authored-by: Peter Harrison <[email protected]> Co-authored-by: Mehul Aggarwal <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Syed Ali Ul Hasan <[email protected]> Co-authored-by: harshk-89 <[email protected]> Co-authored-by: Amaan ali <[email protected]> Co-authored-by: Yugal Sadhwani <[email protected]> Co-authored-by: Pranav Nathe <[email protected]> Co-authored-by: prathmesh703 <[email protected]> Co-authored-by: Nivedita <[email protected]>
What kind of change does this PR introduce?
BugFix
Issue Number:
Fixes #3184
Did you add tests for your changes?
No
Snapshots/Videos:
Before
After
If relevant, did you update the documentation?
Not applicable
Does this PR introduce a breaking change?
No
Other information
Problem 1: ESLint was configured to check for type declarations in .js files, which caused a conflict since these files are not meant to have type declarations like TypeScript files.
Specifically, the rule @typescript-eslint/explicit-function-return-type was being enforced on JavaScript files. This rule mandates that all functions must have an explicit return type, but this isn’t relevant for regular JavaScript files, leading to unnecessary linting warnings and errors.
To prevent ESLint from applying TypeScript-specific rules (like @typescript-eslint/explicit-function-return-type) to JavaScript files, I added an override to the ESLint configuration file.
Problem 2: Prettier Test was failing since there were some missing commas in console.info
So i ran the prettier write command to fix that format to a better format.
Have you read the contributing guide?
Yes
Summary by CodeRabbit