app/javascript/components/UI/rich-text/rich-text.js
RichText
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class RichText {
static filtrationById = ( separatorArr, mainArr ) => {
if ( !separatorArr?.length ) {return mainArr}
return mainArr.filter(item=> !separatorArr.some(({ id }) => id === item.id))
Consider simplifying this complex logical expression. Open
Open
if (str[cursorPosition] === "&" && str[cursorPosition + 1] === "n" && str[cursorPosition + 2] === "b"
&& str[cursorPosition + 3] === "s" && str[cursorPosition + 4] === "p" && str[cursorPosition + 5] === ";") {
str = str.slice(0, cursorPosition) + str.slice(cursorPosition + 6);
} else {
str = str.slice(0, cursorPosition) + str.slice(cursorPosition + 1);
Avoid too many return
statements within this function. Open
Open
return 0;