@putout/plugin-group-imports-by-source

2.0.0 • Public • Published

@putout/plugin-group-imports-by-source NPM version

The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are called live bindings because they are updated by the module that exported the binding, but cannot be re-assigned by the importing module.

(c) MDN

🐊Putout plugin adds ability to find and group import statements by source. Checkout in 🐊Putout Editor.

Group order:

  • ✅ builtins;
  • ✅ external;
  • ✅ internal;

Install

npm i @putout/plugin-group-imports-by-source

Rule

{
    "rules": {
        "group-imports-by-source": "on"
    }
}

❌ Example of incorrect code

import fs from 'node:fs';
import {lodash} from 'lodash';
import react from 'react';
import d from '../hello.js';
import ss from '../../bb/ss.js';
import b from './ss.js';

const c = 5;

✅ Example of correct code

import fs from 'node:fs';
import react from 'react';
import {lodash} from 'lodash';
import b from './ss.js';
import d from '../hello.js';
import ss from '../../bb/ss.js';

const c = 5;

License

MIT

Package Sidebar

Install

npm i @putout/plugin-group-imports-by-source

Weekly Downloads

1,860

Version

2.0.0

License

MIT

Unpacked Size

5.92 kB

Total Files

4

Last publish

Collaborators

  • coderaiser