ignore eslint error: 'import' and 'export' may only appear at the top level
my solution incase other dont work
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
}
ESLint natively doesnt support this because this is against the spec. But if you use babel-eslint
parser then inside your eslint config file you can do this:
{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
}
}
Doc ref: https://github.com/babel/babel-eslint#configuration