Uncaught ReferenceError: ES6 'async' is not defined or ES9 'arrow function' is not recognized

In my Eclipse setup with JSHint, I encountered an issue when configuring "esversion": 6. This resolved arrow function warnings but introduced async and await warnings instead. Switching to esversion 8 or 9 eliminated the async and await warnings but brought back the arrow function warnings.

Given that ES9 should support arrow functions, is there a way to configure JSHint to allow both without warnings?

{
    // == Enforcing Options ===============================================
    //
    // These options tell JSHint to be more strict towards your code. Use
    // them if you want to allow only a safe subset of JavaScript, very
    // useful when your codebase is shared with a big number of developers
    // with different skill levels. Was all true.
     
    "bitwise" : true,
    ...
    "esversion" : 9,
    
    // == Relaxing Options ================================================
    //
    // These options allow you to suppress certain types of warnings. Use
    // them only if you are absolutely positive that you know what you are
    // doing. Was all false.
    ...
    
    // == Environments ====================================================
    ...
    
    // == JSLint Legacy ===================================================
    ...
    
    // == Undocumented Options ============================================
    ...
     
    "predef" : [
        "Java", "JavaFX", "$ARG"
    ]
    //, "indent" : 2 // Specify indentation spacing
}

After some editing, I did manage to resolve this by adding async and await to the global variables list. However, I believe there might be a better solution out there.

    
"globals" : {
        "async" : true,
        "await" : true,
        "describe" : true,
        "expect" : true,
        "it" : true
    },

Answer №1

I discovered a solution:

  • By installing jshint using NPM and setting up a shell command to direct the linting results to a text file, I am able to access more accurate information for cleaning up my code.

This situation suggests that the issue may lie in the eclipse marketplace not offering the most recent version of jshint. To resolve this, it would be necessary to request an update from someone or consider doing it myself—neither of which is feasible at the moment due to time constraints.

Many thanks to all who dedicated their energy to pondering this dilemma.

Answer №2

Here's a different response. Recently made the transition to using VSCode as my IDE and switched over to ESLint for code linting.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the steps for leveraging a proxy with NodeJS and Selenium?

While researching the topic on proxies in the documentation, I came across a method to set up a proxy while building a driver like this: var driver = new webdriver.Builder() .withCapabilities(webdriver.Capabilities.chrome()) .setProxy(proxy.manual ...

An issue occurred when attempting to integrate Angular

Currently, I am in the process of learning AngularJS. To practice, I attempted a simple code snippet in an HTML file: <!DOCTYPE html> <html lang="en" ng-app=""> <head> <meta charset="utf-8"> &l ...

Scale the cylinder in Three.js from a specific point

Can a cylinder be resized along the Y-axis starting from a particular point? Instead of the cylinder expanding from its center in both directions to the new scale, is it possible for it to grow upwards/downwards only like a bar chart? Current code : fu ...

"Replacing backslashes with forward slashes in JavaScript: A step-by-step guide

var string = "/\test\test1\test.jpg"; Looking for a way to swap out /\ with just \ using JavaScript? ...

"Unidentified service error - Resolving a problem in an AngularJS application

var myApp = angular.module("MyApp", ['ngRoute']); myApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/', { templateUrl: 'partials/cart.php', controller: &apo ...

Tips for showcasing axios data on Vue components

I'm just starting out with Vue.js and I'm struggling to grasp how it all works. I have a function that sends data to the server and receives a response using axios. However, when I try to display the response using a variable, something seems to ...

The search feature on mobile devices is currently malfunctioning

The jQuery code below is used to search for products. It works perfectly in desktop view, but the responsive mobile view does not seem to be functioning correctly. Can someone assist me with fixing this issue? $("#search-criteria").keyup(function() { ...

Guide to creating a synchronous wrapper for jQuery ajax methods

I've made the decision to switch from synchronous ajax calls to asynchronous ones due to lack of support in most modern browsers. My code is currently reliant on synchronous (and dynamic) ajax calls to client-side functions that must be completed befo ...

Is there a way to determine if a div is positioned 100px from the bottom edge?

When using the sticky class to stick a div, I encountered an issue where it sticks correctly from the top but overlaps the footer at the bottom. https://i.sstatic.net/28A3A.jpg Here is the HTML code: <div class="tab-content"> <div role="tab ...

Contrast between the Red Hat JBoss Developer Studio and the standard Eclipse IDE

Can you please explain the distinctions between Red Hat JBoss Developer Studio and the standard Eclipse IDE? ...

Unable to trigger window.open function or it is not being invoked

I am facing an issue with a button on my form that generates PDF files and saves them to the local machine. I want to be able to not only save the files locally but also have them available for download in the browser, especially when there are multiple fi ...

Dropdown functionality in Knockout.js ceasing to work following addition of Knockout binding

I'm attempting to connect the dropdown menu. The code below is functional: <select data-bind="options: MyArray"/> However, when I include the Knockout bindings as shown below, the dropdown menu fails to appear: <select data-bind=&q ...

unable to retrieve JSON sub-elements

I encountered an issue while attempting to iterate through the JSON object provided. When trying to access the content-items using page.content-items, I received an error message. Is it possible to access an object that has a key with "-" in its name? Co ...

Adjusting values in Vue.js with a slider bar

Just starting out with vue.js and wanted to create a slide-bar with min and max values. I came across vue range slider, installed it, and successfully implemented it. The issue I'm facing is changing the value on the slider. The values from my API r ...

Developing dynamic checkbox components using jQuery - unusual behavior in Internet Explorer

I am dynamically creating checkbox elements using jQuery and appending them to a specified node as shown below var topics = ['All','Cat1','Cat2']; var topicContainer = $('ul#someElementId'); $.each( topics, functio ...

Displaying an image directly in front of the camera using Three.js

I am currently working on a flight simulator project and faced a challenge in placing a cockpit image in front of my camera controlled by FirstPersonControls. Despite trying various methods, I have not been successful in making it work. Here is what I hav ...

Creating expandable card components with React and CSS using accordion functionality

I am currently working on creating a card that will expand its blue footer when the "view details" link is clicked to show lorem text. However, I am encountering an issue where the blue bottom of the card does not expand along with the lorem text. You can ...

Is there a method to determine whether the user has granted permission for notifications to be enabled?

Once I have requested permission from the user of the website, I need to confirm if they have granted permission before triggering the send() function. What is the most sophisticated approach to achieve this? ...

Reorganize files with sequential numbers using Gulp, starting from the highest number within the directory

I am looking to create a gulp task that moves files from one folder to another while renaming them with sequential numbers. Here is the current task I have: var index = 0; gulp.task("jpg", function () { return gulp.src('img/new/**.{jpg,JPG}&ap ...

Protractor - Not waiting for all elements to load before opening a popup window

Despite my efforts to ensure the stability of my test, there are instances where it does not wait for all elements within an integrated popup, resulting in failure. This particular test case is quite intricate as it involves nested if statements to execut ...