From baab5296a8ef4c054de3f2cff3e8e15e9ba7306b Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Tue, 30 May 2023 22:54:08 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(package.json):=20add=20lint:md?= =?UTF-8?q?=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a new script to the `package.json` file that uses the `remark` tool to perform markdown linting. The script is designed to check all markdown files in the repository and fix any issues found. The changes include adding a new property to the package.json file and modifying the `lint-staged` property to use the new script for markdown files instead of using `remark-gfm`. --- .remarkrc.js | 9 +++++++++ README.md | 3 +-- package.json | 14 ++++++++++++-- src/ContextMenu/index.tsx | 9 ++------- 4 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 .remarkrc.js diff --git a/.remarkrc.js b/.remarkrc.js new file mode 100644 index 00000000..c10e9c34 --- /dev/null +++ b/.remarkrc.js @@ -0,0 +1,9 @@ +const config = { + plugins: [ + 'remark-preset-lint-recommended', + ['remark-lint-list-item-indent', 'space'], + ['remark-lint-no-literal-urls', false], + ], +}; + +module.exports = config; diff --git a/README.md b/README.md index 4b5eddbb..3340f8d9 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,6 @@ This project is [MIT](./LICENSE) licensed. [profile-url]: https://github.com/lobehub -[issues-url]: https://github.com/lobehub/lobe-ui/issues/new/choose [gitpod-url]: https://gitpod.io/#https://github.com/lobehub/lobe-ui @@ -160,4 +159,4 @@ This project is [MIT](./LICENSE) licensed. [issues-shield]: https://img.shields.io/github/issues/lobehub/lobe-ui.svg?style=flat -[issues-url]: https://img.shields.io/github/issues/lobehub/lobe-ui.svg?style=flat +[issues-url]: https://github.com/lobehub/lobe-ui/issues/new/choose diff --git a/package.json b/package.json index eb02fc36..a01bbe12 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "docs:build": "npm run build:theme && dumi build", "doctor": "father doctor", "lint": "eslint \"{src,tests,packages}/**/*.{js,jsx,ts,tsx}\" --fix", + "lint:md": "remark . -f -q", "prepare": "husky install && npm run setup", "prepublishOnly": "father doctor && npm run build", "prettier": "prettier -c --write \"**/**\"", @@ -51,7 +52,11 @@ "type-check": "tsc -p tsconfig-check.json" }, "lint-staged": { - "*.{md,json}": [ + "*.md": [ + "remark -f -q", + "prettier --write --no-error-on-unmatched-pattern" + ], + "*.json": [ "prettier --write --no-error-on-unmatched-pattern" ], "*.{js,jsx}": [ @@ -88,7 +93,6 @@ "react-layout-kit": "^1", "react-markdown": "^8", "react-rnd": "^10", - "remark-gfm": "^3", "shiki-es": "^0", "styled-components": "beta", "ts-md5": "^1", @@ -131,6 +135,12 @@ "prettier-plugin-packagejson": "^2", "react": "^18", "react-dom": "^18", + "remark": "^14", + "remark-cli": "^11", + "remark-gfm": "^3", + "remark-lint": "^9", + "remark-lint-list-item-indent": "^3", + "remark-preset-lint-recommended": "^6", "semantic-release": "^21", "semantic-release-config-gitmoji": "^1", "stylelint": "^15", diff --git a/src/ContextMenu/index.tsx b/src/ContextMenu/index.tsx index 425a7f63..36cb1c6f 100644 --- a/src/ContextMenu/index.tsx +++ b/src/ContextMenu/index.tsx @@ -62,7 +62,7 @@ const MenuComponent = forwardRef< const parentId = useFloatingParentNodeId(); const isNested = parentId !== null; - const { refs, floatingStyles, context } = useFloating({ + const { refs, context } = useFloating({ nodeId, open: isOpen, onOpenChange: setIsOpen, @@ -278,12 +278,7 @@ const MenuComponent = forwardRef< modal={false} returnFocus={!isNested} > -
+
{items?.map(renderMenuItem)}