web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.0 KiB

  1. # import/prefer-default-export
  2. When there is only a single export from a module, prefer using default export over named export.
  3. ## Rule Details
  4. The following patterns are considered warnings:
  5. ```javascript
  6. // bad.js
  7. // There is only a single module export and it's a named export.
  8. export const foo = 'foo';
  9. ```
  10. The following patterns are not warnings:
  11. ```javascript
  12. // good1.js
  13. // There is a default export.
  14. export const foo = 'foo';
  15. const bar = 'bar';
  16. export default 'bar';
  17. ```
  18. ```javascript
  19. // good2.js
  20. // There is more than one named export in the module.
  21. export const foo = 'foo';
  22. export const bar = 'bar';
  23. ```
  24. ```javascript
  25. // good3.js
  26. // There is more than one named export in the module
  27. const foo = 'foo';
  28. const bar = 'bar';
  29. export { foo, bar }
  30. ```
  31. ```javascript
  32. // good4.js
  33. // There is a default export.
  34. const foo = 'foo';
  35. export { foo as default }
  36. ```
  37. ```javascript
  38. // export-star.js
  39. // Any batch export will disable this rule. The remote module is not inspected.
  40. export * from './other-module'
  41. ```