简体   繁体   English

ESLINT错误(未定义错误“ $”)

[英]ESLINT errors ( Error '$' is not defined)

I have Brackets installed, and i getting ESLINT error, as far as i know i dont have ESLINT installed 据我所知,我没有安装ESLINT,所以我安装了Brackets ,并且出现ESLINT错误

代码和错误

That is the first time i get this error, my question is, how do i install ESLINT and configure it that i don't receive the errors. 那是我第一次收到此错误,我的问题是,如何安装ESLINT并配置它以使我不收到错误。 ( The JavaScript code is copied from CODEPEN so it should be ok) (JavaScript代码是从CODEPEN复制的,因此应该可以)

The main problem is ESLINt, i tried with other JS plugins and get the same error, as i said its the first time im getting this error. 主要问题是ESLINt,我尝试使用其他JS插件并遇到相同的错误,因为我说这是我第一次收到此错误。

You need to configure it to allow globals: 您需要对其进行配置以允许全局变量:

https://eslint.org/docs/user-guide/configuring#specifying-globals https://eslint.org/docs/user-guide/configuring#specifying-globals

Either comment on top of the file 在文件顶部添加注释

/* global $ */

or in the config 或在配置中

You need to add the '$' to the globals object inside your .eslintrc file. 您需要在.eslintrc文件内的globals对象中添加'$'

Like so: 像这样:

"eslintConfig": {
    "globals": {
        "$": true
    }
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM