Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLint: 'chrome' is not defined (no-undef)

I added ESLint to my chrome extension project. I am using chrome API which starts with chrome., but obviously eslint points on it as error.

I suppose it should be something like:

"env": {   "browser": true,   "chrome": true,   "es6": true }, 

but apparently it's not.

UPD: I would consider best answer is to add webextensions: true – as wOxxOm suggested. Because it's a chrome extension - chrome. API is heavily used here.

Otherwise adding /* global chrome */ as other suggested would work better.

Thanks for answers.

like image 814
Yuri Tymochko Avatar asked Feb 02 '18 14:02

Yuri Tymochko


1 Answers

You need to add:

"env": {     // ...     "webextensions": true } 

to your .eslintrc.json file or eslint configuration in general.

like image 184
Daniel Kmak Avatar answered Oct 14 '22 15:10

Daniel Kmak