0

Update I removed the env code and I'm still receiving 6 ESLint errors with my code and I'm not sure why.

Here are the errors:

ERROR: 'window' is not defined. [no-undef] if ($(window).width() <= 640) {

ERROR: 'initMap' is defined but never used. [no-unused-vars] function initMap() {

ERROR: 'google' is not defined. [no-undef] var map = new google.maps.Map(document.getElementById("map"), {

ERROR: 'document' is not defined. [no-undef] var map = new google.maps.Map(document.getElementById("map"), {

ERROR: 'marker' is assigned a value but never used. [no-unused-vars] var marker = new google.maps.Marker({

ERROR: 'google' is not defined. [no-undef] var marker = new google.maps.Marker({

Any help would be appreciated!

/*eslint-env jquery*/

if ($(window).width() <= 640) {
$(".cross").hide();
$(".menu").hide();
$(".hamburger").show();

$(".hamburger").on("click", function () {
    $(".menu").slideToggle("slow");
    $(".hamburger").hide();
    $(".cross").show();
});

$(".cross").on("click", function () {
    $(".menu").slideToggle("slow");
    $(".cross").hide();
    $(".hamburger").show();
});
}

function initMap() {
var pip = {
    lat: 22.421645,
    lng: -98.731555
};
var map = new google.maps.Map(document.getElementById("map"), {
    zoom: 13,
    center: pip,
});
var marker = new google.maps.Marker({
    position: pip,
    map: map
});
}
1
  • 2
    Because it is not a valid JavaScript code. Commented Aug 1, 2018 at 21:17

3 Answers 3

2

The code you try to validate has a syntax error. This part:

"env": {
"browser": true,
"node": true,
"jasmine": true    
},

...is either extraneous, or you don't show the whole snippet.

Sign up to request clarification or add additional context in comments.

Comments

1

If "env" is meant to be a variable, I think you need something like this:

env = {
    "browser": true,
    "node": true,
    "jasmine": true
};

Proper indentation throughout would make this a lot easier to read

Comments

1

As Drew stated above, if env is a variable, you'll need an equals sign, not a colon. In addition, you'll want to declare the type.

const env = {
    "browser": true,
    "node": true,
    "jasmine": true
};

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.