chore: improve eslint conf - #5
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @akngs, 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 focuses on enhancing the project's code quality and consistency by significantly refactoring and improving the ESLint configuration. It updates linting rules, integrates better with TypeScript, and refines the scope of code analysis tools like Biome. These changes aim to enforce stricter coding standards and streamline the development workflow.
Highlights
- Updated ESLint Configuration: The
eslint.config.jsfile has been extensively updated to use the new flat config format, introduce explicit naming for configurations, and refine rule sets for JavaScript, JSDoc, import statements, TypeScript, and SonarJS. - Stricter TypeScript Linting: New TypeScript ESLint rules, such as
@typescript-eslint/consistent-type-imports, have been enabled to enforce better type import practices, leading to more consistent and readable code. - Biome Configuration Refinement: The
biome.jsoncconfiguration has been updated to use the latest schema, enforce double quotes for JavaScript formatting, and adjust the file inclusion/exclusion patterns for more precise code analysis. - VS Code and Tooling Alignment: Minor adjustments were made to
.vscode/settings.jsonandvitest.config.tsto align with the updated linting and formatting configurations, ensuring a smoother developer experience.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request significantly improves the ESLint configuration by migrating to the modern flat config format, which enhances readability and maintainability. The changes across biome.jsonc, tsconfig.json, and package.json align well with this goal. However, I've identified a critical issue in the new eslint.config.js regarding file scoping. The current setup incorrectly applies TypeScript-specific rules to all files, which could lead to linting errors. I've provided detailed suggestions to rectify this by explicitly scoping the rules to TypeScript files. Additionally, I've pointed out a minor opportunity in a test file to refactor the code to avoid disabling a lint rule.
|
|
||
| // eslint | ||
| // check for typescript files | ||
| { name: "s4/ts", files: ["src/**/*.ts"] }, |
There was a problem hiding this comment.
In ESLint's flat config, configuration objects without a files property apply to all files by default. This configuration object appears to be a placeholder to satisfy a requirement of typescript-eslint's ts.config() helper. However, a more explicit and clearer approach is to define the files glob in each configuration block that requires it. This placeholder can be removed once the other blocks are correctly scoped.
No description provided.