Search code examples
javascriptclassmethodseslintecmascript-5

How to make ESLint ignore class names and methods from other files?


This has probably been asked before, but I don't really know how to search for it so if it has, I am really sorry.

Say I have a file called a.js that has a class called Navigation in it, then in b.js I call that with a method inside the class called getView();

a.js

Navigation.prototype.getView = function getView(id) {
   return this.views[id]; 
};

b.js

var currentView = Navigation.getView(id);

How would I go about tell ESLint that Navigation should be ignred from the no-undef rule?


Solution

  • You can try to use the globals comment inside the file you want to ignore it.

    /* globals MY_GLOBAL */