eslint-plugin-codebox icon indicating copy to clipboard operation
eslint-plugin-codebox copied to clipboard

Export functionality

Open hieuvp opened this issue 6 years ago • 2 comments

How is destructuring export?

Something is like this is pretty easy to be sorted alphabetically right?

export {
  getListLand,
  getLandDetail,
  addLand,
  addFarmer,
  getUserProfile,
  updateUserProfile
};

Best Regards,

hieuvp avatar Mar 23 '18 12:03 hieuvp

That's a good feature to add, I'll take a look at it this weekend What do you think, how should it work with something like export { something as default }, as a separate entity or in context of every other export? I would prefer the latter

asn007 avatar Mar 23 '18 12:03 asn007

Hi @asn007,

From Airbnb style guide: https://github.com/airbnb/javascript#modules--no-export-from-import

// bad
// filename es6.js
export { es6 as default } from './AirbnbStyleGuide';

// good
// filename es6.js
import { es6 } from './AirbnbStyleGuide';
export default es6;

Should not allow user to do export { es6 as default }, use export default es6; instead.

Btw, if there are export and export default in the same file, the export default should be in the last statement.

e.g.

export {
  getListLand,
  getLandDetail,
  addLand,
  addFarmer,
  getUserProfile,
  updateUserProfile
};

export default api;

hieuvp avatar Mar 24 '18 04:03 hieuvp