Skip to content
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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/packages/build-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const renderSass = promisify( sass.render );
/**
* Get the package name for a specified file
*
* @param {string} file File name
* @param {string} file File name
* @return {string} Package name
*/
function getPackageName( file ) {
Expand All @@ -64,8 +64,8 @@ function getPackageName( file ) {
/**
* Get Build Path for a specified file.
*
* @param {string} file File to build
* @param {string} buildFolder Output folder
* @param {string} file File to build
* @param {string} buildFolder Output folder
* @return {string} Build path
*/
function getBuildPath( file, buildFolder ) {
Expand Down
2 changes: 1 addition & 1 deletion bin/packages/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const PACKAGES_DIR = path.resolve( __dirname, '../../packages' );
/**
* Get the package name for a specified file
*
* @param {string} file File name
* @param {string} file File name
* @return {string} Package name
Comment on lines +22 to 23
Copy link
Member

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:

Suggested change
* @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

*/
function getPackageName( file ) {
Expand Down
12 changes: 6 additions & 6 deletions bin/plugin/commands/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ async function runWordPressReleaseBranchSyncStep(
* Update CHANGELOG files with the new version number for those packages that
* contain new entries.
*
* @param {string} gitWorkingDirectoryPath Git working directory path.
* @param {string} minimumVersionBump Minimum version bump for the packages.
* @param {boolean} isPrerelease Whether the package version to publish is a prerelease.
* @param {string} abortMessage Abort Message.
* @param {string} gitWorkingDirectoryPath Git working directory path.
* @param {string} minimumVersionBump Minimum version bump for the packages.
* @param {boolean} isPrerelease Whether the package version to publish is a prerelease.
* @param {string} abortMessage Abort Message.
*/
async function updatePackages(
gitWorkingDirectoryPath,
Expand Down Expand Up @@ -274,8 +274,8 @@ async function runPushGitChangesStep(
/**
* Prepare everything to publish WordPress packages to npm.
*
* @param {string} minimumVersionBump Minimum version bump for the packages.
* @param {boolean} isPrerelease Whether the package version to publish is a prerelease.
* @param {string} minimumVersionBump Minimum version bump for the packages.
* @param {boolean} isPrerelease Whether the package version to publish is a prerelease.
*
* @return {Promise<Object>} Github release object.
*/
Expand Down
42 changes: 21 additions & 21 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,32 @@ const config = require( '../config' );
/**
* @typedef WPRawPerformanceResults
*
* @property {number[]} load Load Time.
* @property {number[]} type Average type time.
* @property {number[]} focus Average block selection time.
* @property {number[]} load Load Time.
* @property {number[]} type Average type time.
* @property {number[]} focus Average block selection time.
*/

/**
* @typedef WPPerformanceResults
*
* @property {number} load Load Time.
* @property {number} type Average type time.
* @property {number} minType Minium type time.
* @property {number} maxType Maximum type time.
* @property {number} focus Average block selection time.
* @property {number} minFocus Min block selection time.
* @property {number} maxFocus Max block selection time.
* @property {number} load Load Time.
* @property {number} type Average type time.
* @property {number} minType Minium type time.
* @property {number} maxType Maximum type time.
* @property {number} focus Average block selection time.
* @property {number} minFocus Min block selection time.
* @property {number} maxFocus Max block selection time.
*/
/**
* @typedef WPFormattedPerformanceResults
*
* @property {string=} load Load Time.
* @property {string=} type Average type time.
* @property {string=} minType Minium type time.
* @property {string=} maxType Maximum type time.
* @property {string=} focus Average block selection time.
* @property {string=} minFocus Min block selection time.
* @property {string=} maxFocus Max block selection time.
* @property {string=} load Load Time.
* @property {string=} type Average type time.
* @property {string=} minType Minium type time.
* @property {string=} maxType Maximum type time.
* @property {string=} focus Average block selection time.
* @property {string=} minFocus Min block selection time.
* @property {string=} maxFocus Max block selection time.
*/

/**
Expand Down Expand Up @@ -115,8 +115,8 @@ function curateResults( results ) {
/**
* Set up the given branch for testing.
*
* @param {string} branch Branch name.
* @param {string} environmentDirectory Path to the plugin environment's clone.
* @param {string} branch Branch name.
* @param {string} environmentDirectory Path to the plugin environment's clone.
*/
async function setUpGitBranch( branch, environmentDirectory ) {
// Restore clean working directory (e.g. if `package-lock.json` has local
Expand Down Expand Up @@ -179,8 +179,8 @@ async function runTestSuite( testSuite, performanceTestDirectory ) {
/**
* Runs the performances tests on an array of branches and output the result.
*
* @param {WPPerformanceCommandOptions} options Command options.
* @param {string[]} branches Branches to compare
* @param {string[]} branches Branches to compare.
* @param {WPPerformanceCommandOptions} options Command options.
*/
async function runPerformanceTests( branches, options ) {
// The default value doesn't work because commander provides an array.
Expand Down
22 changes: 11 additions & 11 deletions bin/plugin/commands/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function runReleaseBranchCreationStep(
* Checkouts out the release branch and chooses a stable version number.
*
* @param {string} gitWorkingDirectoryPath Git Working Directory Path.
* @param {string} abortMessage Abort Message.
* @param {string} abortMessage Abort Message.
*
* @return {Promise<Object>} chosen version and versionLabels.
*/
Expand Down Expand Up @@ -384,8 +384,8 @@ async function runPushGitChangesStep(
* Cherry-picks the version bump commit into master.
*
* @param {string} gitWorkingDirectoryPath Git Working Directory Path.
* @param {string} commitHash Commit to cherry-pick.
* @param {string} abortMessage Abort message.
* @param {string} commitHash Commit to cherry-pick.
* @param {string} abortMessage Abort message.
*/
async function runCherrypickBumpCommitIntoMasterStep(
gitWorkingDirectoryPath,
Expand Down Expand Up @@ -419,12 +419,12 @@ async function runCherrypickBumpCommitIntoMasterStep(
/**
* Creates the github release and uploads the ZIP file into it.
*
* @param {string} zipPath Plugin zip path.
* @param {string} version Released version.
* @param {string} versionLabel Label of the released Version.
* @param {string} changelog Release changelog.
* @param {boolean} isPrerelease is a pre-release.
* @param {string} abortMessage Abort message.
* @param {string} zipPath Plugin zip path.
* @param {string} version Released version.
* @param {string} versionLabel Label of the released Version.
* @param {string} changelog Release changelog.
* @param {boolean} isPrerelease is a pre-release.
* @param {string} abortMessage Abort message.
*
* @return {Promise<Object>} Github release object.
*/
Expand Down Expand Up @@ -565,8 +565,8 @@ async function runUpdateTrunkContentStep(
/**
* Creates a new SVN Tag
*
* @param {string} version Version.
* @param {string} abortMessage Abort Message.
* @param {string} version Version.
* @param {string} abortMessage Abort Message.
*/
async function runSvnTagStep( version, abortMessage ) {
await runStep( 'Creating the SVN Tag', abortMessage, async () => {
Expand Down
20 changes: 10 additions & 10 deletions bin/plugin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ const gitRepoOwner = 'WordPress';
/**
* @typedef WPPluginCLIConfig
*
* @property {string} slug Slug.
* @property {string} name Name.
* @property {string} team Github Team Name.
* @property {string} versionMilestoneFormat printf template for milestone
* @property {string} slug Slug.
* @property {string} name Name.
* @property {string} team Github Team 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.
Comment on lines +9 to 12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @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

* @property {string} githubRepositoryOwner Github Repository Owner.
* @property {string} githubRepositoryName Github Repository Name.
* @property {string} pluginEntryPoint Plugin Entry Point File.
* @property {string} buildZipCommand Build Plugin ZIP command.
* @property {string} githubRepositoryOwner Github Repository Owner.
* @property {string} githubRepositoryName Github Repository Name.
* @property {string} pluginEntryPoint Plugin Entry Point File.
* @property {string} buildZipCommand Build Plugin ZIP command.
* @property {string} wpRepositoryReleasesURL WordPress Repository Tags URL.
* @property {string} gitRepositoryURL Git Repository URL.
* @property {string} svnRepositoryURL SVN Repository URL.
* @property {string} gitRepositoryURL Git Repository URL.
* @property {string} svnRepositoryURL SVN Repository URL.
*/

/**
Expand Down
20 changes: 10 additions & 10 deletions bin/plugin/lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ async function clone( repositoryUrl ) {
/**
* Commits changes to the repository.
*
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} message Commit message.
* @param {string[]} filesToAdd Files to add.
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} message Commit message.
* @param {string[]} filesToAdd Files to add.
*
* @return {Promise<string>} Commit Hash
*/
Expand All @@ -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
Copy link
Member

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)

*/
async function createLocalBranch( gitWorkingDirectoryPath, branchName ) {
const simpleGit = SimpleGit( gitWorkingDirectoryPath );
Expand All @@ -58,7 +58,7 @@ async function createLocalBranch( gitWorkingDirectoryPath, branchName ) {
* Checkout a local branch.
*
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} branchName Branch Name
* @param {string} branchName Branch Name
*/
async function checkoutRemoteBranch( gitWorkingDirectoryPath, branchName ) {
const simpleGit = SimpleGit( gitWorkingDirectoryPath );
Expand All @@ -70,7 +70,7 @@ async function checkoutRemoteBranch( gitWorkingDirectoryPath, branchName ) {
* Creates a local tag.
*
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} tagName Tag Name
* @param {string} tagName Tag Name
*/
async function createLocalTag( gitWorkingDirectoryPath, tagName ) {
const simpleGit = SimpleGit( gitWorkingDirectoryPath );
Expand All @@ -81,7 +81,7 @@ async function createLocalTag( gitWorkingDirectoryPath, tagName ) {
* Pushes a local branch to the origin.
*
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} branchName Branch Name
* @param {string} branchName Branch Name
*/
async function pushBranchToOrigin( gitWorkingDirectoryPath, branchName ) {
const simpleGit = SimpleGit( gitWorkingDirectoryPath );
Expand Down Expand Up @@ -112,7 +112,7 @@ async function discardLocalChanges( gitWorkingDirectoryPath ) {
* Reset local branch against the origin.
*
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} branchName Branch Name
* @param {string} branchName Branch Name
*/
async function resetLocalBranchAgainstOrigin(
gitWorkingDirectoryPath,
Expand All @@ -128,7 +128,7 @@ async function resetLocalBranchAgainstOrigin(
* Cherry-picks a commit into master
*
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} commitHash Branch Name
* @param {string} commitHash Branch Name
*/
async function cherrypickCommitIntoBranch(
gitWorkingDirectoryPath,
Expand All @@ -143,7 +143,7 @@ async function cherrypickCommitIntoBranch(
* Replaces the local branch's content with the content from another branch.
*
* @param {string} gitWorkingDirectoryPath Local repository path.
* @param {string} sourceBranchName Branch Name
* @param {string} sourceBranchName Branch Name
*/
async function replaceContentFromRemoteBranch(
gitWorkingDirectoryPath,
Expand Down
16 changes: 8 additions & 8 deletions bin/plugin/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const { log, formats } = require( './logger' );
/**
* Utility to run a child script
*
* @param {string} script Script to run.
* @param {string=} cwd Working directory.
* @param {string} script Script to run.
* @param {string=} cwd Working directory.
*/
function runShellScript( script, cwd ) {
childProcess.execSync( script, {
Expand All @@ -45,9 +45,9 @@ function readJSONFile( fileName ) {
/**
* Common logic wrapping a step in the process.
*
* @param {string} name Step name.
* @param {string} abortMessage Abort message.
* @param {Function} handler Step logic.
* @param {string} name Step name.
* @param {string} abortMessage Abort message.
* @param {Function} handler Step logic.
*/
async function runStep( name, abortMessage, handler ) {
try {
Expand All @@ -70,9 +70,9 @@ async function runStep( name, abortMessage, handler ) {
/**
* Asks the user for a confirmation to continue or abort otherwise.
*
* @param {string} message Confirmation message.
* @param {boolean} isDefault Default reply.
* @param {string} abortMessage Abort message.
* @param {string} message Confirmation message.
* @param {boolean} isDefault Default reply.
* @param {string} abortMessage Abort message.
*/
async function askForConfirmation(
message,
Expand Down
2 changes: 1 addition & 1 deletion packages/a11y/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ domReady( setup );
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions.
* This module is inspired by the `speak` function in `wp-a11y.js`.
*
* @param {string} message The message to be announced by assistive technologies.
* @param {string} message The message to be announced by assistive technologies.
* @param {string} [ariaLive] The politeness level for aria-live; default: 'polite'.
*
* @example
Expand Down
2 changes: 1 addition & 1 deletion packages/a11y/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import filterMessage from './filter-message';
/**
* Update the ARIA live notification area text node.
*
* @param {string} message The message to be announced by Assistive Technologies.
* @param {string} message The message to be announced by Assistive Technologies.
* @param {string} [ariaLive] The politeness level for aria-live; default: 'polite'.
*/
export function speak( message, ariaLive ) {
Expand Down
4 changes: 2 additions & 2 deletions packages/annotations/src/format/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const STORE_KEY = 'core/annotations';
/**
* Applies given annotations to the given record.
*
* @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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI Only: An example where there's no blank line between the last @param and the @return and the @return description is not aligned with the @param descriptions

*/
export function applyAnnotations( record, annotations = [] ) {
Expand Down
4 changes: 2 additions & 2 deletions packages/annotations/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export function __experimentalRemoveAnnotation( annotationId ) {
* Updates the range of an annotation.
*
* @param {string} annotationId ID of the annotation to update.
* @param {number} start The start of the new range.
* @param {number} end The end of the new range.
* @param {number} start The start of the new range.
* @param {number} end The end of the new range.
*
* @return {Object} Action object.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/annotations/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const EMPTY_ARRAY = [];
/**
* Returns the annotations for a specific client ID.
*
* @param {Object} state Editor state.
* @param {Object} state Editor state.
* @param {string} clientId The ID of the block to get the annotations for.
*
* @return {Array} The annotations applicable to this block.
Expand Down
Loading