最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to setup jQuery within ESLint? - Stack Overflow

programmeradmin0浏览0评论

I have installed ESLint, but as you know, it cannot check jQuery syntax. So I have npm installed:

.md

However, I cannot find ESLint's .eslintrc file in order to edit it. According to the readme file, I should be adding this code to it:

{
   "extends": "jquery"
}

How is this done?

I have installed ESLint, but as you know, it cannot check jQuery syntax. So I have npm installed:

https://github./jquery/eslint-config-jquery/blob/master/readme.md

However, I cannot find ESLint's .eslintrc file in order to edit it. According to the readme file, I should be adding this code to it:

{
   "extends": "jquery"
}

How is this done?

Share Improve this question asked Mar 21, 2017 at 1:28 WillowWillow 1,0402 gold badges10 silver badges21 bronze badges 8
  • eslint/docs/user-guide/… – user1106925 Commented Mar 21, 2017 at 1:32
  • @squint, yea, I have been trying to make sense of that. That page is packed full. – Willow Commented Mar 21, 2017 at 1:35
  • @Willow Try CTL-F "jquery" on the manual page – Nick Zuber Commented Mar 21, 2017 at 1:38
  • I cannot find ~/.eslintrc. Does that mean that I have setup global ESLint wrong? – Willow Commented Mar 21, 2017 at 1:39
  • @NickZuber, when setting up with eslint --init, it does not allow jquery to be an environment. Only browser or node as radio options. – Willow Commented Mar 21, 2017 at 1:41
 |  Show 3 more ments

2 Answers 2

Reset to default 8

according to latest update of ESLint, all you have to do is to add "jQuery" to your env and set it to True. { "env" : { "jquery": true }, }

I cannot find ESLint's .eslintrc file in order to edit it.

You simply create your own .eslintrc in the root of your project, then you can add the following code to it:

{
   "extends": "jquery"
}

You can read more about ESLint configuration files here.

发布评论

评论列表(0)

  1. 暂无评论