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
});
}
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.
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
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
};
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.