{"id":23669048,"url":"https://github.com/asn007/eslint-plugin-codebox","last_synced_at":"2025-10-11T16:01:28.729Z","repository":{"id":40003175,"uuid":"115363886","full_name":"asn007/eslint-plugin-codebox","owner":"asn007","description":"ESLint plugin for rules we use at Codebox","archived":false,"fork":false,"pushed_at":"2018-10-29T10:24:08.000Z","size":143,"stargazers_count":61,"open_issues_count":8,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-03T02:29:33.865Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/asn007.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-12-25T21:26:03.000Z","updated_at":"2024-05-20T11:10:08.000Z","dependencies_parsed_at":"2022-06-26T04:01:19.462Z","dependency_job_id":null,"html_url":"https://github.com/asn007/eslint-plugin-codebox","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asn007%2Feslint-plugin-codebox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asn007%2Feslint-plugin-codebox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asn007%2Feslint-plugin-codebox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asn007%2Feslint-plugin-codebox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asn007","download_url":"https://codeload.github.com/asn007/eslint-plugin-codebox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asn007%2Feslint-plugin-codebox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259167259,"owners_count":22815640,"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","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":[],"created_at":"2024-12-29T08:16:20.236Z","updated_at":"2025-10-11T16:01:28.531Z","avatar_url":"https://github.com/asn007.png","language":"JavaScript","readme":"eslint-plugin-codebox\n===\n\nThis is a plugin we use at CodeBox for some analysis rules and fixers that are missing in other plugins, namely\n\n__codebox/sort-imports__ (fixable) - allows to sort imports in a variety of ways:\n\n  1. Group imports by them being:\n      * Node.js stdlib imports\n      * External imports (imports from node_modules)\n      * Imports from parent directory (i.e. ../../)\n      * Sibling imports (./)\n      * Imports of index file (./index', ./index.js)\n      * Absolute imports (/root/whatever/somefile)\n      * Undetected type imports (happens pretty rarely, but still)\n  2. Group imports inside first group by them being:\n      * Named imports (e.g. `import { foo } from 'bar'`)\n      * Default imports (e.g. `import React from 'react'`)\n      * Imports of the whole namespace (e.g. `imports * as foo from 'bar'`)\n      * Imports, where none of the elements is added to namespace (e.g. `import './foo'`)\n  3. And finally, sort the imports alphabetically\n\nMoreover, this rule is fixable, which means, that ESLint will reorder your imports when you run `eslint --fix` automagically. Use this rule with caution, as it may break your code if it depends on the order of imports (tip: it should not)\n\n__codebox/sort-named-imports__ (fixable) - allows to sort components inside named imports alphabetically, i.e.\n\nIncorrect code for this rule:\n```js\nimport { b, a } from 'foo'\n```\n\nCorrect code:\n```js\nimport { a, b } from 'foo'\n```\n\nWARNING:\n===\nThis plugin is still in a very early stage of development. More features will be added in the upcoming time, if you still wish to use it:\n\n```\nnpm install --saveDev eslint-plugin-codebox\n```\n\nAdd to plugins sections of your .eslintrc:\n\n```json\n\"plugins\": [\n  \"codebox\"\n]\n```\n\nConfigure the rules you want:\n```js\nmodule.exports = {\n  \"rules\": {\n    \"codebox/sort-imports\": [\"error\", {\n      \"groups\": [\n        \"builtin\",  // builtin dependencies go first\n        \"external\", // then external dependencies\n        \"parent\",   // then parent\n        \"sibling\",  // ...ok, you got it\n        \"index\",\n        [\"unknown\", \"absolute\"] // An array inside array of groups means that these two groups share same priority for sorting\n      ],\n      \"importTypes\": [\n        \"default\", // Default imports are at top of each group\n        \"named\",   // After that - named imports\n        \"all\",     // Imports of the whole namespace\n        \"none\"     // Plain import\n      ],\n      \"ignoreCase\": true // Indicates whether we want to ignore case during alphabetical sorting\n    }],\n    \"codebox/sort-named-imports\": [\"error\", {\n      \"ignoreCase\": true // Indicates whether we want to ignore case during alphabetical sorting\n    }] \n  }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasn007%2Feslint-plugin-codebox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasn007%2Feslint-plugin-codebox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasn007%2Feslint-plugin-codebox/lists"}