简体   繁体   中英

ESLint with Babel plugin-proposal-export-default-from

I just added this babel plugin in order to make use of that export aDefault from 'a/module' .

Works well as I can import such an export from other files but eslint isn't sparing me. It highlights my export statement ruthlessly.

Do we have an eslint plugin for that, or how should I go about it? My .eslintrc.yaml currently extends standard .

Well, I have exhausted my options; including having babel-eslint as the parser in the eslintrc.json file.

In case anyone lands here with a similar issue, I decided to adapt the standard specification, with some aliasing, and forget about the babel syntax;

// index.js

export { default as PreferredName, aNamedExport } from 'a/module';
export { default as AnotherPreferredName, anotherNamedExport } from 'another/module';

// or export all the named exports from another/module.js
export * from 'another/module'; // this won't export the default. It will also throw an error if anotherNamedExport has already been exported from another/module.js as above

.eslintrc

"comma-dangle": [
  "error", 
  { 
    "exports": "never",
    "imports": "never"
  }
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM