Skip to content

Commit 2d9101e

Browse files
committed
docs: @putout/plugin-nodejs: group-require-by-id: ESM
1 parent 41a90ed commit 2d9101e

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

packages/plugin-nodejs/README.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -350,37 +350,6 @@ const args = minimist({
350350
});
351351
```
352352
353-
## group-require-by-id
354-
355-
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/ff39c5d912d836a25b96772d8045dacb/fa8d8e1ebf8ac5f19a536247536f4bccf4fdac3d). For **ESM** use [`group-imports-by-sources`](https://github.com/coderaiser/putout/tree/master/packages/plugin-group-imports-by-source#readme).
356-
357-
### ❌ Example of incorrect code
358-
359-
```js
360-
const ss = require('../../bb/ss');
361-
const d = require('../hello');
362-
const react = require('react');
363-
const {lodash} = require('lodash');
364-
const fs = require('node:fs');
365-
const b = require('./ss');
366-
const m = require(x);
367-
const c = 5;
368-
```
369-
370-
### ✅ Example of correct code
371-
372-
```js
373-
const fs = require('node:fs');
374-
const react = require('react');
375-
const {lodash} = require('lodash');
376-
const ss = require('../../bb/ss');
377-
const d = require('../hello');
378-
379-
const b = require('./ss');
380-
const m = require(x);
381-
const c = 5;
382-
```
383-
384353
### exports
385354
386355
### ❌ Example of incorrect code
@@ -415,6 +384,38 @@ const __filename = fileURLToPath(import.meta.url);
415384
await readFile(__filename);
416385
```
417386
387+
## group-require-by-id
388+
389+
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/ff39c5d912d836a25b96772d8045dacb/fa8d8e1ebf8ac5f19a536247536f4bccf4fdac3d). For **ESM** use [`esm/group-imports-by-sources`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#group-imports-by-source).
390+
391+
### ❌ Example of incorrect code
392+
393+
```js
394+
const ss = require('../../bb/ss');
395+
const d = require('../hello');
396+
const react = require('react');
397+
const {lodash} = require('lodash');
398+
const fs = require('node:fs');
399+
const b = require('./ss');
400+
const m = require(x);
401+
const c = 5;
402+
```
403+
404+
### ✅ Example of correct code
405+
406+
```js
407+
const fs = require('node:fs');
408+
const react = require('react');
409+
const {lodash} = require('lodash');
410+
const ss = require('../../bb/ss');
411+
const d = require('../hello');
412+
413+
const b = require('./ss');
414+
const m = require(x);
415+
const c = 5;
416+
```
417+
418+
418419
## convert-esm-to-commonjs
419420
420421
> **CommonJS** is a module system supported in Node, it provides a `require` function, which can be used to access the `exports` object exposed by another file.

0 commit comments

Comments
 (0)