{"id":50422929,"url":"https://github.com/soybeanjs/oxc-config","last_synced_at":"2026-05-31T09:04:12.186Z","repository":{"id":358964158,"uuid":"1243898564","full_name":"soybeanjs/oxc-config","owner":"soybeanjs","description":"SoybeanJS's oxlint and oxfmt config","archived":false,"fork":false,"pushed_at":"2026-05-19T19:35:10.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-19T23:06:39.084Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soybeanjs.png","metadata":{"files":{"readme":"README.en.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-19T19:18:05.000Z","updated_at":"2026-05-19T19:35:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/soybeanjs/oxc-config","commit_stats":null,"previous_names":["soybeanjs/oxc-config"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/soybeanjs/oxc-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soybeanjs%2Foxc-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soybeanjs%2Foxc-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soybeanjs%2Foxc-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soybeanjs%2Foxc-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soybeanjs","download_url":"https://codeload.github.com/soybeanjs/oxc-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soybeanjs%2Foxc-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33725061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"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":[],"created_at":"2026-05-31T09:04:11.350Z","updated_at":"2026-05-31T09:04:12.172Z","avatar_url":"https://github.com/soybeanjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @soybeanjs/oxc-config\n\n[![npm version](https://img.shields.io/npm/v/@soybeanjs/oxc-config)](https://www.npmjs.com/package/@soybeanjs/oxc-config)\n[![license](https://img.shields.io/github/license/soybeanjs/oxc-config)](https://github.com/soybeanjs/oxc-config/blob/main/LICENSE)\n\nShared [oxlint](https://oxc.rs/docs/guide/usage/linter.html) and [oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) configuration for SoybeanJS projects.\n\n\u003e [中文](./README.md) | English\n\n## Features\n\n- 🚀 **oxfmt formatter config** — Unified code style with fine-grained import sorting groups\n- 🔍 **oxlint linter config** — Integrated with ESLint / TypeScript / Unicorn / Vue plugins\n- 📦 **Import sorting** — Auto-group and sort imports by dependency layer\n- 🎯 **custom import plugin** — Includes auto-merging duplicate imports, disallowing inline type imports, and enforcing value imports before type imports\n\n## Installation\n\n```bash\npnpm add -D @soybeanjs/oxc-config oxfmt oxlint\n```\n\n## Usage\n\n### oxfmt\n\nCreate `oxfmt.config.ts` at project root:\n\n```ts\nimport { fmt } from '@soybeanjs/oxc-config';\n\nexport default fmt;\n```\n\nYou can also extend it:\n\n```ts\nimport { fmt } from '@soybeanjs/oxc-config';\n\nexport default {\n  ...fmt,\n  printWidth: 100 // Override defaults\n};\n```\n\n#### Import Sort Groups\n\nImports are automatically grouped and sorted by dependency layer:\n\n| Order | Group                                      | Description                                                                                        |\n| ----- | ------------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| 1     | `builtin`                                  | Node.js built-in modules (`node:fs`, `node:path`, etc.)                                            |\n| 2     | `external-*`                               | External deps by layer in `order.json` (build-tools → test → framework → state → UI → CSS → utils) |\n| 3     | `external`                                 | Other unclassified external deps                                                                   |\n| 4     | `side_effect` / `side_effect_style`        | Side-effect and style side-effect imports                                                          |\n| 5     | `internal-*`                               | Project aliases (`@/`) by layer (config → infra → data → state → logic → views)                    |\n| 6     | `internal`                                 | Other unclassified internal imports                                                                |\n| 7     | `subpath` / `parent` / `sibling` / `index` | Relative path imports                                                                              |\n| 8     | `style`                                    | Stylesheet imports                                                                                 |\n| 9     | `unknown`                                  | Unknown import types                                                                               |\n\nExternal dependency sort order (`order.json`):\n\n```\nBuild tools (vite, webpack, esbuild, tsdown...)\n  → Testing (vitest, playwright, cypress...)\n  → Frameworks (vue, nuxt, react, next...)\n  → State management (pinia, zustand, jotai...)\n  → UI libraries (element-plus, ant-design-vue, naive-ui...)\n  → CSS engines (tailwindcss, unocss, postcss...)\n  → Utilities (axios, date-fns, es-toolkit, @tanstack/**...)\n```\n\nInternal alias sort order (`order.json`):\n\n```\nConfig (config, setting, constants...)\n  → Shared/Utils (shared, utils, lib...)\n  → Plugins/Directives (plugins, directives...)\n  → Middleware (middleware...)\n  → Data layer (api, service...)\n  → i18n (i18n, locales...)\n  → State (store, context...)\n  → Composables/Hooks (composables, hooks...)\n  → Router (router...)\n  → Feature modules (modules...)\n  → Views (components...)\n  → Styles/Assets (styles, assets...)\n```\n\n\u003e See the full ordering in `node_modules/@soybeanjs/oxc-config/dist/order.json`, or customize by editing `src/order.json` in the source.\n\n### oxlint\n\nCreate `oxlint.config.ts` at project root:\n\n```ts\nimport { lint } from '@soybeanjs/oxc-config';\n\nexport default lint;\n```\n\n#### Enabled Plugins\n\n- **eslint** — ESLint-compatible rules\n- **typescript** — TypeScript-specific rules\n- **unicorn** — Best practice rules\n- **oxc** — OXC-specific rules\n- **import** — Import/Export rules\n- **vue** — Vue SFC rules\n\n#### Custom Rules: soybeanjs-import\n\nThis config ships with a custom oxlint JS plugin loaded from `@soybeanjs/oxc-config/plugins/import`, with 3 built-in rules:\n\n- `soybeanjs-import/merge-duplicates`: keep at most one value import and one type import per module, and auto-merge duplicate imports\n- `soybeanjs-import/no-inline-type-import`: disallow inline type imports like `import { type Foo }`, and auto-convert them to top-level `import type`\n- `soybeanjs-import/type-after-value`: ensure value imports come before type imports for the same module\n\nExamples:\n\n```ts\n// ✅ After fixing\nimport { a, b } from './types';\nimport type { DemoTest } from './types';\n\n// ❌ Duplicate imports\nimport { b } from './types';\nimport { a } from './types';\nimport type { DemoTest } from './types';\n```\n\n```ts\n// ✅ After fixing\nimport { a } from './types';\nimport type { DemoTest } from './types';\n\n// ❌ Inline type import\nimport { a, type DemoTest } from './types';\n```\n\n```ts\n// ✅ Correct\nimport { ref } from 'vue';\nimport type { Ref } from 'vue';\n\n// ❌ Incorrect\nimport type { Ref } from 'vue';\nimport { ref } from 'vue';\n```\n\nThe exported `lint` config already includes this plugin and rule. To override or extend:\n\n```ts\nimport { lint } from '@soybeanjs/oxc-config';\n\nexport default {\n  ...lint,\n  jsPlugins: ['@soybeanjs/oxc-config/plugins/import'],\n  rules: {\n    'soybeanjs-import/merge-duplicates': 'warn',\n    'soybeanjs-import/no-inline-type-import': 'warn',\n    'soybeanjs-import/type-after-value': 'warn'\n  }\n};\n```\n\n## Scripts\n\nAdd to your `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"lint\": \"oxlint --fix\",\n    \"fmt\": \"oxfmt\"\n  }\n}\n```\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoybeanjs%2Foxc-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoybeanjs%2Foxc-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoybeanjs%2Foxc-config/lists"}