@putout/plugin-nodejs 10.1.1 β†’ 11.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 CHANGED
@@ -36,7 +36,8 @@ npm i putout @putout/plugin-nodejs -D
36
36
  "nodejs/declare": "on",
37
37
  "nodejs/declare-after-require": "on",
38
38
  "nodejs/remove-process-exit": "on",
39
- "nodejs/strict-mode": "on"
39
+ "nodejs/add-missing-strict-mode": "on",
40
+ "nodejs/remove-useless-strict-mode": "on"
40
41
  }
41
42
  }
42
43
  ```
@@ -398,7 +399,7 @@ Rename `*.mjs` files when `module === "module"`:
398
399
 
399
400
  Check out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/94fb3298b210e703b01db9a6826942bc/dfe2462451c6b3d4d47da7fd8d39dc8e53bb16eb).
400
401
 
401
- ## strict-mode
402
+ ## add-missing-strict-mode
402
403
 
403
404
  > **Strict mode** makes several changes to normal **JavaScript** semantics:
404
405
  >
@@ -408,38 +409,40 @@ Check out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/94fb3298b210e
408
409
  >
409
410
  > (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)
410
411
 
411
- Add **strict mode** to **CommonJS**, and remove from **ESM**, where it enabled by default.
412
+ Add **strict mode** to **CommonJS**:
412
413
 
413
414
  ### ❌ Example of incorrect code
414
415
 
415
- ESM:
416
-
417
416
  ```js
418
- 'strict mode';
419
-
420
- import a from 'b';
417
+ const a = require('b');
421
418
  ```
422
419
 
423
- CommonJS:
420
+ ### βœ… Example of correct code
424
421
 
425
422
  ```js
423
+ 'strict mode';
424
+
426
425
  const a = require('b');
427
426
  ```
428
427
 
429
428
  ### βœ… Example of correct code
430
429
 
431
- ESM:
430
+ ## remove-useless-strict-mode
431
+
432
+ Remove `'use strict'` from **ESM**.
433
+
434
+ ### ❌ Example of incorrect code
432
435
 
433
436
  ```js
437
+ 'strict mode';
438
+
434
439
  import a from 'b';
435
440
  ```
436
441
 
437
- CommonJS:
442
+ ### βœ… Example of correct code
438
443
 
439
444
  ```js
440
- 'strict mode';
441
-
442
- const a = require('b');
445
+ import a from 'b';
443
446
  ```
444
447
 
445
448
  ## License
package/lib/index.js CHANGED
@@ -50,6 +50,6 @@ module.exports.rules = {
50
50
  'rename-file-cjs-to-js': ['off', renameFileCjsToJs],
51
51
  'rename-file-mjs-to-js': ['off', renameFileMjsToJs],
52
52
 
53
- 'add-strict-mode': strictMode.rules['add-missing'],
54
- 'remove-strict-mode': strictMode.rules['remove-useless'],
53
+ 'add-missing-strict-mode': strictMode.rules['add-missing'],
54
+ 'remove-useless-strict-mode': strictMode.rules['remove-useless'],
55
55
  };
@@ -18,8 +18,8 @@ module.exports.fix = (file, {js}) => {
18
18
  renameFile(file, js);
19
19
  };
20
20
 
21
- module.exports.scan = (path, {push}) => {
22
- for (const file of findFile(path, '*.cjs')) {
21
+ module.exports.scan = (path, {push, trackFile}) => {
22
+ for (const file of trackFile(path, '*.cjs')) {
23
23
  const packagePath = findUpPackage(file);
24
24
 
25
25
  const cjs = getFilename(file);
@@ -18,8 +18,8 @@ module.exports.fix = (file, {js}) => {
18
18
  renameFile(file, js);
19
19
  };
20
20
 
21
- module.exports.scan = (path, {push}) => {
22
- for (const file of findFile(path, '*.mjs')) {
21
+ module.exports.scan = (path, {push, trackFile}) => {
22
+ for (const file of trackFile(path, '*.mjs')) {
23
23
  const packagePath = findUpPackage(file);
24
24
 
25
25
  if (!packagePath)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-nodejs",
3
- "version": "10.1.1",
3
+ "version": "11.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",
@@ -42,10 +42,10 @@
42
42
  "@putout/plugin-declare": "*",
43
43
  "@putout/plugin-putout": "*",
44
44
  "@putout/plugin-typescript": "*",
45
- "@putout/test": "^8.0.0",
46
- "c8": "^8.0.0",
47
- "eslint": "^8.0.1",
48
- "eslint-plugin-n": "^16.0.0",
45
+ "@putout/test": "^9.0.0",
46
+ "c8": "^9.0.0",
47
+ "eslint": "^9.0.0-alpha.0",
48
+ "eslint-plugin-n": "^17.0.0-0",
49
49
  "eslint-plugin-putout": "^22.0.0",
50
50
  "lerna": "^6.0.1",
51
51
  "madrun": "^10.0.0",
@@ -53,7 +53,7 @@
53
53
  "nodemon": "^3.0.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "putout": ">=34"
56
+ "putout": ">=35"
57
57
  },
58
58
  "license": "MIT",
59
59
  "engines": {