@putout/plugin-nodejs 5.0.0 → 6.0.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 +17 -0
- package/lib/declare/index.js +1 -4
- package/lib/declare-after-require/index.js +0 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ npm i putout @putout/plugin-nodejs -D
|
|
|
26
26
|
"nodejs/convert-dirname-to-url": "on",
|
|
27
27
|
"nodejs/convert-url-to-dirname": "on",
|
|
28
28
|
"nodejs/convert-top-level-return": "on",
|
|
29
|
+
"nodejs/declare": "on",
|
|
29
30
|
"nodejs/declare-after-require": "on",
|
|
30
31
|
"nodejs/remove-process-exit": "on"
|
|
31
32
|
}
|
|
@@ -179,6 +180,8 @@ Add declarations to built-in node.js modules:
|
|
|
179
180
|
- [util](https://nodejs.org/dist/latest-v18.x/docs/api/util.html);
|
|
180
181
|
- [zlib](https://nodejs.org/dist/latest-v18.x/docs/api/zlib.html);
|
|
181
182
|
|
|
183
|
+
Based on [`@putout/operator-declare`](https://github.com/coderaiser/putout/tree/master/packages/operator-declare#putoutoperator-declare-).
|
|
184
|
+
|
|
182
185
|
#### ❌ Example of incorrect code
|
|
183
186
|
|
|
184
187
|
```js
|
|
@@ -192,6 +195,20 @@ import {readFile} from 'fs/promises';
|
|
|
192
195
|
await readFile('hello.txt', 'utf8');
|
|
193
196
|
```
|
|
194
197
|
|
|
198
|
+
When you want to skip some declaration use `dismiss`:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"rules": {
|
|
203
|
+
"nodejs/declare": ["on", {
|
|
204
|
+
"dismiss": [
|
|
205
|
+
"readFile"
|
|
206
|
+
]
|
|
207
|
+
}]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
195
212
|
### declare-after-require
|
|
196
213
|
|
|
197
214
|
> **Node.js** follows the **CommonJS** module system, and the builtin `require` function is the easiest way to include modules that exist in separate files. The basic functionality of `require` is that it reads a JavaScript file, executes the file, and then proceeds to return the `exports` object.
|
package/lib/declare/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-nodejs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds ability to transform code to new API of Node.js",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"@putout/plugin-convert-commonjs-to-esm": "*",
|
|
35
35
|
"@putout/plugin-convert-esm-to-commonjs": "*",
|
|
36
36
|
"@putout/plugin-putout": "*",
|
|
37
|
-
"@putout/test": "^
|
|
37
|
+
"@putout/test": "^6.0.0",
|
|
38
38
|
"c8": "^7.5.0",
|
|
39
39
|
"eslint": "^8.0.1",
|
|
40
40
|
"eslint-plugin-n": "^15.2.4",
|
|
41
41
|
"eslint-plugin-putout": "^16.0.0",
|
|
42
|
-
"lerna": "^
|
|
42
|
+
"lerna": "^6.0.1",
|
|
43
43
|
"madrun": "^9.0.0",
|
|
44
44
|
"montag": "^1.2.1",
|
|
45
45
|
"nodemon": "^2.0.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"putout": ">=
|
|
48
|
+
"putout": ">=29"
|
|
49
49
|
},
|
|
50
50
|
"license": "MIT",
|
|
51
51
|
"engines": {
|