Home:ALL Converter>Eslint parsing error when exporting submodules

Eslint parsing error when exporting submodules

Ask Time:2020-01-22T04:03:46         Author:picklechips

Json Formatter

I'm working on an npm package, which is structured like the following:

index.js

export foo from 'foo'
export bar from 'bar'

foo.js

export default { foo: true }

bar.js

export default { bar: true }

However when I run eslint I get the following error: 1:0 error Parsing error: Declaration or statement expected

Anyone know how to fix this? Here is my eslintrc.json:

{
    "env": {
        "browser": true,
        "es6": true,
        "jest/globals": true
    },
    "extends": [
        "airbnb-base"
    ],
    "globals": {
        "Atomics": "readonly",
        "SharedArrayBuffer": "readonly"
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaVersion": 2018,
        "sourceType": "module"
    },
    "plugins": [
        "@typescript-eslint",
        "jest"
    ],
    "rules": {
    }
}

Thanks

Author:picklechips,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59848420/eslint-parsing-error-when-exporting-submodules
yy