Problem with parsing eslint for async function

348 Views Asked by At

I have problem with my ESLint parser. I use Sage project from Roots.io I've been searching the internet all day. I use Webpack and my terminal print:

Module build failed: 
19 :     redirect_uri: redirectUri,
20 : });
21 : 
22 : 
23 : async function getAsyncAuth() { 
           ^
Unexpected token (23:6)

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

These comments like eslint-disable still not work!

My .eslintrc.js

  'ecmaVersion': 2017,
  'sourceType': 'module',

I changed ecmaVersion from '2016' to '2017', '2018' or 'latest' but still not working.

In package.json I have in devDependencies:

"eslint": "~4.19.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.14.0",

My script where I use async/await.

    import axios from 'axios';
    import oauth from 'axios-oauth-client';
    
    var clientId = '';
    var clientSecret = '';
    var redirectUri = '';
    
    const getAuthorizationCode = oauth.client(axios.create(), {
        url: 'https://api.getbase.com/oauth2/authorize',
        response_type: 'code',
        client_id: clientId,
        client_secret: clientSecret,
        redirect_uri: redirectUri,
    });
    
    
    async function getAsyncAuth() { 
        const auth = await getAuthorizationCode();
        console.log(auth);
        return auth;
    }
    
    getAsyncAuth();

What it's wrong? Do you know solution?

0

There are 0 best solutions below