docs/examples: framework-mode parity demo + less/sass notes#32
docs/examples: framework-mode parity demo + less/sass notes#32ScriptedAlchemy merged 1 commit intomainfrom
Conversation
Summary of ChangesHello @ScriptedAlchemy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a solid update that improves documentation regarding framework-mode parity and adds a valuable example for less and scss styling, complete with e2e tests. The type updates from Route.LoaderData to Route.ComponentProps["loaderData"] are a good move towards better type safety. However, I've identified a few instances where any has been used to resolve type inference issues, which compromises type safety. My review includes specific suggestions to address these points for improved code quality and maintainability.
| </h2> | ||
| <div className="space-y-4"> | ||
| {recentActivity.map((activity) => ( | ||
| {recentActivity.map((activity: any) => ( |
There was a problem hiding this comment.
Using any here bypasses type checking and is not ideal for maintainability. It seems the type of activity is not being inferred correctly from recentActivity. To maintain type safety, it would be better to explicitly define the type for an activity item or fix the type inference from useLoaderData. You could extract the type from the loader's return type in the generated types file, for example:
import type { Route } from './+types/index';
type Activity = Route.ComponentProps["loaderData"]["recentActivity"][number];
// ...
{recentActivity.map((activity: Activity) => (
// ...
))}If this isn't feasible, defining the type manually is still preferable to using any.
| {recentActivity.map((activity: any) => ( | |
| {recentActivity.map((activity) => ( |
|
|
||
| <nav className="space-y-1"> | ||
| {projects.map((project) => ( | ||
| {projects.map((project: any) => ( |
There was a problem hiding this comment.
Using any for the project parameter is not ideal as it bypasses type safety. Please consider defining a proper type for project or ensuring it's correctly inferred from useLoaderData to improve maintainability and prevent potential runtime errors.
| {projects.map((project: any) => ( | |
| {projects.map((project) => ( |
| </h2> | ||
| <div className="space-y-4"> | ||
| {project.team.map((member) => ( | ||
| {project.team.map((member: any) => ( |
There was a problem hiding this comment.
Using any for the member parameter reduces type safety. It would be better to define a proper type for member or ensure it's correctly inferred from the project.team data to make the component more robust and easier to maintain.
| {project.team.map((member: any) => ( | |
| {project.team.map((member) => ( |
| </h2> | ||
| <div className="space-y-4"> | ||
| {project.activity.map((item) => ( | ||
| {project.activity.map((item: any) => ( |
There was a problem hiding this comment.
Using any for the item parameter is not ideal as it bypasses type checking. Please consider defining a proper type for item or ensuring it's correctly inferred from project.activity to improve type safety and code clarity.
| {project.activity.map((item: any) => ( | |
| {project.activity.map((item) => ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ba0d3395f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| plugins: [ | ||
| pluginReactRouter({ serverOutput: 'commonjs' }), | ||
| pluginReact(), | ||
| pluginLess(), | ||
| pluginSass(), |
There was a problem hiding this comment.
Add
less dependency for pluginLess usage
With pluginLess() enabled and a *.module.less route in this template, a clean install will try to compile LESS but less itself isn’t declared in examples/default-template/package.json (and doesn’t appear in the lockfile). @rsbuild/plugin-less doesn’t vendor the compiler, so the dev server/build will fail with a missing less module on fresh installs. Add less to the template’s devDependencies or drop the LESS usage to keep the example runnable.
Useful? React with 👍 / 👎.
This PR applies our stashed local work:
examples/default-templateto explicitly demonstrate framework-mode style usage:/stylingroute that imports*.module.lessand*.module.scss@rsbuild/plugin-less+@rsbuild/plugin-sassinexamples/default-template/rsbuild.config.tsTested:
pnpm testpnpm --filter default-template typecheckpnpm --filter default-template buildpnpm --filter default-template test:e2e