'Eslint Configuration for Multiple Files / Project

How to configure eslintrc for a project like in this example?

user
└── projectA
    ├── index.html
    └── lib
        ├── .eslintrc
        ├── main.js
        └── main_lib.js

html file includes both of the js files. How .eslintrc is needed to configure to overcome function is not defined and defined but not used errors properly?



Solution 1:[1]

The rules concerned by your question are:

  • for defined but not used it's the no-unused-vars rule
  • for function is not defined, if you're trying to use a global method declared from an external script, then you can declare it as part of the global config in .eslintrc, like "globals": { "yourFunctionName": "readonly" }, to make eslint aware that this function was not declared by you but still it's available from somewhere.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ylerjen