ESlint in Eclipse

匆匆过客 提交于 2021-02-08 13:45:49

问题


I have been given a web project at work that has a .eslintrc file in it and was told to use it.

I gather that this enforces code styles and sounds like a good idea, but I have never done this before.

I just switched to Eclipse Neon. But I can find no tutorials on how to use it. I did find something that says eslint is now the default linter for Eclipse but that was for Orion. Can someone tell me how to use my .eslintrc file for all my .js files in Eclipse?


回答1:


According to this, you have to install Tern into your Eclipse, then configure it to use the ESLint linter. It's not clear (to me) whether or not the plugin will use your .eslintrc for configuration; it talks about an ESLint JSON configuration file instead.




回答2:


I'm using Neon myself, and this is how you configure ESLint:

  1. Create an ESLint JSON configuration file by following these instructions.

  2. Go to Project / Properties / JavaScript / Tern / Validation / ESLint and check "Use config files":

  3. Enter the path to your eslint.json file (or whatever you named the file you created from step 1) and press OK.

If you want to disable ESLint (or any other module), go to Project / Properties / JavaScript / Tern / Modules and uncheck it.



来源:https://stackoverflow.com/questions/38152256/eslint-in-eclipse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!