Eslint let us specify the global variable. This configuration allows eslint to know that a variable exists even if it is not referenced in the code. Here is an example:
{
"globals": {
"dataLayer": true
}
}
In addition to specifying it, you can declare the variable as writable or not. Here is an example:
{
"globals": {
"dataLayer": "writable"
}
}
Or only declare it as read-only:
{
"globals": {
"dataLayer": "readonly"
}
}
Top comments (0)