ESLint 的 ignore 文件到底该怎么写才生效?

书生シ巧丽 阅读 35

我在项目根目录加了 .eslintignore,想忽略 dist 目录,但 ESLint 还是报错。我写的是 dist/,也试过 dist/**,都不行,是不是格式写错了?

我的 .eslintignore 内容如下:

dist/
node_modules/
我来解答 赞 6 收藏
二维码
手机扫码查看
1 条解答
司马诗诗
dist/ 改成 dist/*,然后运行 eslint --no-cache 清除缓存试试。

或者直接用 npx eslint --ignore-path .eslintignore . 明确指定 ignore 文件。
点赞
2026-03-17 09:01