简体   繁体   English

在Sublime Text 3上使用babel-eslint时,Linting无法正常工作

[英]Linting not working when using babel-eslint on Sublime Text 3

I am trying to get babel-eslint to work on Sublime 3. I have installed: 我想让babel-eslint在Sublime 3上工作。我已安装:

  • eslint and babel-eslint globally on npm eslint和babel-eslint全球在npm
  • SublimeLinter package on Sublime Sublime上的SublimeLinter包
  • SublimeLinter-contrib-eslint package on Sublime Sublime上的SublimeLinter-contrib-eslint包

Also, I have added: "syntax_map": { ... "JavaScript (Babel)": "javascript" } to my SublimeLinter.sublime-settings file. 另外,我在我的SublimeLinter.sublime-settings文件中添加了: "syntax_map": { ... "JavaScript (Babel)": "javascript" }

When I run the linter with "parser": "espree" on my .eslintrc file it works fine. 当我在我的.eslintrc文件中使用"parser": "espree"运行linter时它工作正常。 But when I change the parser to babel-eslint it stops working. 但是,当我将解析器更改为babel-eslint时,它会停止工作。

I tried to follow the tutorial here: https://medium.com/@dan_abramov/lint-like-it-s-2015-6987d44c5b48 and I seem to be doing everything correctly. 我试着按照这里的教程: https//medium.com/@dan_abramov/lint-like-it-s-2015-6987d44c5b48 ,我似乎正在做正确的事情。

Any ideas on what I'm doing wrong? 关于我做错了什么的任何想法?

Except what was in mentioned tutorial, what helped me was: 除了在提到的教程中,有什么帮助我:

  • upgrade global / local eslint to latest version 将global / local eslint升级到最新版本
  • install babel-eslint locally 在本地安装babel-eslint
  • if you are using any eslint plugins, it appears they must be also installed locally (eslint-plugin-react in my case) 如果你使用任何eslint插件,它似乎也必须在本地安装(eslint-plugin-react在我的情况下)
  • as Dalgard mentioned you can also enable debug mode in Sublime eslint to find out what else can be wrong, ie incompatible versions or corrupted config. 正如Dalgard所提到的,你也可以在Sublime eslint中启用调试模式,找出其他可能出错的地方,即不兼容的版本或损坏的配置。

I hope some of this will help. 我希望其中一些有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用babel-eslint导致错误的空值错误 - Using babel-eslint caused false no-empty error babel-eslint 不允许动态导入 - babel-eslint does not allow dynamic import 在 Windows 10 上全局安装 ESLint + babel-eslint 解析器 - Install ESLint + babel-eslint parser globally on Windows 10 如何在没有配置文件的情况下修复导入/导出babel-eslint? - How to fix import/export babel-eslint without configuration file? 如何让ESLint在Sublime Text 3编辑器中运行React + Babel? - How to get ESLint to work React + Babel in Sublime Text 3 editor? Eslint仅在一个出色的文本项目中工作? - Eslint only working in one sublime text project? 使用 monorepo (Lerna + Yarn Workspaces) 共享代码的 ReactJS linting (eslint) 和 transpiling (babel) 错误 - ReactJS linting (eslint) and transpiling (babel) error on shared code using monorepo (Lerna + Yarn Workspaces) 使用ESLint和Prettier时,要在VS Code中提供哪些用户设置以进行格式设置/格式化? (阅读说明) - What user settings to give in VS Code for formatting/linting when using ESLint and Prettier? (Read Description) Eslint 在使用 babel 解析器时禁用严格模式 - Eslint disable strict mode when using babel parser Create React App 提供的 react-scripts package 需要依赖: "babel-eslint": "^10.1.0" 不要手动安装 - The react-scripts package provided by Create React App requires a dependency: "babel-eslint": "^10.1.0" dont install it manually
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM