Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
12joan committed Dec 22, 2023
1 parent 5fda61f commit 775ca92
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import { ToolbarButton } from './toolbar';
export function TableDropdownMenu(props: DropdownMenuProps) {
const editor = useEditorRef();

// eslint-disable-next-line @typescript-eslint/no-shadow
const tableSelected = useEditorSelector(
// eslint-disable-next-line @typescript-eslint/no-shadow
(editor) => someNode(editor, { match: { type: ELEMENT_TABLE } }),
[]
);
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/registry/default/plate-ui/table-element.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ const TableFloatingToolbar = React.forwardRef<
const selected = useSelected();
const editor = useEditorRef();

// eslint-disable-next-line @typescript-eslint/no-shadow
const selectionCollapsed = useEditorSelector(
// eslint-disable-next-line @typescript-eslint/no-shadow
(editor) => !isSelectionExpanded(editor),
[]
);
Expand Down
44 changes: 21 additions & 23 deletions packages/comments/src/stores/comments/CommentsProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
createAtomStore,
getNodeString,
Expand Down Expand Up @@ -37,31 +36,30 @@ export interface CommentsStoreState {
focusTextarea: boolean;

onCommentAdd: ((value: WithPartial<TComment, 'userId'>) => void) | null;
onCommentUpdate: ((value: Pick<TComment, 'id'> & Partial<Omit<TComment, 'id'>>) => void) | null;
onCommentUpdate:
| ((value: Pick<TComment, 'id'> & Partial<Omit<TComment, 'id'>>) => void)
| null;
onCommentDelete: ((id: string) => void) | null;
}

export const {
commentsStore,
useCommentsStore,
CommentsProvider,
} = createAtomStore(
{
myUserId: null,
users: {},
comments: {},
activeCommentId: null,
addingCommentId: null,
newValue: [{ type: 'p', children: [{ text: '' }] }],
focusTextarea: false,
onCommentAdd: null,
onCommentUpdate: null,
onCommentDelete: null,
} as CommentsStoreState,
{
name: 'comments',
}
);
export const { commentsStore, useCommentsStore, CommentsProvider } =
createAtomStore(
{
myUserId: null,
users: {},
comments: {},
activeCommentId: null,
addingCommentId: null,
newValue: [{ type: 'p', children: [{ text: '' }] }],
focusTextarea: false,
onCommentAdd: null,
onCommentUpdate: null,
onCommentDelete: null,
} as CommentsStoreState,
{
name: 'comments',
}
);

export const useCommentsStates = () => useCommentsStore().use;
export const useCommentsSelectors = () => useCommentsStore().get;
Expand Down
7 changes: 4 additions & 3 deletions packages/list/src/hooks/useListToolbarButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import {
import { ELEMENT_UL, toggleList } from '../index';

export const useListToolbarButtonState = ({ nodeType = ELEMENT_UL } = {}) => {
const pressed = useEditorSelector((editor) =>
!!editor.selection &&
someNode(editor, { match: { type: getPluginType(editor, nodeType) } }),
const pressed = useEditorSelector(
(editor) =>
!!editor.selection &&
someNode(editor, { match: { type: getPluginType(editor, nodeType) } }),
[nodeType]
);

Expand Down

0 comments on commit 775ca92

Please sign in to comment.