-
Notifications
You must be signed in to change notification settings - Fork 10
T2639 FIX eslint in JS #149
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
base: 14.0-MyCompassion2.0
Are you sure you want to change the base?
Conversation
Removed ignore from my2 JS files and run pre-commit
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.
Summary of Changes
Hello @ecino, 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 integrates previously ignored JavaScript files into the ESLint linting process. By removing the ignore rule and running pre-commit hooks, it ensures that a set of my2 related JavaScript files now adhere to the project's established code style and quality standards, improving overall code consistency and maintainability.
Highlights
- ESLint Configuration Update: The
.eslintignorefile has been updated to remove the ignore rule for JavaScript files within themy2directory, specificallymy_compassion/**/!(my2*).js. - Code Formatting and Consistency: Numerous JavaScript files across the
my_compassionmodule have received formatting adjustments, including whitespace changes, removal of redundant.bind(this)calls, and standardization of JSDoc type annotations (e.g.,stringtoString,booleantoBoolean). These changes are a direct result of applying ESLint rules.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to fix ESLint issues by enabling linting for my2* JavaScript files and applying the resulting fixes. While many of the changes are beneficial, such as removing unnecessary code and simplifying logic, there's a recurring issue with JSDoc comments. Across multiple files, primitive types like string and boolean have been changed to their capitalized object wrapper counterparts (String, Boolean). This is contrary to JSDoc best practices and can cause confusion. My review focuses on correcting this to ensure documentation clarity and adherence to standards.
| /** | ||
| * Validates the payment form. | ||
| * @returns {boolean} - True if valid, false otherwise. | ||
| * @returns {Boolean} - True if valid, false otherwise. |
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.
According to JSDoc standards, primitive types should be in lowercase. {Boolean} refers to the wrapper object, while {boolean} refers to the primitive type. The original {boolean} was correct.
| * @returns {Boolean} - True if valid, false otherwise. | |
| * @returns {boolean} - True if valid, false otherwise. |
| * @property {String} childId - The ID of the selected child. | ||
| * @property {String|null} templateId - The ID of the selected template, or null if not selected. | ||
| * @property {String} letterBody - The body text of the letter. | ||
| * @property {Array<{filename: String, content: String}>} attachments - The list of base64-encoded attachments. |
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.
Per JSDoc best practices, primitive types should be lowercase (e.g., string). Using String refers to the object wrapper, which is not the intended type here. Please revert these changes to use string.
| * @property {String} childId - The ID of the selected child. | |
| * @property {String|null} templateId - The ID of the selected template, or null if not selected. | |
| * @property {String} letterBody - The body text of the letter. | |
| * @property {Array<{filename: String, content: String}>} attachments - The list of base64-encoded attachments. | |
| * @property {string} childId - The ID of the selected child. | |
| * @property {string|null} templateId - The ID of the selected template, or null if not selected. | |
| * @property {string} letterBody - The body text of the letter. | |
| * @property {Array<{filename: string, content: string}>} attachments - The list of base64-encoded attachments. |
| * @param {String} mode - Submission mode: `'send'` to submit the letter, `'preview'` to show a preview. | ||
| * @param {Object} result - The result object returned by the server. | ||
| * @param {string} childId - The ID of the selected child, used in the redirect URL. | ||
| * @param {String} childId - The ID of the selected child, used in the redirect URL. |
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.
To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.
| * @param {String} mode - Submission mode: `'send'` to submit the letter, `'preview'` to show a preview. | |
| * @param {Object} result - The result object returned by the server. | |
| * @param {string} childId - The ID of the selected child, used in the redirect URL. | |
| * @param {String} childId - The ID of the selected child, used in the redirect URL. | |
| * @param {string} mode - Submission mode: `'send'` to submit the letter, `'preview'` to show a preview. | |
| * @param {Object} result - The result object returned by the server. | |
| * @param {string} childId - The ID of the selected child, used in the redirect URL. |
| * | ||
| * @param {File} file - The file to generate a key for. | ||
| * @returns {string} A unique key combining the file's name, size, type, and last modified date. | ||
| * @returns {String} A unique key combining the file's name, size, type, and last modified date. |
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.
In JSDoc, it is standard to use lowercase for primitive types. Please change {String} back to {string}.
| * @returns {String} A unique key combining the file's name, size, type, and last modified date. | |
| * @returns {string} A unique key combining the file's name, size, type, and last modified date. |
| * | ||
| * @param {File} file - The file to read. | ||
| * @returns {Promise<string>} A promise that resolves with the file's Data URL. | ||
| * @returns {Promise<String>} A promise that resolves with the file's Data URL. |
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.
To follow JSDoc conventions, primitive types within generic types like Promise should also be lowercase. Please use {Promise<string>} instead of {Promise<String>}.
| * @returns {Promise<String>} A promise that resolves with the file's Data URL. | |
| * @returns {Promise<string>} A promise that resolves with the file's Data URL. |
| /** | ||
| * Validates required fields in the current step. | ||
| * @returns {boolean} - True if valid, false otherwise. | ||
| * @returns {Boolean} - True if valid, false otherwise. |
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.
According to JSDoc standards, primitive types should be in lowercase. {Boolean} refers to the wrapper object, while {boolean} refers to the primitive type. The original {boolean} was correct.
| * @returns {Boolean} - True if valid, false otherwise. | |
| * @returns {boolean} - True if valid, false otherwise. |
| * @param {String} msg - The message body | ||
| * @param {String} title - Optional title (defaults to 'Info') |
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.
To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.
| * @param {String} msg - The message body | |
| * @param {String} title - Optional title (defaults to 'Info') | |
| * @param {string} msg - The message body | |
| * @param {string} title - Optional title (defaults to 'Info') |
| * @param {String} msg - The message body | ||
| * @param {String} title - Optional title (defaults to 'Success') |
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.
To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.
| * @param {String} msg - The message body | |
| * @param {String} title - Optional title (defaults to 'Success') | |
| * @param {string} msg - The message body | |
| * @param {string} title - Optional title (defaults to 'Success') |
| * @param {String} msg - The message body | ||
| * @param {String} title - Optional title (defaults to 'Warning') |
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.
To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.
| * @param {String} msg - The message body | |
| * @param {String} title - Optional title (defaults to 'Warning') | |
| * @param {string} msg - The message body | |
| * @param {string} title - Optional title (defaults to 'Warning') |
| * @param {String} msg - The message body | ||
| * @param {String} title - Optional title (defaults to 'Error') |
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.
To adhere to JSDoc standards, primitive types should be in lowercase. Please use string instead of String for these parameters.
| * @param {String} msg - The message body | |
| * @param {String} title - Optional title (defaults to 'Error') | |
| * @param {string} msg - The message body | |
| * @param {string} title - Optional title (defaults to 'Error') |
Removed ignore from my2 JS files and run pre-commit