source: frontend/node_modules/eslint-plugin-import/docs/rules/no-mutable-exports.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.4 KB
Line 
1# import/no-mutable-exports
2
3<!-- end auto-generated rule header -->
4
5Forbids the use of mutable exports with `var` or `let`.
6
7## Rule Details
8
9Valid:
10
11```js
12export const count = 1
13export function getCount() {}
14export class Counter {}
15```
16
17...whereas here exports will be reported:
18
19```js
20export let count = 2
21export var count = 3
22
23let count = 4
24export { count } // reported here
25```
26
27## Functions/Classes
28
29Note that exported function/class declaration identifiers may be reassigned,
30but are not flagged by this rule at this time. They may be in the future, if a
31reassignment is detected, i.e.
32
33```js
34// possible future behavior!
35export class Counter {} // reported here: exported class is reassigned on line [x].
36Counter = KitchenSink // not reported here unless you enable no-class-assign
37
38// this pre-declaration reassignment is valid on account of function hoisting
39getCount = function getDuke() {} // not reported here without no-func-assign
40export function getCount() {} // reported here: exported function is reassigned on line [x].
41```
42
43To prevent general reassignment of these identifiers, exported or not, you may
44want to enable the following core ESLint rules:
45
46 - [no-func-assign]
47 - [no-class-assign]
48
49[no-func-assign]: https://eslint.org/docs/rules/no-func-assign
50[no-class-assign]: https://eslint.org/docs/rules/no-class-assign
51
52## When Not To Use It
53
54If your environment correctly implements mutable export bindings.
Note: See TracBrowser for help on using the repository browser.