chore: Add eslint rule for no-shadow (#6658)
* chore: Add eslint rule for no-shadow * fix
This commit is contained in:
@@ -84,7 +84,7 @@ export default function useDragResize(props: Props): ReturnValue {
|
||||
};
|
||||
|
||||
const handlePointerDown =
|
||||
(dragging: "left" | "right") =>
|
||||
(dragDirection: "left" | "right") =>
|
||||
(event: React.PointerEvent<HTMLDivElement>) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -93,7 +93,7 @@ export default function useDragResize(props: Props): ReturnValue {
|
||||
height: size.height,
|
||||
});
|
||||
setOffset(event.pageX);
|
||||
setDragging(dragging);
|
||||
setDragging(dragDirection);
|
||||
};
|
||||
|
||||
React.useEffect(() => {
|
||||
|
||||
@@ -134,7 +134,7 @@ export default class ExtensionManager {
|
||||
plugins,
|
||||
}: {
|
||||
schema: Schema;
|
||||
rules?: Record<string, any>;
|
||||
rules?: markdownit.Options;
|
||||
plugins?: PluginSimple[];
|
||||
}): MarkdownParser {
|
||||
const tokens = this.extensions
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import markdownit, { PluginSimple } from "markdown-it";
|
||||
|
||||
export default function rules({
|
||||
export default function makeRules({
|
||||
rules = {},
|
||||
plugins = [],
|
||||
}: {
|
||||
rules?: Record<string, any>;
|
||||
rules?: markdownit.Options;
|
||||
plugins?: PluginSimple[];
|
||||
}) {
|
||||
const markdownIt = markdownit("default", {
|
||||
|
||||
@@ -221,7 +221,7 @@ export class MarkdownSerializerState {
|
||||
})
|
||||
) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
||||
const [_, lead, inner, trail] = /^(\s*)(.*?)(\s*)$/m.exec(node.text);
|
||||
const [, lead, inner, trail] = /^(\s*)(.*?)(\s*)$/m.exec(node.text);
|
||||
leading += lead;
|
||||
trailing = trail;
|
||||
if (lead || trail) {
|
||||
@@ -366,20 +366,20 @@ export class MarkdownSerializerState {
|
||||
row.forEach((cell, _, j) => {
|
||||
this.out += j === 0 ? "| " : " | ";
|
||||
|
||||
cell.forEach((node) => {
|
||||
cell.forEach((cellNode) => {
|
||||
// just padding the output so that empty cells take up the same space
|
||||
// as headings.
|
||||
// TODO: Ideally we'd calc the longest cell length and use that
|
||||
// to pad all the others.
|
||||
if (
|
||||
node.textContent === "" &&
|
||||
node.content.size === 0 &&
|
||||
node.type.name === "paragraph"
|
||||
cellNode.textContent === "" &&
|
||||
cellNode.content.size === 0 &&
|
||||
cellNode.type.name === "paragraph"
|
||||
) {
|
||||
this.out += " ";
|
||||
} else {
|
||||
this.closed = false;
|
||||
this.render(node, row, j);
|
||||
this.render(cellNode, row, j);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ export class SuggestionsMenuPlugin extends Plugin {
|
||||
// timeout ensures that the delete has been handled by prosemirror
|
||||
// and any characters removed, before we evaluate the rule.
|
||||
setTimeout(() => {
|
||||
const { pos } = view.state.selection.$from;
|
||||
const { pos: fromPos } = view.state.selection.$from;
|
||||
return this.execute(
|
||||
view,
|
||||
pos,
|
||||
pos,
|
||||
fromPos,
|
||||
fromPos,
|
||||
options.openRegex,
|
||||
action((_, match) => {
|
||||
if (match) {
|
||||
|
||||
@@ -11,7 +11,6 @@ function isHardbreak(token: Token) {
|
||||
export default function markdownBreakToParagraphs(md: MarkdownIt) {
|
||||
// insert a new rule after the "inline" rules are parsed
|
||||
md.core.ruler.after("inline", "breaks", (state) => {
|
||||
const { Token } = state;
|
||||
const tokens = state.tokens;
|
||||
|
||||
// work backwards through the tokens and find text that looks like a br
|
||||
@@ -30,8 +29,8 @@ export default function markdownBreakToParagraphs(md: MarkdownIt) {
|
||||
count++;
|
||||
}
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
const isLast = i === count - 1;
|
||||
for (let j = 0; j < count; j++) {
|
||||
const isLast = j === count - 1;
|
||||
|
||||
token = new Token("paragraph_open", "p", 1);
|
||||
nodes.push(token);
|
||||
|
||||
@@ -56,9 +56,9 @@ export default function markdownItCheckbox(md: MarkdownIt): void {
|
||||
|
||||
// work backwards through the tokens and find text that looks like a checkbox
|
||||
for (let i = tokens.length - 1; i > 0; i--) {
|
||||
const matches = looksLikeChecklist(tokens, i);
|
||||
if (matches) {
|
||||
const value = matches[1];
|
||||
const matchesChecklist = looksLikeChecklist(tokens, i);
|
||||
if (matchesChecklist) {
|
||||
const value = matchesChecklist[1];
|
||||
const checked = value.toLowerCase() === "x";
|
||||
|
||||
// convert surrounding list tokens
|
||||
|
||||
@@ -218,9 +218,9 @@ export enum NotificationChannelType {
|
||||
}
|
||||
|
||||
export type NotificationSettings = {
|
||||
[key in NotificationEventType]?:
|
||||
[event in NotificationEventType]?:
|
||||
| {
|
||||
[key in NotificationChannelType]?: boolean;
|
||||
[type in NotificationChannelType]?: boolean;
|
||||
}
|
||||
| boolean;
|
||||
};
|
||||
|
||||
@@ -35,14 +35,14 @@ export default class ProsemirrorHelper {
|
||||
* @param schema The schema to use.
|
||||
* @returns The document content as plain text without formatting.
|
||||
*/
|
||||
static toPlainText(node: Node, schema: Schema) {
|
||||
static toPlainText(root: Node, schema: Schema) {
|
||||
const textSerializers = Object.fromEntries(
|
||||
Object.entries(schema.nodes)
|
||||
.filter(([, node]) => node.spec.toPlainText)
|
||||
.map(([name, node]) => [name, node.spec.toPlainText])
|
||||
);
|
||||
|
||||
return textBetween(node, 0, node.content.size, textSerializers);
|
||||
return textBetween(root, 0, root.content.size, textSerializers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -121,8 +121,8 @@ export function unicodeCLDRtoISO639(locale: string) {
|
||||
*
|
||||
* @returns The current date
|
||||
*/
|
||||
export function getCurrentDateAsString(locales?: Intl.LocalesArgument) {
|
||||
return new Date().toLocaleDateString(locales, {
|
||||
export function getCurrentDateAsString(locale?: Intl.LocalesArgument) {
|
||||
return new Date().toLocaleDateString(locale, {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
@@ -134,8 +134,8 @@ export function getCurrentDateAsString(locales?: Intl.LocalesArgument) {
|
||||
*
|
||||
* @returns The current time
|
||||
*/
|
||||
export function getCurrentTimeAsString(locales?: Intl.LocalesArgument) {
|
||||
return new Date().toLocaleTimeString(locales, {
|
||||
export function getCurrentTimeAsString(locale?: Intl.LocalesArgument) {
|
||||
return new Date().toLocaleTimeString(locale, {
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
});
|
||||
@@ -147,8 +147,8 @@ export function getCurrentTimeAsString(locales?: Intl.LocalesArgument) {
|
||||
*
|
||||
* @returns The current date and time
|
||||
*/
|
||||
export function getCurrentDateTimeAsString(locales?: Intl.LocalesArgument) {
|
||||
return new Date().toLocaleString(locales, {
|
||||
export function getCurrentDateTimeAsString(locale?: Intl.LocalesArgument) {
|
||||
return new Date().toLocaleString(locale, {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
|
||||
@@ -44,8 +44,8 @@ export function getDataTransferFiles(
|
||||
return dt.items
|
||||
? Array.prototype.slice
|
||||
.call(dt.items)
|
||||
.filter((dt: DataTransferItem) => dt.kind !== "string")
|
||||
.map((dt: DataTransferItem) => dt.getAsFile())
|
||||
.filter((dti: DataTransferItem) => dti.kind !== "string")
|
||||
.map((dti: DataTransferItem) => dti.getAsFile())
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user