fix: lint (#7433)
* chore: fix lint * fix: constants check:lint command * chore(lint): permit unused vars which begin w/ _ * chore: rm dead code * fix(lint): more lint fixes to constants pkg * fix(lint): lint the live server - fix lint issues * chore: improve clean script * fix(lint): more lint * chore: set live server process title * chore(deps): update to turbo@2.5.5 * chore(live): target node22 * fix(dev): add missing ui pkg dependency * fix(dev): lint decorators * fix(dev): lint space app * fix(dev): address lint issues in types pkg * fix(dev): lint editor pkg * chore(dev): moar lint * fix(dev): live server exit code * chore: address PR feedback * fix(lint): better TPageExtended type * chore: refactor * chore: revert most live server changes * fix: few more lint issues * chore: enable ci checks Ensure we can build + confirm that lint is not getting worse. * chore: address PR feedback * fix: web lint warning added to package.json * fix: ci:lint command --------- Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
parent
514686d9d5
commit
57479f4554
95 changed files with 348 additions and 460 deletions
|
|
@ -24,7 +24,7 @@
|
|||
"scripts": {
|
||||
"build": "tsc && tsup --minify",
|
||||
"dev": "tsup --watch",
|
||||
"check:lint": "eslint . --max-warnings 0",
|
||||
"check:lint": "eslint . --max-warnings 30",
|
||||
"check:types": "tsc --noEmit",
|
||||
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
|
||||
"fix:lint": "eslint . --fix",
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ interface EditorContentProps {
|
|||
}
|
||||
|
||||
export const EditorContentWrapper: FC<EditorContentProps> = (props) => {
|
||||
const { editor, children, id, tabIndex } = props;
|
||||
const { editor, children, tabIndex, id } = props;
|
||||
|
||||
return (
|
||||
<div tabIndex={tabIndex} onFocus={() => editor?.chain().focus(undefined, { scrollIntoView: false }).run()}>
|
||||
<EditorContent editor={editor} />
|
||||
<EditorContent editor={editor} id={id} />
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@ export const LinkEditView = ({ viewProps }: LinkEditViewProps) => {
|
|||
const [linkRemoved, setLinkRemoved] = useState(false);
|
||||
const hasSubmitted = useRef(false);
|
||||
|
||||
const removeLink = useCallback(() => {
|
||||
editor.view.dispatch(editor.state.tr.removeMark(from, to, editor.schema.marks.link));
|
||||
setLinkRemoved(true);
|
||||
closeLinkView();
|
||||
}, [editor, from, to, closeLinkView]);
|
||||
|
||||
// Effects
|
||||
useEffect(
|
||||
() =>
|
||||
|
|
@ -56,7 +62,7 @@ export const LinkEditView = ({ viewProps }: LinkEditViewProps) => {
|
|||
}
|
||||
}
|
||||
},
|
||||
[linkRemoved, initialUrl]
|
||||
[removeLink, linkRemoved, initialUrl]
|
||||
);
|
||||
|
||||
// Sync state with props
|
||||
|
|
@ -105,13 +111,7 @@ export const LinkEditView = ({ viewProps }: LinkEditViewProps) => {
|
|||
}
|
||||
|
||||
return true;
|
||||
}, [editor, from, to, initialText, localText, localUrl]);
|
||||
|
||||
const removeLink = useCallback(() => {
|
||||
editor.view.dispatch(editor.state.tr.removeMark(from, to, editor.schema.marks.link));
|
||||
setLinkRemoved(true);
|
||||
closeLinkView();
|
||||
}, [editor, from, to, closeLinkView]);
|
||||
}, [linkRemoved, positionRef, editor, from, to, initialText, localText, localUrl]);
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent) => {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const LinkView = (props: LinkViewProps & { style: CSSProperties }) => {
|
|||
setCurrentView("LinkPreview");
|
||||
setPrevFrom(props.from);
|
||||
}
|
||||
}, []);
|
||||
}, [prevFrom, props.from]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -118,18 +118,18 @@ export function LowlightPlugin({
|
|||
transaction.steps.some(
|
||||
(step) =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
step.from !== undefined &&
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
step.to !== undefined &&
|
||||
oldNodes.some(
|
||||
(node) =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
node.pos >= step.from &&
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
node.pos + node.node.nodeSize <= step.to
|
||||
)
|
||||
))
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export const ImageUploadStatus: React.FC<Props> = (props) => {
|
|||
cancelAnimationFrame(animationFrameRef.current);
|
||||
}
|
||||
};
|
||||
}, [uploadStatus]);
|
||||
}, [displayStatus, uploadStatus]);
|
||||
|
||||
if (uploadStatus === undefined) return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ import { ReactRenderer } from "@tiptap/react";
|
|||
import { SuggestionOptions } from "@tiptap/suggestion";
|
||||
import tippy, { Instance } from "tippy.js";
|
||||
// helpers
|
||||
import { CORE_EXTENSIONS } from "@/constants/extension";
|
||||
import { getExtensionStorage } from "@/helpers/get-extension-storage";
|
||||
import { CommandListInstance } from "@/helpers/tippy";
|
||||
// types
|
||||
import { TMentionHandler } from "@/types";
|
||||
// local components
|
||||
import { MentionsListDropdown, MentionsListDropdownProps } from "./mentions-list-dropdown";
|
||||
import { getExtensionStorage } from "@/helpers/get-extension-storage";
|
||||
import { CORE_EXTENSIONS } from "@/constants/extension";
|
||||
|
||||
export const renderMentionsDropdown =
|
||||
(props: Pick<TMentionHandler, "searchCallback">): SuggestionOptions["render"] =>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export function tableControls() {
|
|||
},
|
||||
},
|
||||
props: {
|
||||
handleTripleClickOn(view, pos, node, nodePos, event, direct) {
|
||||
handleTripleClickOn(view, pos, node, nodePos, event) {
|
||||
if (node.type.name === CORE_EXTENSIONS.TABLE_CELL) {
|
||||
event.preventDefault();
|
||||
const $pos = view.state.doc.resolve(pos);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@ import { Decoration, NodeView } from "@tiptap/pm/view";
|
|||
import { h } from "jsx-dom-cjs";
|
||||
import { icons } from "src/core/extensions/table/table/icons";
|
||||
import tippy, { Instance, Props } from "tippy.js";
|
||||
// constants
|
||||
import { CORE_EXTENSIONS } from "@/constants/extension";
|
||||
// local imports
|
||||
import { isCellSelection } from "./utilities/helpers";
|
||||
|
||||
type ToolboxItem = {
|
||||
|
|
@ -148,7 +146,7 @@ const columnsToolboxItems: ToolboxItem[] = [
|
|||
{
|
||||
label: "Pick color",
|
||||
icon: "", // No icon needed for color picker
|
||||
action: (args: any) => {}, // Placeholder action; actual color picking is handled in `createToolbox`
|
||||
action: (_args: unknown) => { }, // Placeholder action; actual color picking is handled in `createToolbox`
|
||||
},
|
||||
{
|
||||
label: "Delete column",
|
||||
|
|
@ -176,7 +174,7 @@ const rowsToolboxItems: ToolboxItem[] = [
|
|||
{
|
||||
label: "Pick color",
|
||||
icon: "",
|
||||
action: (args: any) => {}, // Placeholder action; actual color picking is handled in `createToolbox`
|
||||
action: (_args: unknown) => { }, // Placeholder action; actual color picking is handled in `createToolbox`
|
||||
},
|
||||
{
|
||||
label: "Delete row",
|
||||
|
|
@ -217,7 +215,7 @@ function createToolbox({
|
|||
h(
|
||||
"div",
|
||||
{ className: "grid grid-cols-6 gap-x-1 gap-y-2.5 mt-2" },
|
||||
Object.entries(colors).map(([colorName, colorValue]) =>
|
||||
Object.entries(colors).map(([_, colorValue]) =>
|
||||
h("div", {
|
||||
className: "grid place-items-center size-6 rounded cursor-pointer",
|
||||
style: `background-color: ${colorValue.backgroundColor};color: ${colorValue.textColor || "inherit"};`,
|
||||
|
|
|
|||
|
|
@ -32,8 +32,11 @@ function scrollToNode(editor: Editor, pos: number): void {
|
|||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
export function scrollToNodeViaDOMCoordinates(editor: Editor, pos: number, behavior?: ScrollBehavior): void {
|
||||
export function scrollToNodeViaDOMCoordinates(
|
||||
editor: Editor,
|
||||
pos: number,
|
||||
behavior?: "auto" | "smooth" | "instant"
|
||||
): void {
|
||||
const view = editor.view;
|
||||
|
||||
// Get the coordinates of the position
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ export const useEditor = (props: TEditorHookProps) => {
|
|||
Y.applyUpdate(document, value);
|
||||
},
|
||||
}),
|
||||
[editor]
|
||||
[editor, provider]
|
||||
);
|
||||
|
||||
if (!editor) {
|
||||
|
|
|
|||
|
|
@ -111,8 +111,7 @@ export interface EditorRefApi extends EditorReadOnlyRefApi {
|
|||
onDocumentInfoChange: (callback: (documentInfo: TDocumentInfo) => void) => () => void;
|
||||
onHeadingChange: (callback: (headings: IMarking[]) => void) => () => void;
|
||||
onStateChange: (callback: () => void) => () => void;
|
||||
// eslint-disable-next-line no-undef
|
||||
scrollToNodeViaDOMCoordinates: (behavior?: ScrollBehavior, position?: number) => void;
|
||||
scrollToNodeViaDOMCoordinates: (behavior?: "auto" | "smooth" | "instant", position?: number) => void;
|
||||
setEditorValueAtCursorPosition: (content: string) => void;
|
||||
setFocusAtPosition: (position: number) => void;
|
||||
setProviderDocument: (value: Uint8Array) => void;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// plane types
|
||||
import { IUserLite, TSearchEntities } from "@plane/types";
|
||||
import { TSearchEntities } from "@plane/types";
|
||||
|
||||
export type TMentionSuggestion = {
|
||||
entity_identifier: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { CSSProperties } from "react";
|
||||
import { Editor, Range } from "@tiptap/core";
|
||||
import { CSSProperties } from "react";
|
||||
// types
|
||||
import { TEditorCommands } from "@/types";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const sharedConfig = require("@plane/tailwind-config/tailwind.config.js");
|
||||
import sharedConfig from "@plane/tailwind-config/tailwind.config.js";
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
// prefix ui lib classes to avoid conflicting with the app
|
||||
...sharedConfig,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue