Why is this an issue?

The value of this depends on which context it appears:

When a function is called without an explicit object context, the this keyword refers to the global object. This also applies when it is used outside of an object or function. The global this object refers to the global context in which the JavaScript code is executed. This can cause problems when the code is executed in different contexts, such as in a browser or in a Node.js environment, where the global object is different. Such uses could confuse maintainers as the actual value depends on the execution context, and it can be unclear what object the this keyword is referring to.

In JavaScript’s "strict mode", using this in the global context will always be undefined.

this.foo = 1;   // Noncompliant: 'this' refers to global 'this'
console.log(this.foo); // Noncompliant: 'this' refers to global 'this'

function MyObj() {
  this.foo = 1; // Compliant
}

MyObj.func1 = function() {
  if (this.foo === 1) { // Compliant
    // ...
  }
}

Instead, simply drop the this, or replace it with globalThis. The globalThis global property gives access to the global object regardless of the current environment.

foo = 1;
console.log(foo);

function MyObj() {
  this.foo = 1;
}

MyObj.func1 = function() {
  if (this.foo === 1) {
    // ...
  }
}

Resources

Documentation