{"id":13532159,"url":"https://github.com/bfncs/codemod-imports-sort","last_synced_at":"2025-08-17T04:32:53.298Z","repository":{"id":57202422,"uuid":"87587643","full_name":"bfncs/codemod-imports-sort","owner":"bfncs","description":"Sort ES6 imports by type","archived":false,"fork":false,"pushed_at":"2018-05-07T16:37:23.000Z","size":94,"stargazers_count":38,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T03:28:52.040Z","etag":null,"topics":["codemod","esnext","import"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/codemod-imports-sort","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bfncs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-07T21:17:56.000Z","updated_at":"2023-12-22T05:46:59.000Z","dependencies_parsed_at":"2022-09-15T13:10:43.759Z","dependency_job_id":null,"html_url":"https://github.com/bfncs/codemod-imports-sort","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/bfncs/codemod-imports-sort","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fcodemod-imports-sort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fcodemod-imports-sort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fcodemod-imports-sort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fcodemod-imports-sort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfncs","download_url":"https://codeload.github.com/bfncs/codemod-imports-sort/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fcodemod-imports-sort/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270807430,"owners_count":24649342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codemod","esnext","import"],"created_at":"2024-08-01T07:01:08.620Z","updated_at":"2025-08-17T04:32:53.216Z","avatar_url":"https://github.com/bfncs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/bfncs/codemod-imports-sort.svg?branch=master)](https://travis-ci.org/bfncs/codemod-imports-sort)\n\n# CodeMod to sort ES6 imports by type\n\nUse this codemod to sort ES6 imports by type in this order:\n\n* internal Node.js modules before\n* external module imports before\n* local imports from parent folders before\n* local imports from sibling folders.\n\nImports of the same type are sorted alphabetically.\n\n## Install\n\n```bash\nyarn global add codemod-imports-sort\n```\n\n## Use\n\n```bash\ncodemod-imports-sort path/to/file.js\n```\n\n## Example\n\nBefore:\n\n```js\nimport './index.css';\nimport Beta from 'Beta';\nimport fs from 'fs';\nimport bar from '../bar';\nimport './';\nimport baz from './baz';\nimport Alpha from 'alpha';\nimport foo from '../../foo';\nimport App from './App';\n```\n\nAfter:\n\n```js\nimport fs from 'fs';\nimport Alpha from 'alpha';\nimport Beta from 'Beta';\nimport foo from '../../foo';\nimport bar from '../bar';\nimport './';\nimport App from './App';\nimport baz from './baz';\nimport './index.css';\n```\n\n### Options\n\n#### `--sortConfig FILE.json`\n\nOptionally you can pass the path to a JSON file with a config to define the desired order of imports. The config should resemble the config for the [`import/order`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md) plugin of eslint. `groups` must be an array of `string` or [`string`]. The only allowed `string`s are: `\"builtin\"`, `\"external\"`, `\"scoped-external\"`, `\"internal\"`, `\"parent\"`, `\"sibling\"`, `\"index\"`.\n\nFor example to define to sort index imports first, then internal and external modules in a alphabetically sorted group and then sibling, parent and builtin modules together in a group, use this configuration:\n\n```json\n{\n  \"groups\": [\n    \"index\",\n    [\"internal\", \"external\"],\n    [\"sibling\", \"parent\", \"builtin\"]\n  ]\n}\n```\n\nOmitted types are implicitly grouped together as the last element\n\n_Built with [jscodeshift](https://github.com/facebook/jscodeshift)._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfncs%2Fcodemod-imports-sort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfncs%2Fcodemod-imports-sort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfncs%2Fcodemod-imports-sort/lists"}