Is there a way in eslint to set the sourceType within the file similar to the rules and environment settings?
Something like
/*eslint sourceType: "module"*/
does not seen work
I have to create one directory for each special Javascript file and put a .eslintrc
file with the following content in the directory:
{
"sourceType": "module"
}
Maybe it's better to move all modules under a single directory, separated from legacy JS files. But for temporary fix of the Parsing error: 'import' and 'export may appear only with 'sourceType: module'
, I just put the .eslintrc
.
One of the team members of eslint confirmed that this is currently not supported and the only way to set the sourceType currently is by using the configuration files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With