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.

63 lines
1.2 KiB

  1. # `import/no-default-export`
  2. Prohibit default exports. Mostly an inverse of [`prefer-default-export`].
  3. [`prefer-default-export`]: ./prefer-default-export.md
  4. ## Rule Details
  5. The following patterns are considered warnings:
  6. ```javascript
  7. // bad1.js
  8. // There is a default export.
  9. export const foo = 'foo';
  10. const bar = 'bar';
  11. export default 'bar';
  12. ```
  13. ```javascript
  14. // bad2.js
  15. // There is a default export.
  16. const foo = 'foo';
  17. export { foo as default }
  18. ```
  19. The following patterns are not warnings:
  20. ```javascript
  21. // good1.js
  22. // There is only a single module export and it's a named export.
  23. export const foo = 'foo';
  24. ```
  25. ```javascript
  26. // good2.js
  27. // There is more than one named export in the module.
  28. export const foo = 'foo';
  29. export const bar = 'bar';
  30. ```
  31. ```javascript
  32. // good3.js
  33. // There is more than one named export in the module
  34. const foo = 'foo';
  35. const bar = 'bar';
  36. export { foo, bar }
  37. ```
  38. ```javascript
  39. // export-star.js
  40. // Any batch export will disable this rule. The remote module is not inspected.
  41. export * from './other-module'
  42. ```
  43. ## When Not To Use It
  44. If you don't care if default imports are used, or if you prefer default imports over named imports.