Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ignore eslint error: 'import' and 'export' may only appear at the top level

Tags:

eslint

lint

Is it possible to deactivate this error in eslint?

Parsing error: 'import' and 'export' may only appear at the top level 
like image 426
user3142695 Avatar asked Aug 26 '16 04:08

user3142695


1 Answers

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

like image 177
Gyandeep Avatar answered Sep 21 '22 12:09

Gyandeep