-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix eslint issues #25352
Fix eslint issues #25352
Conversation
598aea5
to
3319df2
Compare
3319df2
to
f12cc4a
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.
This looks fine just looking at /components/env
packages/env/lib/config/config.js
Outdated
* @property {string} workDirectoryPath Path to the work directory located in ~/.wp-env. | ||
* @property {string} dockerComposeConfigPath Path to the docker-compose.yml file. | ||
* @property {boolean} detectedLocalConfig If true, wp-env detected local config and used it. | ||
* @property {Object.<string, WPServiceConfig>} env Specific config for different environments. |
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.
this seems like a weird fix. Why it is aligning the variables with the type parameter? 🤔
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.
Good catch @noahtallen! It's an issue with the plugin that I haven't seen before. For now, I just updated removing the space, but I'll submit a PR to the eslint-jsdoc-plugin
with a fix in the next few days.
f12cc4a
to
05f4f13
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, left a few comments, as we are touching these lines now, helping our future selves for Git blame, maybe adding the trailing .
period to the @param
descriptions now that are missing them would be good (It appears there are not many instances where these are missing)
I got through around ~25% of the files, can we make those changes noted in the review and then I can come back for a full review pass of all the files
Edit: It may in fact we worthwhile trying to use Prettier prettier-plugin-jsdoc here to update the docs s mentioned here in #24984 (comment) as this may be signifantly quicker for both this PR and future code written will be formatted automatically rather than a devloper pushing up code that then fails linting
* @param {string} file File name | ||
* @return {string} Package name |
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.
If @return
descriptions are not destined to be aligned with @param
descriptions then I think this also requires some changes:
This aligns the descriptions of both lines:
* @param {string} file File name | |
* @return {string} Package name | |
* @param {string} file File name | |
* @return {string} Package name |
Or, this removes the additional whitespece preceding the @return description
* @param {string} file File name
* @return {string} Package name
Possibly, another convention observed further below is a blank line between the last @param and the @Raturn:
* @param {string} file File name
*
* @return {string} Package name
* @property {string} versionMilestoneFormat printf template for milestone | ||
* version name. Expected to be called | ||
* with a merged object of the config | ||
* and semver-parsed version parts. |
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.
* @property {string} versionMilestoneFormat printf template for milestone | |
* version name. Expected to be called | |
* with a merged object of the config | |
* and semver-parsed version parts. | |
* @property {string} versionMilestoneFormat printf template for milestone | |
* version name. Expected to be called | |
* with a merged object of the config | |
* and semver-parsed version parts. |
Identation of the subsequent lines should align with the start of the first comment
@@ -47,7 +47,7 @@ async function commit( gitWorkingDirectoryPath, message, filesToAdd = [] ) { | |||
* Creates a local branch. | |||
* | |||
* @param {string} gitWorkingDirectoryPath Local repository path. | |||
* @param {string} branchName Branch Name | |||
* @param {string} branchName Branch Name |
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.
Not a blocker, but we should look at standardizing either including or excluding the .
period at the end of the @param description, PHP Coding Standards require this, so I'd lean toward that also for JS (A goal is to align the CS between languages as best we can when suited)
* @param {Object} record The record to apply annotations to. | ||
* @param {Array} annotations The annotation to apply. | ||
* @param {Object} record The record to apply annotations to. | ||
* @param {Array} annotations The annotation to apply. | ||
* @return {Object} A record with the annotations applied. |
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.
* @param {boolean} br Optional. If set, will convert all remaining line- | ||
* breaks after paragraphing. Default true. |
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.
* @param {boolean} br Optional. If set, will convert all remaining line- | |
* breaks after paragraphing. Default true. | |
* @param {boolean} br Optional. If set, will convert all remaining line- | |
* breaks after paragraphing. Default true. |
The original second line aligned with the start of the original description, seems like this should be updated here also
* @param {string} clientId The block client ID. | ||
* @param {Object} template The template to match. | ||
* @param {string} templateLock The template lock state for the inner blocks. For |
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.
This needs updating and the lines below to line 31, looks like autofix missed the @param
on line 28
* @param {string=} rootClientId Insertion's root client ID. | ||
* @param {Function} onInsert function called when inserter a list of blocks. | ||
* @param {string=} rootClientId Insertion's root client ID. | ||
* @param {Function} onInsert function called when inserter a list of blocks. |
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.
* @param {Function} onInsert function called when inserter a list of blocks. | |
* @param {Function} onInsert Function called when inserter a list of blocks. |
Should descriptions always begin with a Capital letter? It appears to be the convention and is also a PHP coding standard
@@ -40,25 +40,25 @@ import { useRegistry } from '@wordpress/data'; | |||
* controllers. |
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.
More examples in this file of second line descriptions not aligned with the first line
@@ -80,7 +80,7 @@ export function getValidAlignments( | |||
/** | |||
* Filters registered block settings, extending attributes to include `align`. | |||
* | |||
* @param {Object} settings Original block settings | |||
* @param {Object} settings Original block settings | |||
* @return {Object} Filtered block settings |
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.
* @return {Object} Filtered block settings | |
* @return {Object} Filtered block settings |
Remove additional whitespace for @return descriptions
* @param {Object} blocksOrder Object that maps block client IDs to a list of | ||
* nested block client IDs. |
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.
* @param {Object} blocksOrder Object that maps block client IDs to a list of | |
* nested block client IDs. | |
* @param {Object} blocksOrder Object that maps block client IDs to a list of | |
* nested block client IDs. |
Thank you so much for the review @ntwb!! As I mentioned here: #25300 (comment), I think I'll keep this PR in stand by for now until going with that fixes. But it worthed a lot to get some more cases and maybe include some of them in the rule logic. I'm closing this for now and I'll open a new one when it's ready. It'll be easier because it'll have a lot of conflicts. |
Description
This PR fixes some Eslint issues related to PR #25300.
It still contains some issues related to tests (tests without assertion and jasmine global - see screenshots) which I preferred don't touch for now because we could follow different approaches and I'm not sure what would fit better.
I separated the changes in different commits, where the first one is about indentation only. In the second one, I also added some arguments that were missing with their types. I identified the type through the code interpretation, so I'd appreciate a more detailed check here: 598aea5
How has this been tested?
Running
npm run lint-js
in Gutenberg code.Screenshots
The remaining issues (warnings that were present before the changes too):
Types of changes
Eslint fixes related to JSDoc.
Checklist: