-
Notifications
You must be signed in to change notification settings - Fork 104
Cleanup ESLint packages/react #1027
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
Cleanup ESLint packages/react #1027
Conversation
Following functions were missing jsdoc - `attachDocument`(DocumentProvider.tsx) - `activateClient`(YorkieProvider.tsx)
to fix eslint rule violation
Suppress the `@typescript-eslint/ban-types` rule for initial context value
WalkthroughThis update adds a "lint" script to the package.json for the React package, refines type annotations, and introduces JSDoc comments in the DocumentProvider and YorkieProvider source files. There are no changes to logic or exported APIs—only documentation, type style, and configuration are updated. Changes
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/react/src/YorkieProvider.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin". (The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in ".eslintrc.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. packages/react/src/DocumentProvider.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin". (The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in ".eslintrc.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
CodeRabbit Configuration File (
|
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 (5)
packages/react/src/YorkieProvider.tsx (1)
60-63
: Move the JSDoc block aboveactivateClient
for clearer intentPlacing the
/** … */
immediately before theasync function activateClient
line (rather than between hooks and variables) keeps the declaration & its documentation visually contiguous, which improves scan-ability.packages/react/src/DocumentProvider.tsx (3)
98-101
: JSDoc is helpful but would read better directly atop the functionSame nit as in
YorkieProvider
: put the docblock right aboveasync function attachDocument
to avoid the visual gap.
55-57
: Prefer a single, project-wide array-type style for consistencyYou changed three spots from
T[]
toArray<T>
. Either style is fine, but mixing both within the same file can annoy ESLint’s@typescript-eslint/array-type
rule (depends on config). Consider standardising on one form.Also applies to: 160-164, 231-232
170-171
: Avoidany
and remove theban-types
disableUsing
any
defeats the safety of the context. A safer default keeps the linter happy and removes the need for the rule-disable:-// eslint-disable-next-line @typescript-eslint/ban-types -const DocumentContext = createContext<DocumentContextType<any, any> | null>(null); +const DocumentContext = createContext<DocumentContextType<unknown, unknown> | null>( + null, +);packages/react/package.json (1)
18-20
: Add ESLint cache for faster local runs
eslint --cache
stores results and speeds up subsequent invocations on unchanged files.-"lint": "eslint . --fix --max-warnings=0 --ext .ts,.tsx" +"lint": "eslint . --cache --fix --max-warnings=0 --ext .ts,.tsx"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/react/package.json
(1 hunks)packages/react/src/DocumentProvider.tsx
(3 hunks)packages/react/src/YorkieProvider.tsx
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: hackerwins
PR: yorkie-team/yorkie-js-sdk#954
File: examples/react-flow/src/main.tsx:44-59
Timestamp: 2025-03-17T07:16:43.740Z
Learning: In the react-flow example for yorkie-js-sdk, using a date-based document key (`react-flow-YYYYMMDD`) is an intentional design pattern to create a new document each day.
packages/react/src/YorkieProvider.tsx (1)
Learnt from: hackerwins
PR: yorkie-team/yorkie-js-sdk#954
File: examples/react-flow/src/main.tsx:44-59
Timestamp: 2025-03-17T07:16:43.740Z
Learning: In the react-flow example for yorkie-js-sdk, using a date-based document key (`react-flow-YYYYMMDD`) is an intentional design pattern to create a new document each day.
packages/react/src/DocumentProvider.tsx (1)
Learnt from: hackerwins
PR: yorkie-team/yorkie-js-sdk#954
File: examples/react-flow/src/main.tsx:44-59
Timestamp: 2025-03-17T07:16:43.740Z
Learning: In the react-flow example for yorkie-js-sdk, using a date-based document key (`react-flow-YYYYMMDD`) is an intentional design pattern to create a new document each day.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1027 +/- ##
==========================================
+ Coverage 78.10% 78.17% +0.06%
==========================================
Files 66 66
Lines 5764 5764
Branches 1043 1043
==========================================
+ Hits 4502 4506 +4
+ Misses 951 950 -1
+ Partials 311 308 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Having identified the root cause of the ESLint issue in the related PR, I’m marking this PR as ready for review again. |
3f1f084
to
0d6a2da
Compare
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.
Thanks for your contribution.
What this PR does / why we need it?
Scope: packages/react
Any background context you want to provide?
What are the relevant tickets?
Follows #1016
Linting
before fixing


fixed
Checklist
Summary by CodeRabbit
Documentation
Chores