Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW committed Oct 1, 2024
1 parent cc20565 commit c6b85be
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
21 changes: 20 additions & 1 deletion docs/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
21 changes: 20 additions & 1 deletion docs/zh-Hans/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))。

0 comments on commit c6b85be

Please sign in to comment.