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

Td/class syntax #21325

Draft
wants to merge 12 commits into
base: trunk
Choose a base branch
from
Prev Previous commit
Next Next commit
Code scouting fixes
  • Loading branch information
mhkuu committed Apr 17, 2024
commit 65616ad81e7572c989832b95699cd70a772b874f
15 changes: 7 additions & 8 deletions packages/yoastseo/src/scoring/renderers/AssessorPresenter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable tree-shaking/no-side-effects-in-initialization */
import { __ } from "@wordpress/i18n";
import { difference, forEach, isNumber, isObject, isUndefined } from "lodash-es";
import { assessmentPresenterResult as template } from "../../snippetPreview/templates.js";
Expand Down Expand Up @@ -158,7 +157,7 @@ class AssessorPresenter {
}

/**
* Excludes items from the results that are present in the exclude array.
* Excludes items from the results that are present in the `exclude` array.
*
* @param {Array} results Array containing the items to filter through.
* @param {Array} exclude Array of results to exclude.
Expand All @@ -169,20 +168,20 @@ class AssessorPresenter {
}

/**
* Sorts results based on their score property and always places items considered to be unsortable, at the top.
* Sorts results based on their score property and always places items considered to be non-sortable, at the top.
*
* @param {Array} results Array containing the results that need to be sorted.
* @returns {Array} Array containing the sorted results.
*/
sort( results ) {
const unsortables = this.getUndefinedScores( results );
const sortables = this.excludeFromResults( results, unsortables );
const nonSortables = this.getUndefinedScores( results );
const sortables = this.excludeFromResults( results, nonSortables );

sortables.sort( function( a, b ) {
return a.score - b.score;
} );

return unsortables.concat( sortables );
return nonSortables.concat( sortables );
}

/**
Expand All @@ -200,7 +199,7 @@ class AssessorPresenter {
/**
* Creates a rating object based on the item that is being passed.
*
* @param {AssessmentResult} item The item to check and create a rating object from.
* @param {Object} item The item to check and create a rating object from.
* @returns {Object} Object containing a parsed item, including a colored indicator.
*/
addRating( item ) {
Expand Down Expand Up @@ -311,7 +310,7 @@ class AssessorPresenter {
/**
* Adds event handlers to the mark buttons
*
* @param {Array} scores The list of rendered scores.
* @param {Object} scores The list of rendered scores.
*
* @returns {void}
*/
Expand Down
10 changes: 4 additions & 6 deletions packages/yoastseo/src/values/AssessmentResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import Mark from "./Mark";
*
* @returns {Array} A list of empty marks.
*/
const emptyMarker = function() {
return [];
};
const emptyMarker = () => [];

/**
* Represents the assessment result.
Expand Down Expand Up @@ -172,12 +170,12 @@ class AssessmentResult {
}

/**
* Returns whether or not this result has a marker that can be used to mark for a given Paper
* Returns whether this result has a marker that can be used to mark for a given Paper.
*
* @returns {boolean} Whether or this result has a marker.
* @returns {boolean} Whether this result has a marker.
*/
hasMarker() {
return this._hasMarks && this._marker !== this.emptyMarker;
return this._hasMarks && this._marker !== emptyMarker;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/yoastseo/src/values/Mark.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Mark {
/**
* Returns the position information.
*
* @returns {number} The position information.
* @returns {Object} The position information.
*/
getPosition() {
return this._properties.position;
Expand Down
4 changes: 2 additions & 2 deletions packages/yoastseo/src/values/Paper.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Paper {
attributes.slug = attributes.url || attributes.slug;
}

const onlyLetters = attributes.keyword.replace( /[‘’“”"'.?!:;,¿¡«»&*@#±^%|~`[\](){}⟨⟩<>/\\–\-\u2014\u00d7\u002b\u0026\s]/g, "" );
const onlyLetters = attributes.keyword.replace( /[‘’“”"'.?!:;,¿¡«»&*@#±^%|~`[\](){}⟨⟩<>/\\–\-\u2014\u00d7\u002b\s]/g, "" );

if ( isEmpty( onlyLetters ) ) {
attributes.keyword = defaultAttributes.keyword;
Expand Down Expand Up @@ -181,7 +181,7 @@ class Paper {

/**
* Returns the title width in pixels, or an empty string of no title width in pixels is available.
* @returns {string} Returns the title
* @returns {number} Returns the title
*/
getTitleWidth() {
return this._attributes.titleWidth;
Expand Down