{"id":14978321,"url":"https://github.com/so1ve/codestyle-config","last_synced_at":"2026-01-02T17:21:02.177Z","repository":{"id":41068225,"uuid":"471864064","full_name":"so1ve/codestyle-config","owner":"so1ve","description":"Powerful codestyle config preset","archived":false,"fork":false,"pushed_at":"2025-04-01T09:25:48.000Z","size":3802,"stargazers_count":27,"open_issues_count":14,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T10:52:17.703Z","etag":null,"topics":["codestyle","eslint","eslint-config","eslint-plugin","eslint-rules","formatter","prettier"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"antfu/eslint-config","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/so1ve.png","metadata":{"files":{"readme":"README.md","changelog":null,"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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://afdian.net/@so1ve"]}},"created_at":"2022-03-20T02:55:46.000Z","updated_at":"2025-02-09T13:09:58.000Z","dependencies_parsed_at":"2023-02-14T17:46:36.511Z","dependency_job_id":"a649ed77-06b5-46c9-934c-e0691f92dd6e","html_url":"https://github.com/so1ve/codestyle-config","commit_stats":{"total_commits":984,"total_committers":5,"mean_commits":196.8,"dds":"0.46239837398373984","last_synced_commit":"3370e3701889978b03a7d9a4725efdb98c1eed58"},"previous_names":["so1ve/eslint-config","so1ve/codestyle-config","so1ve/eslint-prettier-config"],"tags_count":362,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Fcodestyle-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Fcodestyle-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Fcodestyle-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Fcodestyle-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/so1ve","download_url":"https://codeload.github.com/so1ve/codestyle-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471397,"owners_count":20944154,"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":["codestyle","eslint","eslint-config","eslint-plugin","eslint-rules","formatter","prettier"],"created_at":"2024-09-24T13:57:22.814Z","updated_at":"2025-12-28T03:04:19.279Z","avatar_url":"https://github.com/so1ve.png","language":"TypeScript","readme":"# Ray's Codestyle Config\n\n[![npm](https://img.shields.io/npm/v/@so1ve/eslint-config?color=a1b858\u0026label=)](https://npmjs.com/package/@so1ve/eslint-config)\n\n\u003e Forked from [antfu/eslint-config](https://github.com/antfu/eslint-config)\n\n## Features\n\n- Double quotes, with semicolons\n- Use 2 spaces for indent\n- Auto fix for formatting (Powered by [Prettier](https://github.com/prettier/prettier))\n- Supports TypeScript, Vue, React, Svelte, Solid, MDX, JSON, Yaml, Markdown, HTML out-of-box!\n- Sorted imports, dangling commas for cleaner commit diff\n- Autofix for syntax errors, e.g. automatically add `async` keyword when using `await` in a non-async function\n- Focused on consistent code style, with custom rules to enforce style\n- Reasonable defaults, best practices, only one-line of config\n- Respects `.gitignore` by default\n- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!\n- **Style principle**: Consistent for reading, stable for diff. More automated style fixes is better.\n\n\u003e [!IMPORTANT]\n\u003e The main branch is for v3.0, which rewrites to ESLint Flat config and requires ESLint v9.0.0+.\n\n\u003e Thanks to [sxzz/eslint-config](https://github.com/sxzz/eslint-config) and [antfu/eslint-config](https://github.com/antfu/eslint-config) for the inspiration and reference.\n\n## Usage\n\n### Install\n\n```bash\npnpm add -D eslint prettier @so1ve/eslint-config @so1ve/prettier-config\n```\n\n### Config `eslint.config.mjs` and `prettier.config.mjs`\n\n```js\n// eslint.config.mjs\nimport { so1ve } from \"@so1ve/eslint-config\";\n\nexport default so1ve();\n```\n\n```js\n// prettier.config.mjs\nexport { default } from \"@so1ve/prettier-config\";\n```\n\n\u003e Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.\n\n### Add script for package.json\n\nFor example:\n\n```json\n{\n  \"scripts\": {\n    \"lint\": \"eslint . \u0026\u0026 prettier . --check\",\n    \"lint:fix\": \"eslint . --fix \u0026\u0026 prettier . --write\"\n  }\n}\n```\n\n### Config VS Code auto fix\n\nCreate `.vscode/settings.json`\n\n```json\n{\n  \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n  \"editor.formatOnSave\": true,\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": \"explicit\"\n  },\n  \"eslint.validate\": [\n    \"javascript\",\n    \"typescript\",\n    \"javascriptreact\",\n    \"typescriptreact\",\n    \"vue\",\n    \"html\",\n    \"markdown\",\n    \"json\",\n    \"jsonc\",\n    \"json5\",\n    \"toml\",\n    \"yaml\",\n    \"svelte\",\n    \"github-actions-workflow\"\n  ]\n}\n```\n\n## Customization\n\nSince v1.0, we migrated to [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new). It provides a much better organization and composition.\n\nNormally you only need to import the `so1ve` preset:\n\n```js\n// eslint.config.js\nimport { so1ve } from \"@so1ve/eslint-config\";\n\nexport default so1ve();\n```\n\nAnd that's it! Or you can configure each integration individually, for example:\n\n```js\n// eslint.config.js\nimport { so1ve } from \"@so1ve/eslint-config\";\n\nexport default so1ve(\n  {\n    typescript: true,\n    vue: true,\n    solid: false,\n    jsonc: false,\n    yaml: false,\n  },\n  {\n    // `.eslintignore` is no longer supported in Flat config, use `ignores` instead\n    // also supports function to modify the default ignores\n    ignores: [\n      \"./fixtures\",\n      // ...globs\n    ],\n  },\n);\n```\n\nThe `so1ve` factory function also accepts any number of arbitrary custom config overrides:\n\n```js\n// eslint.config.js\nimport { so1ve } from \"@so1ve/eslint-config\";\n\nexport default so1ve(\n  {\n    // Configures for so1ve's config\n  },\n  // From the second arguments they are ESLint Flat Configs\n  // you can have multiple configs\n  {\n    files: [\"**/*.ts\"],\n    rules: {},\n  },\n  {\n    rules: {},\n  },\n);\n```\n\n## Plugins Renaming\n\nSince flat config requires us to explicitly provide the plugin names (instead of mandatory convention from npm package name), we renamed some plugins to make overall scope more consistent and easier to write.\n\n| New Prefix | Original Prefix        | Source Plugin                                                                              |\n| ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |\n| `import/*` | `import-x/*`           | [eslint-plugin-import-x](https://github.com/un-es/eslint-plugin-import-x)                  |\n| `node/*`   | `n/*`                  | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n)                     |\n| `yaml/*`   | `yml/*`                | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml)                        |\n| `style/*`  | `@stylistic/*`         | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic)           |\n| `ts/*`     | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |\n| `html/*`   | `@html-eslint/*`       | [@html-eslint/eslint-plugin](https://github.com/yeonjuan/html-eslint)                      |\n\nWhen you want to override rules, or disable them inline, you need to update to the new prefix:\n\n```diff\n-// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n+// eslint-disable-next-line ts/consistent-type-definitions\ntype foo = { bar: 2 }\n```\n\n### Rules Overrides\n\nCertain rules would only be enabled in specific files, for example, `ts/*` rules would only be enabled in `.ts` files and `vue/*` rules would only be enabled in `.vue` files. If you want to override the rules, you need to specify the file extension:\n\n```js\n// eslint.config.js\nimport { so1ve } from \"@so1ve/eslint-config\";\n\nexport default so1ve(\n  { vue: true, typescript: true },\n  {\n    // Remember to specify the file glob here, otherwise it might cause the vue plugin to handle non-vue files\n    files: [\"**/*.vue\"],\n    rules: {\n      \"vue/operator-linebreak\": [\"error\", \"before\"],\n    },\n  },\n  {\n    // Without `files`, they are general rules for all files\n    rules: {\n      \"style/semi\": [\"error\", \"never\"],\n    },\n  },\n);\n```\n\nWe also provided a `overrides` options in each integration to make it easier:\n\n```js\n// eslint.config.js\nimport { so1ve } from \"@so1ve/eslint-config\";\n\nexport default so1ve({\n  vue: {\n    overrides: {\n      \"vue/operator-linebreak\": [\"error\", \"before\"],\n    },\n  },\n  typescript: {\n    overrides: {\n      \"ts/consistent-type-definitions\": [\"error\", \"interface\"],\n    },\n  },\n  yaml: {\n    overrides: {\n      // ...\n    },\n  },\n});\n```\n\n### Config Composer\n\nThe factory function `so1ve()` returns a [`FlatConfigComposer` object from `eslint-flat-config-utils`](https://github.com/antfu/eslint-flat-config-utils#composer) where you can chain the methods to compose the config even more flexibly.\n\n```js\n// eslint.config.js\nimport { so1ve } from \"@so1ve/eslint-config\";\n\nexport default so1ve()\n  // some configs before the main config\n  .prepend()\n  // overrides any named configs\n  .override(\"so1ve/imports/rules\", {\n    rules: {\n      \"import/named\": \"off\",\n    },\n  })\n  // rename plugin prefixes\n  .renamePlugins({\n    \"old-prefix\": \"new-prefix\",\n    // ...\n  });\n// ...\n```\n\n### Type Aware Rules\n\n[Type Aware Rules](https://typescript-eslint.io/linting/typed-linting/) are enabled by default.\n\n## License\n\nMIT\n","funding_links":["https://afdian.net/@so1ve"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fso1ve%2Fcodestyle-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fso1ve%2Fcodestyle-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fso1ve%2Fcodestyle-config/lists"}