source: frontend/node_modules/eslint-plugin-import/docs/rules/no-named-export.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-named-export
2
3<!-- end auto-generated rule header -->
4
5Prohibit named exports. Mostly an inverse of [`no-default-export`].
6
7[`no-default-export`]: ./no-default-export.md
8
9## Rule Details
10
11The following patterns are considered warnings:
12
13```javascript
14// bad1.js
15
16// There is only a single module export and it's a named export.
17export const foo = 'foo';
18```
19
20```javascript
21// bad2.js
22
23// There is more than one named export in the module.
24export const foo = 'foo';
25export const bar = 'bar';
26```
27
28```javascript
29// bad3.js
30
31// There is more than one named export in the module.
32const foo = 'foo';
33const bar = 'bar';
34export { foo, bar }
35```
36
37```javascript
38// bad4.js
39
40// There is more than one named export in the module.
41export * from './other-module'
42```
43
44```javascript
45// bad5.js
46
47// There is a default and a named export.
48export const foo = 'foo';
49const bar = 'bar';
50export default 'bar';
51```
52
53The following patterns are not warnings:
54
55```javascript
56// good1.js
57
58// There is only a single module export and it's a default export.
59export default 'bar';
60```
61
62```javascript
63// good2.js
64
65// There is only a single module export and it's a default export.
66const foo = 'foo';
67export { foo as default }
68```
69
70```javascript
71// good3.js
72
73// There is only a single module export and it's a default export.
74export default from './other-module';
75```
76
77## When Not To Use It
78
79If you don't care if named imports are used, or if you prefer named imports over default imports.
Note: See TracBrowser for help on using the repository browser.