简体   繁体   中英

How can i set an eslint rule for no-undefined?

I am trying to make a simple function which will redirect the user to the home page, as the name say. I can't get rid of this error:

*ReferenceError: location is not defined

Can someone help me with this, using eslint?

export function goToHomePage() {
  location = '/';
}

I am using backbone.js MVC

Try setting your ESLINT config to:

var esLintDevConfig = {
    env: {
        "browser": true,
        "node": true,
        "jquery": true
    },
    "globals": {
        "angular": true, "window": true, //anyother global variables
    },
    rules: {

    }
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM