This eslint environment will help ensure you have the environment set correctly for edge / browser development.
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-edge
:
npm install eslint-plugin-edge --save-dev
Add edge
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["edge"]
}
Add the environment to your eslint config:
{
"env": {
"eslint-plugin-edge/edge-and-browser": true, // If your code is for both edge and browser
"eslint-plugin-edge/edge": true // If your code is for edge only (has more features)
}
}
If your code is running on next.js, the edge has one extra polyfill for AsyncLocalStorage
.
To add it, add the following global to your eslint config:
{
"globals": {
"AsyncLocalStorage": "readonly"
}
}