{"id":14978254,"url":"https://github.com/u3u/eslint-plugin-arrow-return-style","last_synced_at":"2025-10-28T08:32:02.931Z","repository":{"id":186781809,"uuid":"675734220","full_name":"u3u/eslint-plugin-arrow-return-style","owner":"u3u","description":"Enforce arrow function return style and automatically fix it","archived":false,"fork":false,"pushed_at":"2024-09-28T22:31:13.000Z","size":1005,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-29T01:04:56.714Z","etag":null,"topics":["arrow-functions","eslint","eslint-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/u3u.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}},"created_at":"2023-08-07T15:45:43.000Z","updated_at":"2024-09-28T18:14:34.000Z","dependencies_parsed_at":"2024-02-22T19:29:41.916Z","dependency_job_id":"385a26aa-c386-4313-a0f9-f525febfb899","html_url":"https://github.com/u3u/eslint-plugin-arrow-return-style","commit_stats":{"total_commits":144,"total_committers":2,"mean_commits":72.0,"dds":0.1875,"last_synced_commit":"d03ffa43bf30f15472b32afff76b37690c711f55"},"previous_names":["u3u/eslint-plugin-arrow-return-style"],"tags_count":8,"template":false,"template_full_name":"u3u/ts-lib-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Feslint-plugin-arrow-return-style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Feslint-plugin-arrow-return-style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Feslint-plugin-arrow-return-style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Feslint-plugin-arrow-return-style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/u3u","download_url":"https://codeload.github.com/u3u/eslint-plugin-arrow-return-style/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859904,"owners_count":16556031,"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":["arrow-functions","eslint","eslint-plugin"],"created_at":"2024-09-24T13:57:08.793Z","updated_at":"2025-10-28T08:31:57.605Z","avatar_url":"https://github.com/u3u.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-arrow-return-style\n\n\u003e Enforce arrow function return style and automatically fix it\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![codecov][codecov-src]][codecov-href]\n[![License][license-src]][license-href]\n\n## Features\n\n\u003e This rule serves as an alternative to the [`arrow-body-style`](https://eslint.org/docs/latest/rules/arrow-body-style#as-needed) with `as-needed` options, used to improve the style of arrow function return statement.\n\n- When arrow function expressions are multiline or exceed a certain length, explicit return should be enforced to improve readability and extensibility.\n- When an arrow function has only one return statement (and does not contain any comments), implicit return should be used to simplify the code and improve readability.\n- When using arrow functions as named exports, explicit return should always be used to maintain consistency with regular functions.\n- When using arrow functions as React components, always use explicit return to facilitate the addition of `props` and `hooks` in the future.\n\n## Install\n\n```sh\npnpm add eslint-plugin-arrow-return-style -D\n```\n\n## Usage\n\n```js\n/** @type {import('eslint').Linter.Config} */\nmodule.exports = {\n  extends: ['plugin:arrow-return-style/recommended'],\n};\n```\n\n## Examples\n\n### Fail\n\n```tsx\n/* eslint-disable arrow-return-style/arrow-return-style */\n\nconst delay = () =\u003e\n  new Promise((resolve) =\u003e {\n    setTimeout(resolve, 1000);\n  });\n\nconst foo = () =\u003e {\n  return 'foo';\n};\n\nArray.from({ length: 10 }).map((_, i) =\u003e {\n  return i + 1;\n});\n\nconst obj = () =\u003e {\n  return { name: '' };\n};\n\nconst data = () =\u003e ({\n  name: '',\n});\n\nexport const defineConfig = \u003cT extends Linter.Config\u003e(config: T) =\u003e config;\n\nconst fn = () =\u003e /* block comment */ 1;\n\nconst Div = () =\u003e (\n  \u003c\u003e\n    \u003cdiv /\u003e\n  \u003c/\u003e\n);\n```\n\n### Pass\n\n```tsx\nconst delay = () =\u003e {\n  return new Promise((resolve) =\u003e {\n    setTimeout(resolve, 1000);\n  });\n};\n\nconst foo = () =\u003e 'foo';\n\nconst obj = () =\u003e ({ name: '' });\n\nArray.from({ length: 10 }).map((_, i) =\u003e i + 1);\n\nconst data = () =\u003e {\n  return {\n    name: '',\n  };\n};\n\nexport const defineConfig = \u003cT extends Linter.Config\u003e(config: T) =\u003e {\n  return config;\n};\n\nconst fn = () =\u003e {\n  /* block comment */\n  return 1;\n};\n\nconst Div = () =\u003e {\n  return (\n    \u003c\u003e\n      \u003cdiv /\u003e\n    \u003c/\u003e\n  );\n};\n```\n\n## Options\n\n### `maxLen`\n\nType: `number`\\\nDefault: `80`\n\nIf the arrow function expression exceeds `maxLen` characters, it is forced to use explicit return.\n\n### `jsxAlwaysUseExplicitReturn`\n\nType: `boolean`\\\nDefault: `false`\n\nIf set `true`, always use explicit return when return value is `JSXElement` or `JSXFragment`.\n\n### `namedExportsAlwaysUseExplicitReturn`\n\nType: `boolean`\\\nDefault: `true`\n\nBy default, named exported arrow functions will always use explicit return to maintain consistency with regular functions because it is more intuitive and unified, and convenient for expansion.\n\n## Rules\n\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- begin auto-generated rules list --\u003e\n\n⚠️ Configurations set to warn in.\\\n✅ Set in the `recommended` configuration.\\\n🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\n\n| Name                                                             | Description                                                                                               | ⚠️ | 🔧 |\n| :--------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------- | :- | :- |\n| [arrow-return-style](docs/rules/arrow-return-style.md)           | Enforce arrow function return style                                                                       | ✅  | 🔧 |\n| [no-export-default-arrow](docs/rules/no-export-default-arrow.md) | Disallow export default anonymous arrow function\u003cbr/\u003e_**Automatically fix using the current file name.**_ | ✅  | 🔧 |\n\n\u003c!-- end auto-generated rules list --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n## License\n\n[MIT](./LICENSE) License © 2023 [u3u](https://github.com/u3u)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/eslint-plugin-arrow-return-style\n[npm-version-href]: https://npmjs.com/package/eslint-plugin-arrow-return-style\n[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-plugin-arrow-return-style\n[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-arrow-return-style\n[codecov-src]: https://codecov.io/gh/u3u/eslint-plugin-arrow-return-style/graph/badge.svg\n[codecov-href]: https://codecov.io/gh/u3u/eslint-plugin-arrow-return-style\n[license-src]: https://img.shields.io/github/license/u3u/eslint-plugin-arrow-return-style.svg\n[license-href]: ./LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fu3u%2Feslint-plugin-arrow-return-style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fu3u%2Feslint-plugin-arrow-return-style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fu3u%2Feslint-plugin-arrow-return-style/lists"}