lint-md / prettier-plugin

基于 lint-md 的 Prettier 格式化插件,让其符合中文编写规范。
https://github.com/lint-md/prettier-plugin
MIT License
3 stars 1 forks source link

import prettierPluginLintMd, { PARSER_NAME } from 'prettier-plugin-lint-md'; 之后报错 #6

Open yanglbme opened 2 weeks ago

yanglbme commented 2 weeks ago

import prettierPluginLintMd, { PARSER_NAME } from 'prettier-plugin-lint-md';

之后,启动项目,报了如下错误,看看是什么问题

node.js:158 Uncaught TypeError: tty.isatty is not a function at Function.useColors (node.js:158:1) at createDebug (common.js:117:1) at ./node_modules/.pnpm/micromark@3.1.0/node_modules/micromark/dev/lib/create-tokenizer.js (create-tokenizer.js:35:15) at webpack_require (bootstrap:19:1) at ./node_modules/.pnpm/micromark@3.1.0/node_modules/micromark/dev/lib/parse.js (text.js:225:1) at webpack_require (bootstrap:19:1) at ./node_modules/.pnpm/mdast-util-from-markdown@1.2.0/node_modules/mdast-util-from-markdown/dev/lib/index.js (index.js:253:1) at webpack_require (bootstrap:19:1) at ./node_modules/.pnpm/remark-parse@10.0.1/node_modules/remark-parse/lib/index.js (index.js:3:16) at webpack_require (bootstrap:19:1)

yanglbme commented 2 weeks ago

https://github.com/doocs/md/pull/371/files

在这里 pr 基础上,加了这个 plugin 就报错

bosens-China commented 2 weeks ago

从相关信息并没有看到是prettier本身的问题,可以创建一个最小的仓库我来调试一下。

yanglbme commented 2 weeks ago

你方便 clone 一下我们主分支的代码吗?我们想在目前的基础上,加上 lint-md

https://github.com/doocs/md/blob/main/src/utils/index.js#L119

bosens-China commented 2 weeks ago

抱歉这块我只能定位当前插件的错误,如果你能复现我可以帮忙解决,但是从上述的看到报错信息,推测大概是由于 create-tokenizer.js、micromark/dev/lib/parse.js等引起的。 另外prettier更多是结合ide而不涉及到webpack的dev和build,所以你需要更明确一下错误来源