0

I am using latest JSLint and getting JSLint to complain about the window is not defined. With es6 JSLint directive globals are not allowed.

/*jslint es6*/
import AppConst from "@/constants/app.constant.js";
const applicationConfig = {
    showMobileView: null,
    is_iphone: null,
    imageryViewUseSubnav: null
};
window.addEventListener("resize", function () {
    applicationConfig.showMobileView = utilityService.is_small_device();
    applicationConfig.imageryViewUseSubnav = 
    utilityService.is_small_device();
    applicationConfig.is_iphone = utilityService.is_iphone();
});
export default applicationConfig;
Shashwat Tripathi
  • 572
  • 1
  • 5
  • 19

1 Answers1

0

You have to tell JSLint you're in a browser context.

You had a few other errors -- unimported utilityService, no Object.freeze on your exported object, etc.

If I clean them all up, I get the below, which lints on today's JSLint.com without any additional changes:

/*jslint browser */

// this wasn't used: import AppConst from "@/constants/app.constant.js";
import utilityService from "@/somewhere/file.js";

const applicationConfig = {
    showMobileView: null,
    is_iphone: null,
    imageryViewUseSubnav: null
};
window.addEventListener("resize", function () {
    applicationConfig.showMobileView = utilityService.is_small_device();
    applicationConfig.imageryViewUseSubnav =
            utilityService.is_small_device();
    applicationConfig.is_iphone = utilityService.is_iphone();
});
export default Object.freeze(applicationConfig);
ruffin
  • 16,507
  • 9
  • 88
  • 138