fix: tsc and lint check

This commit is contained in:
RizqiSyahrendra 2025-02-05 17:43:24 +07:00
parent f4e6e610bd
commit 147f7242aa
8 changed files with 63 additions and 80 deletions

View File

@ -1,6 +1,3 @@
import BlogComments from "@/components/Blogs/BlogComments";
import BlogWidget from "@/components/Blogs/BlogWidget";
import CommentForm from "@/components/CommentForm";
import { fetchBlogDetail } from "@/services/payload/blog"; import { fetchBlogDetail } from "@/services/payload/blog";
import { RichText } from "@payloadcms/richtext-lexical/react"; import { RichText } from "@payloadcms/richtext-lexical/react";
import { Metadata } from "next"; import { Metadata } from "next";

View File

@ -1,8 +1,8 @@
// @ts-nocheck // @ts-nocheck
//This copy-and-pasted from lexical here here: https://github.com/facebook/lexical/blob/c2ceee223f46543d12c574e62155e619f9a18a5d/packages/lexical/src/LexicalConstants.ts //This copy-and-pasted from lexical here here: https://github.com/facebook/lexical/blob/c2ceee223f46543d12c574e62155e619f9a18a5d/packages/lexical/src/LexicalConstants.ts
import type { ElementFormatType, TextFormatType } from '@payloadcms/richtext-lexical/lexical' import type { ElementFormatType, TextFormatType } from "@payloadcms/richtext-lexical/lexical";
import type { TextDetailType, TextModeType } from 'lexical/nodes/LexicalTextNode' import type { TextDetailType, TextModeType } from "lexical/nodes/LexicalTextNode";
/** /**
* Copyright (c) Meta Platforms, Inc. and affiliates. * Copyright (c) Meta Platforms, Inc. and affiliates.
@ -13,71 +13,63 @@ import type { TextDetailType, TextModeType } from 'lexical/nodes/LexicalTextNode
*/ */
// DOM // DOM
export const DOM_ELEMENT_TYPE = 1 export const DOM_ELEMENT_TYPE = 1;
export const DOM_TEXT_TYPE = 3 export const DOM_TEXT_TYPE = 3;
// Reconciling // Reconciling
export const NO_DIRTY_NODES = 0 export const NO_DIRTY_NODES = 0;
export const HAS_DIRTY_NODES = 1 export const HAS_DIRTY_NODES = 1;
export const FULL_RECONCILE = 2 export const FULL_RECONCILE = 2;
// Text node modes // Text node modes
export const IS_NORMAL = 0 export const IS_NORMAL = 0;
export const IS_TOKEN = 1 export const IS_TOKEN = 1;
export const IS_SEGMENTED = 2 export const IS_SEGMENTED = 2;
// IS_INERT = 3 // IS_INERT = 3
// Text node formatting // Text node formatting
export const IS_BOLD = 1 export const IS_BOLD = 1;
export const IS_ITALIC = 1 << 1 export const IS_ITALIC = 1 << 1;
export const IS_STRIKETHROUGH = 1 << 2 export const IS_STRIKETHROUGH = 1 << 2;
export const IS_UNDERLINE = 1 << 3 export const IS_UNDERLINE = 1 << 3;
export const IS_CODE = 1 << 4 export const IS_CODE = 1 << 4;
export const IS_SUBSCRIPT = 1 << 5 export const IS_SUBSCRIPT = 1 << 5;
export const IS_SUPERSCRIPT = 1 << 6 export const IS_SUPERSCRIPT = 1 << 6;
export const IS_HIGHLIGHT = 1 << 7 export const IS_HIGHLIGHT = 1 << 7;
export const IS_ALL_FORMATTING = export const IS_ALL_FORMATTING =
IS_BOLD | IS_BOLD | IS_ITALIC | IS_STRIKETHROUGH | IS_UNDERLINE | IS_CODE | IS_SUBSCRIPT | IS_SUPERSCRIPT | IS_HIGHLIGHT;
IS_ITALIC |
IS_STRIKETHROUGH |
IS_UNDERLINE |
IS_CODE |
IS_SUBSCRIPT |
IS_SUPERSCRIPT |
IS_HIGHLIGHT
// Text node details // Text node details
export const IS_DIRECTIONLESS = 1 export const IS_DIRECTIONLESS = 1;
export const IS_UNMERGEABLE = 1 << 1 export const IS_UNMERGEABLE = 1 << 1;
// Element node formatting // Element node formatting
export const IS_ALIGN_LEFT = 1 export const IS_ALIGN_LEFT = 1;
export const IS_ALIGN_CENTER = 2 export const IS_ALIGN_CENTER = 2;
export const IS_ALIGN_RIGHT = 3 export const IS_ALIGN_RIGHT = 3;
export const IS_ALIGN_JUSTIFY = 4 export const IS_ALIGN_JUSTIFY = 4;
export const IS_ALIGN_START = 5 export const IS_ALIGN_START = 5;
export const IS_ALIGN_END = 6 export const IS_ALIGN_END = 6;
// Reconciliation // Reconciliation
export const NON_BREAKING_SPACE = '\u00A0' export const NON_BREAKING_SPACE = "\u00A0";
const ZERO_WIDTH_SPACE = '\u200b' // const ZERO_WIDTH_SPACE = '\u200b'
export const DOUBLE_LINE_BREAK = '\n\n' export const DOUBLE_LINE_BREAK = "\n\n";
// For FF, we need to use a non-breaking space, or it gets composition // For FF, we need to use a non-breaking space, or it gets composition
// in a stuck state. // in a stuck state.
const RTL = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC' const RTL = "\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC";
const LTR = const LTR =
'A-Za-z\u00C0-\u00D6\u00D8-\u00F6' + "A-Za-z\u00C0-\u00D6\u00D8-\u00F6" +
'\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C' + "\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C" +
'\uFE00-\uFE6F\uFEFD-\uFFFF' "\uFE00-\uFE6F\uFEFD-\uFFFF";
// eslint-disable-next-line export const RTL_REGEX = new RegExp("^[^" + LTR + "]*[" + RTL + "]");
export const RTL_REGEX = new RegExp('^[^' + LTR + ']*[' + RTL + ']')
// eslint-disable-next-line export const LTR_REGEX = new RegExp("^[^" + RTL + "]*[" + LTR + "]");
export const LTR_REGEX = new RegExp('^[^' + RTL + ']*[' + LTR + ']')
export const TEXT_TYPE_TO_FORMAT: Record<string | TextFormatType, number> = { export const TEXT_TYPE_TO_FORMAT: Record<string | TextFormatType, number> = {
bold: IS_BOLD, bold: IS_BOLD,
@ -88,39 +80,39 @@ export const TEXT_TYPE_TO_FORMAT: Record<string | TextFormatType, number> = {
subscript: IS_SUBSCRIPT, subscript: IS_SUBSCRIPT,
superscript: IS_SUPERSCRIPT, superscript: IS_SUPERSCRIPT,
underline: IS_UNDERLINE, underline: IS_UNDERLINE,
} };
export const DETAIL_TYPE_TO_DETAIL: Record<string | TextDetailType, number> = { export const DETAIL_TYPE_TO_DETAIL: Record<string | TextDetailType, number> = {
directionless: IS_DIRECTIONLESS, directionless: IS_DIRECTIONLESS,
unmergeable: IS_UNMERGEABLE, unmergeable: IS_UNMERGEABLE,
} };
export const ELEMENT_TYPE_TO_FORMAT: Record<Exclude<ElementFormatType, ''>, number> = { export const ELEMENT_TYPE_TO_FORMAT: Record<Exclude<ElementFormatType, "">, number> = {
center: IS_ALIGN_CENTER, center: IS_ALIGN_CENTER,
end: IS_ALIGN_END, end: IS_ALIGN_END,
justify: IS_ALIGN_JUSTIFY, justify: IS_ALIGN_JUSTIFY,
left: IS_ALIGN_LEFT, left: IS_ALIGN_LEFT,
right: IS_ALIGN_RIGHT, right: IS_ALIGN_RIGHT,
start: IS_ALIGN_START, start: IS_ALIGN_START,
} };
export const ELEMENT_FORMAT_TO_TYPE: Record<number, ElementFormatType> = { export const ELEMENT_FORMAT_TO_TYPE: Record<number, ElementFormatType> = {
[IS_ALIGN_CENTER]: 'center', [IS_ALIGN_CENTER]: "center",
[IS_ALIGN_END]: 'end', [IS_ALIGN_END]: "end",
[IS_ALIGN_JUSTIFY]: 'justify', [IS_ALIGN_JUSTIFY]: "justify",
[IS_ALIGN_LEFT]: 'left', [IS_ALIGN_LEFT]: "left",
[IS_ALIGN_RIGHT]: 'right', [IS_ALIGN_RIGHT]: "right",
[IS_ALIGN_START]: 'start', [IS_ALIGN_START]: "start",
} };
export const TEXT_MODE_TO_TYPE: Record<TextModeType, 0 | 1 | 2> = { export const TEXT_MODE_TO_TYPE: Record<TextModeType, 0 | 1 | 2> = {
normal: IS_NORMAL, normal: IS_NORMAL,
segmented: IS_SEGMENTED, segmented: IS_SEGMENTED,
token: IS_TOKEN, token: IS_TOKEN,
} };
export const TEXT_TYPE_TO_MODE: Record<number, TextModeType> = { export const TEXT_TYPE_TO_MODE: Record<number, TextModeType> = {
[IS_NORMAL]: 'normal', [IS_NORMAL]: "normal",
[IS_SEGMENTED]: 'segmented', [IS_SEGMENTED]: "segmented",
[IS_TOKEN]: 'token', [IS_TOKEN]: "token",
} };

View File

@ -142,7 +142,6 @@ export function serializeLexical({ nodes }: Props): JSX.Element {
aria-checked={node.checked ? "true" : "false"} aria-checked={node.checked ? "true" : "false"}
className={` ${node.checked ? "" : ""}`} className={` ${node.checked ? "" : ""}`}
key={index} key={index}
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
role="checkbox" role="checkbox"
tabIndex={-1} tabIndex={-1}
value={node?.value} value={node?.value}

View File

@ -51,10 +51,10 @@ export const FormBlock: React.FC<
const { const {
control, control,
formState: { errors }, formState: { errors },
getValues,
handleSubmit, handleSubmit,
register, register,
setValue, // getValues,
// setValue,
} = formMethods; } = formMethods;
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);

View File

@ -4,10 +4,7 @@ import { categories } from "@/data/categories";
import { tags } from "@/data/tags"; import { tags } from "@/data/tags";
import React from "react"; import React from "react";
export default function BlogWidget({ export default function BlogWidget() {
btnClass = "btn btn-mod btn-color btn-medium btn-round btn-hover-anim form-control",
inputClass = "newsletter-field form-control input-md round mb-10",
}) {
return ( return (
<> <>
<div className="col-sm-6 col-lg-4 mt-60"> <div className="col-sm-6 col-lg-4 mt-60">

View File

@ -1,10 +1,8 @@
"use client"; "use client";
import Nav2 from "@/components/Nav";
import { toggleMobileMenu } from "@/utils/toggleMobileMenu"; import { toggleMobileMenu } from "@/utils/toggleMobileMenu";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import React from "react";
import Nav2 from "@/components/Nav";
import LanguageSelect from "@/components/LanguageSelect";
export default function Header1Multipage({ links }: any) { export default function Header1Multipage({ links }: any) {
return ( return (

View File

@ -2,7 +2,7 @@ const addScrollspy = (defalutClass = "", linksContainer = ".scrollspy-link", act
const section = document.querySelectorAll(".scrollSpysection"); const section = document.querySelectorAll(".scrollSpysection");
const sections = {}; const sections = {};
const i = 0; // const i = 0;
Array.prototype.forEach.call(section, function (e) { Array.prototype.forEach.call(section, function (e) {
// @ts-ignore // @ts-ignore

View File

@ -1,5 +1,5 @@
export const toKebabCase = (string) => export const toKebabCase = (text: string) =>
string text
?.replace(/([a-z])([A-Z])/g, '$1-$2') ?.replace(/([a-z])([A-Z])/g, "$1-$2")
.replace(/\s+/g, '-') .replace(/\s+/g, "-")
.toLowerCase() .toLowerCase();