From c3be24dcb12b250e81602378b7d48ed35b3c8923 Mon Sep 17 00:00:00 2001 From: robertu <4065233+robertu7@users.noreply.github.com> Date: Fri, 8 Mar 2024 23:05:58 +0800 Subject: [PATCH] fix: lint errors --- .husky/pre-commit | 2 +- package.json | 5 +++-- src/editors/Article.tsx | 2 +- src/editors/Comment.tsx | 2 +- src/transformers/md2html.ts | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 72c4429..fcaddb4 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npm test +npm run lint && npm test diff --git a/package.json b/package.json index 21f248e..750bb11 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,9 @@ "build:demo": "rollup --config demo/rollup.config.js --bundleConfigAsCjs", "post:build": "node --loader ts-node/esm --experimental-specifier-resolution=node ./bin/post-build.js", "build:examples": "node --loader ts-node/esm --experimental-specifier-resolution=node ./bin/build-examples.ts", - "format": "prettier --write \"{src,}/**/*.{ts,tsx,json}\"", - "lint": "tsc && eslint ./src --ext .ts --quiet", + "format": "prettier --write \"{src,}/**/*.{ts,tsx,json,tsx}\"", + "lint": "tsc && eslint ./src --ext .ts,.tsx --quiet", + "lint:fix": "eslint ./src --ext .ts,.tsx --fix", "test": "vitest --run", "prepare": "husky", "demo:transformers": "npm run build:demo && http-server ./demo", diff --git a/src/editors/Article.tsx b/src/editors/Article.tsx index 89ab04f..3c481df 100644 --- a/src/editors/Article.tsx +++ b/src/editors/Article.tsx @@ -21,7 +21,7 @@ export const useArticleEdtor = ({ const editor = useEditor({ extensions: [ ...makeArticleEditorExtensions({ placeholder, mentionSuggestion }), - ...(extensions || []), + ...(extensions ?? []), ], content, ...restProps, diff --git a/src/editors/Comment.tsx b/src/editors/Comment.tsx index a28895f..fa4e3ae 100644 --- a/src/editors/Comment.tsx +++ b/src/editors/Comment.tsx @@ -20,7 +20,7 @@ export const useCommentEditor = ({ const editor = useEditor({ extensions: [ ...makeCommentEditorExtensions({ placeholder, mentionSuggestion }), - ...(extensions || []), + ...(extensions ?? []), ], content, ...restProps, diff --git a/src/transformers/md2html.ts b/src/transformers/md2html.ts index 467b1a8..fd53616 100644 --- a/src/transformers/md2html.ts +++ b/src/transformers/md2html.ts @@ -1,3 +1,4 @@ +import rehypeExternalLinks from 'rehype-external-links' import rehypeFormat from 'rehype-format' import rehypeRaw from 'rehype-raw' import rehypeRewrite from 'rehype-rewrite' @@ -9,7 +10,6 @@ import remarkDirectiveRehype from 'remark-directive-rehype' import remarkParse from 'remark-parse' import remarkRehype from 'remark-rehype' import { unified } from 'unified' -import rehypeExternalLinks from 'rehype-external-links' import { rehypeRewriteOptions,