chore: add eslint config and non-interactive lint checks#34
Conversation
📝 WalkthroughWalkthroughThis PR establishes ESLint configuration to enable linting without interactive setup, improves error handling in contract interactions with stricter typing, removes unused component props and state, fixes HTML entity escaping in JSX text, and simplifies type definitions. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/`[oracleId]/InteractionClient.tsx:
- Line 154: The useOracle call is still triggering fallback-chain reads when
chainId is invalid; change the arguments so the oracle address is only passed
when chainIdValid is true. Specifically, update the call using the useOracle
symbol to something like: pass oracleAddress only if chainIdValid &&
oracleAddress are truthy, otherwise pass an empty string (or undefined per
useOracle's expected input), and continue to pass chainId only when chainIdValid
is true; apply the same gating wherever useOracle (and any other reads using
oracleAddress) are invoked (e.g., the other occurrences around the component
rendering invalid-params).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d25ce6db-e58a-464f-beeb-93040118a99b
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (11)
.eslintignore.eslintrc.jsonapp/[oracleId]/InteractionClient.tsxapp/[oracleId]/page.tsxapp/explorer/page.tsxcomponents/KyaModal.tsxcomponents/PillNav.tsxcomponents/TokenSelector.tsxcomponents/createOracle.tsxcomponents/ui/use-toast.tspackage.json
💤 Files with no reviewable changes (3)
- app/[oracleId]/page.tsx
- components/PillNav.tsx
- components/TokenSelector.tsx
| const { isLoading: isConfirming, isSuccess: isConfirmed } = useWaitForTransactionReceipt({ | ||
| hash, | ||
| }) | ||
| const { oracle, loading: oracleLoading, error: oracleError } = useOracle(oracleAddress ?? "", chainIdValid ? chainId : undefined) |
There was a problem hiding this comment.
Prevent fallback-chain reads when query params are invalid.
At Line 154, useOracle(oracleAddress ?? "", chainIdValid ? chainId : undefined) can still trigger reads on the connected chain when oracleAddress is valid but chainId is invalid, even though Line 971 renders the invalid-params state. Gate the address by chainIdValid too.
💡 Proposed fix
- const { oracle, loading: oracleLoading, error: oracleError } = useOracle(oracleAddress ?? "", chainIdValid ? chainId : undefined)
+ const shouldLoadOracle = !!oracleAddress && chainIdValid
+ const { oracle, loading: oracleLoading, error: oracleError } = useOracle(
+ shouldLoadOracle ? oracleAddress : "",
+ shouldLoadOracle ? chainId : undefined
+ )
- const hasInvalidParams = !oracleAddress || !chainIdValid
+ const hasInvalidParams = !shouldLoadOracleAlso applies to: 367-367, 971-997
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/`[oracleId]/InteractionClient.tsx at line 154, The useOracle call is
still triggering fallback-chain reads when chainId is invalid; change the
arguments so the oracle address is only passed when chainIdValid is true.
Specifically, update the call using the useOracle symbol to something like: pass
oracleAddress only if chainIdValid && oracleAddress are truthy, otherwise pass
an empty string (or undefined per useOracle's expected input), and continue to
pass chainId only when chainIdValid is true; apply the same gating wherever
useOracle (and any other reads using oracleAddress) are invoked (e.g., the other
occurrences around the component rendering invalid-params).
Addressed Issues:
Fixes #33
Summary
npm run lintnon-interactive with--no-cacheValidation
npm run lintnpm run buildScreenshots/Recordings:
Additional Notes:
AI Usage Disclosure:
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:
I have used the following AI models and tools: TODO
Checklist
Summary by CodeRabbit
Bug Fixes
Chores
Removed Features