t.m.
t.m.

Reputation: 1490

How to make ESLint include local files?

I have a website with simple HTML but lots of javascript code. For that I am trying to use ESLint for the first time.

My html looks like this:

<html>
    . . .
    <body>
        . . .
        <script src="js/someLib.js"></script>
        <script src="js/main.js"></script>
    </body>
</html>

In someLib.js there is a variable "myLibVar" that I use in main.js. It causes this error :

'myLibVar' is not defined. (no-undef)

It is not a node.js app, so I don't use require funtion. How can I make ESLint to include someLib.js and prevent those no-undef errors?

Note: I am using VS code to develop code and someLib.js is not one of the popular libraries.

Upvotes: 0

Views: 119

Answers (1)

Colin Ricardo
Colin Ricardo

Reputation: 17259

Have you tried something like /* global myLibVar */ at the top of your main.js?

Upvotes: 1

Related Questions