@putout/plugin-esm 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/lib/apply-default-import/index.js +5 -0
- package/lib/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ npm i putout @putout/plugin-esm -D
|
|
|
19
19
|
## Rules
|
|
20
20
|
|
|
21
21
|
- ✅ [add-index-to-import](#add-index-to-import);
|
|
22
|
+
- ✅ [apply-default-import](#apply-default-import);
|
|
22
23
|
- ✅ [apply-export-from](#apply-export-from);
|
|
23
24
|
- ✅ [convert-assert-to-with](#convert-assert-to-with);
|
|
24
25
|
- ✅ [declare-imports-first](#declare-imports-first);
|
|
@@ -47,6 +48,7 @@ npm i putout @putout/plugin-esm -D
|
|
|
47
48
|
{
|
|
48
49
|
"rules": {
|
|
49
50
|
"esm/add-index-to-import": "on",
|
|
51
|
+
"esm/apply-default-import": "on",
|
|
50
52
|
"esm/apply-export-from": "on",
|
|
51
53
|
"esm/declare-imports-first": "on",
|
|
52
54
|
"esm/group-imports-by-source": "on",
|
|
@@ -72,6 +74,26 @@ npm i putout @putout/plugin-esm -D
|
|
|
72
74
|
|
|
73
75
|
## Rules
|
|
74
76
|
|
|
77
|
+
### apply-default-import
|
|
78
|
+
|
|
79
|
+
> The static `import` declaration is used to import read-only live bindings which are exported by another module.
|
|
80
|
+
>
|
|
81
|
+
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)
|
|
82
|
+
|
|
83
|
+
Check out 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/83dcc8478ac794cbe11df41a80a08cbe/8270019356b6f8ea21233d6eb1edccec69e708bb).
|
|
84
|
+
|
|
85
|
+
#### ❌ Example of incorrect code
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
import {default as a} from 'a';
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### ✅ Example of correct code
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
import a from 'a';
|
|
95
|
+
```
|
|
96
|
+
|
|
75
97
|
### apply-export-from
|
|
76
98
|
|
|
77
99
|
> The `export` declaration is used to export values from a JavaScript module.
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as applyDefaultImport from './apply-default-import/index.js';
|
|
1
2
|
import * as applyExportFrom from './apply-export-from/index.js';
|
|
2
3
|
import * as applyJsImportedFile from './apply-js-imported-file/index.js';
|
|
3
4
|
import * as applyNameToImportedFile from './apply-name-to-imported-file/index.js';
|
|
@@ -37,4 +38,5 @@ export const rules = {
|
|
|
37
38
|
'apply-namespace-to-imported-file': ['off', applyNamespaceToImportedFile],
|
|
38
39
|
'apply-privately-imported-file': ['off', applyPrivatelyImportedFile],
|
|
39
40
|
'apply-js-imported-file': ['off', applyJsImportedFile],
|
|
41
|
+
'apply-default-import': applyDefaultImport,
|
|
40
42
|
};
|
package/package.json
CHANGED