Edit: In create-react-app v4.0.0
, the EXTEND_ESLINT
flag is no longer required to customize the ESLint config, so the following answer should not be necessary past version 4.0.0.
We've also upgraded eslint-plugin-hooks
to version 4.0.0 and removed the EXTEND_ESLINT
flag as it is no longer required to customize the ESLint config.
I am using create-react-app
and found that in addition to defining:
# This is YAML btw
env:
# ...
webextensions: true
in my eslint
config (which adds chrome
as a global), I also had to set the EXTEND_ESLINT
environment variable for create-react-app
to true
. Docs here.
There are a few different ways of setting this environment variable. For example, you can create a .env
file in the root of your project folder with the content:
EXTEND_ESLINT=true
From the documentation, I believe this an experimental feature, but it provides your eslint
config to the eslint-loader
. Prior to setting enabling this, I had to manually comment the
/* global chrome */
in each file, since the build process was not using my eslint
config and therefore not recognizing that I set chrome
to be a global.
And although this question does not mention create-react-app
, I'm sure lots of people will come to this question with the same circumstance as myself.