javascript - Eslint 正在从终端工作,但在编辑器 UI (VSCode) 中未显示错误
问题描述
我已经按照以下步骤安装了 ESlint: https ://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6
现在,我的 ESlint 正在终端上运行,但错误/警告没有显示在代码窗口中,这是我的项目结构及其外观:
和我的eslintrc
配置:
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
},
extends: [
'airbnb-base',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaVersion: 2018,
},
rules: {
},
};
为什么它不能在编辑器中显示错误?
解决方案
我最近遇到了这个问题,并通过将我的.eslintrc.js
文件更改为只是.eslintrc
(仅限 JSON 对象,无注释,所有引用正确,无扩展名)来修复它。重新启动 VSCode 后,它正确拾取文件并在 VSCode 中给了我 linter 错误。
推荐阅读
- elasticsearch - Logstash:删除给定名称的所有节点,在 json 的任何位置
- apache-kafka - 卡夫卡消息没有被消费
- git - 展平 git 历史记录但保留来自 HEAD 的提交
- angularjs - 找不到入口模块中的错误:错误:无法解析“./src”
- swift - 从 firebase 数据库查询数据时的奇怪行为
- angularjs - 如何从angularjs中的多个控制器获取数据
- jmeter - 运行 jmeter 以加载测试 vaadin 13 应用程序正在返回会话过期元
- javascript - OnTick 有什么解决方案吗?
- javascript - 在D3中计算弧的长度
- ansible - 在ansible中附加目录和列表