From c6b85be69bad63ebb58e114c4409093a5493c8ae Mon Sep 17 00:00:00 2001 From: Rui Wu Date: Tue, 1 Oct 2024 18:14:12 +0800 Subject: [PATCH] docs: update --- docs/guide/faq.md | 21 ++++++++++++++++++++- docs/zh-Hans/guide/faq.md | 21 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/guide/faq.md b/docs/guide/faq.md index 380c097..3775f09 100644 --- a/docs/guide/faq.md +++ b/docs/guide/faq.md @@ -14,8 +14,27 @@ If you really want to check errors and warnings, try enable `lintInWorker` optio ## Cache is broken? -You can disable `cache` option, or delete the cache, fix errors manully and restart Vite. +Delete the cache file, fix the error manually and restart Vite. ## Plugin is running very slow? By default, the plugin is synchronous, which may cause blocking. Please try to enable `lintInWorker` option, which keeps Vite speed and prints in console. You can also try [@nabla/vite-plugin-eslint](https://github.com/nabla/vite-plugin-eslint) and [vite-plugin-checker](https://github.com/fi3ework/vite-plugin-checker), or run ESLint directly besides Vite. + +## Recommended configuration? + +```ts +import { defineConfig } from "vite"; +import eslint from "vite-plugin-eslint2"; + +export default defineConfig({ + plugins: [eslint({ + lintInWorker: true, + lintOnStart: true, + })], +}); + +``` + +## Error messages in full red? + +Vite's error mask layer does not support displaying `PluginContext.warn` information and full-color messages, and there are some limitations (see [#2076](https://github.com/vitejs/vite/issues/2076), [#6274](https://github.com/vitejs/vite/pull/6274) and [#8327](https://github.com/vitejs/vite/discussions/8327). diff --git a/docs/zh-Hans/guide/faq.md b/docs/zh-Hans/guide/faq.md index 238aee1..abaceaa 100644 --- a/docs/zh-Hans/guide/faq.md +++ b/docs/zh-Hans/guide/faq.md @@ -14,8 +14,27 @@ ## 缓存失效了? -你可以禁用 `cache` 选项,或者删除缓存文件,手动修复错误后重启 Vite。 +删除缓存文件,手动修复错误后重启 Vite 即可。 ## 插件运行非常慢? 默认地,插件是同步运行的,这可能会造成阻塞。请尝试启用 `lintInWorker` 选项,它保持了 Vite 的速度,并在控制台中打印信息。你也可以尝试一下社区内的 [@nabla/vite-plugin-eslint](https://github.com/nabla/vite-plugin-eslint) 和 [vite-plugin-checker](https://github.com/fi3ework/vite-plugin-checker),或者在 Vite 之外直接运行 ESLint。 + +## 推荐配置? + +```ts +import { defineConfig } from "vite"; +import eslint from "vite-plugin-eslint2"; + +export default defineConfig({ + plugins: [eslint({ + lintInWorker: true, + lintOnStart: true, + })], +}); + +``` + +## 错误信息全红? + +Vite 的错误遮罩层不支持显示 `PluginContext.warn` 信息和全色消息,还有一些限制(参见 [#2076](https://github.com/vitejs/vite/issues/2076)、[#6274](https://github.com/vitejs/vite/pull/6274) 和 [#8327](https://github.com/vitejs/vite/discussions/8327))。