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.

52 lines
1.4 KiB

  1. # import/no-mutable-exports
  2. Forbids the use of mutable exports with `var` or `let`.
  3. ## Rule Details
  4. Valid:
  5. ```js
  6. export const count = 1
  7. export function getCount() {}
  8. export class Counter {}
  9. ```
  10. ...whereas here exports will be reported:
  11. ```js
  12. export let count = 2
  13. export var count = 3
  14. let count = 4
  15. export { count } // reported here
  16. ```
  17. ## Functions/Classes
  18. Note that exported function/class declaration identifiers may be reassigned,
  19. but are not flagged by this rule at this time. They may be in the future, if a
  20. reassignment is detected, i.e.
  21. ```js
  22. // possible future behavior!
  23. export class Counter {} // reported here: exported class is reassigned on line [x].
  24. Counter = KitchenSink // not reported here unless you enable no-class-assign
  25. // this pre-declaration reassignment is valid on account of function hoisting
  26. getCount = function getDuke() {} // not reported here without no-func-assign
  27. export function getCount() {} // reported here: exported function is reassigned on line [x].
  28. ```
  29. To prevent general reassignment of these identifiers, exported or not, you may
  30. want to enable the following core ESLint rules:
  31. - [no-func-assign]
  32. - [no-class-assign]
  33. [no-func-assign]: http://eslint.org/docs/rules/no-func-assign
  34. [no-class-assign]: http://eslint.org/docs/rules/no-class-assign
  35. ## When Not To Use It
  36. If your environment correctly implements mutable export bindings.