{"name":"eslint-plugin-prefer-arrow-functions","description":"Convert functions to arrow functions","version":"3.10.2","author":{"name":"Jamie Mason","url":"https://github.com/JamieMason"},"bugs":{"url":"https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions/issues"},"contributors":[{"name":"Саша “Nelie” Черных","url":"https://github.com/Kristinita"},{"name":"Anders Kaseorg","url":"https://github.com/andersk"},{"name":"Gabriel Montes","url":"https://github.com/gabmontes"},{"name":"Gürgün Dayıoğlu","url":"https://github.com/gurgunday"},{"name":"Harel Moshe","url":"https://github.com/harelmo"},{"name":"Keith Lea","url":"https://github.com/keithkml"},{"name":"Lou Cyx","url":"https://github.com/loucyx"},{"name":"Marek Dědič","url":"https://github.com/marekdedic"},{"name":"Michael Gallagher","url":"https://github.com/mikeapr4"},{"name":"Mitchell Merry","url":"https://github.com/mitchell-merry"},{"name":"Nicolas Bouvrette","url":"https://github.com/nbouvrette"},{"name":"Pablo Enrici","url":"https://github.com/pablen"},{"name":"Renato Böhler","url":"https://github.com/renato-bohler"},{"name":"Samuel T","url":"https://github.com/SamuelT-Beslogic"},{"name":"Triston Jones","url":"https://github.com/TristonJ"}],"dependencies":{"@typescript-eslint/types":"^8.66.0","@typescript-eslint/utils":"^8.66.0"},"devDependencies":{"@eslint/eslintrc":"3.3.6","@eslint/js":"10.0.1","@release-it/conventional-changelog":"12.0.0","@types/node":"26.2.0","@typescript-eslint/eslint-plugin":"8.66.0","@typescript-eslint/parser":"8.66.0","@typescript-eslint/rule-tester":"8.66.0","@vitest/coverage-v8":"4.1.10","auto-changelog":"2.6.0","eslint":"10.8.1","globals":"17.9.0","prettier":"3.9.6","release-it":"21.0.1","rimraf":"6.1.3","typescript":"6.0.3","vitest":"4.1.10"},"engines":{"node":"^20.19.0 || ^22.13.0 || >=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"homepage":"https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions","keywords":["es6","eslint","eslint-plugin"],"license":"MIT","main":"dist/index.js","peerDependencies":{"eslint":"^8.57.0 || ^9.0.0 || ^10.0.0"},"repository":{"type":"git","url":"git+https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions.git"},"scripts":{"build":"tsc --project .","format":"prettier --write src test","lint":"eslint .","prebuild":"rimraf ./dist","prelint":"npm run format","prepack":"npm run build","pretest":"npm run typecheck","release":"release-it","test":"vitest run","test:watch":"vitest watch","typecheck":"tsc --project tsconfig.test.json"},"type":"commonjs","gitHead":"d65cd0477437fa07a11a6868c65437db63cf8fac","types":"./dist/index.d.ts","_id":"eslint-plugin-prefer-arrow-functions@3.10.2","_nodeVersion":"24.11.1","_npmVersion":"11.18.0","dist":{"integrity":"sha512-vy4neIgDcqHNTEohqUXQH6WD7S4rJBDm9I1hoHYCc7ytMMCZ0+MgYcre+ZRP13W/1nYdL/ZtbrGKjhoz/UvhMg==","shasum":"77d8ebb7669ce4706d0d5618b4402f28fb4fbb75","tarball":"http://registry-npm.ywwl.com/eslint-plugin-prefer-arrow-functions/download/eslint-plugin-prefer-arrow-functions-3.10.2.tgz","fileCount":18,"unpackedSize":105656,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDp5//2Xa8wqAsGz9s9uvDss/rKEOPSaohquq+ThkAJ/wIgBXdJCvWbTsdbwzJBPeImmac5wqAgPmDtEiUyE18eaVw="}],"size":24768,"noattachment":false,"key":"/eslint-plugin-prefer-arrow-functions/-/eslint-plugin-prefer-arrow-functions-3.10.2.tgz"},"_npmUser":{"name":"fold_left","email":"jamie@foldleft.io"},"directories":{},"maintainers":[{"name":"fold_left","email":"jamie@foldleft.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/eslint-plugin-prefer-arrow-functions_3.10.2_1786273872376_0.8092474816403592"},"_hasShrinkwrap":false,"readme":"# eslint-plugin-prefer-arrow-functions\n\n> An ESLint Plugin to Lint and auto-fix plain Functions into Arrow Functions, in all cases where conversion would result\n> in the same behaviour (Arrow Functions do not support `this`, `arguments`, or `new.target` for example).\n\n## Installation\n\n```bash\nnpm install --save-dev eslint eslint-plugin-prefer-arrow-functions\n```\n\n## Configuration\n\n### Flat\n\nFor ESLint 9 and above, use the shared config `all` in `eslint.config.mjs`:\n\n```js\nimport pluginJs from '@eslint/js';\nimport preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions';\n\nexport default [\n  pluginJs.configs.all,\n  preferArrowFunctions.configs.all,\n];\n```\n\nOr configure the rule(s) on your own:\n\n```js\nimport pluginJs from '@eslint/js';\nimport preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions';\n\nexport default [\n  pluginJs.configs.all,\n  {\n    plugins: {\n      'prefer-arrow-functions': preferArrowFunctions\n    },\n    rules: {\n      'prefer-arrow-functions/prefer-arrow-functions': [\n        'warn',\n        {\n          allowedNames: [],\n          allowNamedFunctions: false,\n          allowObjectProperties: false,\n          classPropertiesAllowed: false,\n          disallowPrototype: false,\n          returnStyle: 'unchanged',\n          singleReturnOnly: false,\n        },\n      ],\n    },\n  },\n];\n```\n\n### Legacy\n\nFor ESLint 8 (8.57.0 or newer).\n\nAdd the plugin to the `plugins` section and the rule to the `rules` section in your `.eslintrc`. The default values for\noptions are listed in this example.\n\n```json\n{\n  \"plugins\": [\"prefer-arrow-functions\"],\n  \"rules\": {\n    \"prefer-arrow-functions/prefer-arrow-functions\": [\n      \"warn\",\n      {\n        \"allowedNames\": [],\n        \"allowNamedFunctions\": false,\n        \"allowObjectProperties\": false,\n        \"classPropertiesAllowed\": false,\n        \"disallowPrototype\": false,\n        \"returnStyle\": \"unchanged\",\n        \"singleReturnOnly\": false\n      }\n    ]\n  }\n}\n```\n\n## Options\n\n### `allowedNames`\n\nAn optional array of function names to ignore. When set, the rule won't report named functions such as\n`function foo() {}` whose name is identical to a member of this array.\n\nFor compatibility with [@angular-eslint/require-lifecycle-on-prototype](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/require-lifecycle-on-prototype.md), you can do:\n\n```js\nimport { ASTUtils } from \"@angular-eslint/utils\"\n\n// ...\n  {\n    rules: {\n      'prefer-arrow-functions/prefer-arrow-functions': [\n        'warn',\n        {\n          // ...\n          allowedNames: [...ASTUtils.ANGULAR_LIFECYCLE_METHODS],\n        },\n      ],\n    },\n  },\n```\n\n### `allowNamedFunctions`\n\nControls how named functions are handled:\n\n- When `true`, the rule won't report any named functions such as `function foo() {}`. Anonymous functions such as\n  `const foo = function() {}` will still be reported.\n- When `\"only-expressions\"`, the rule will allow named function expressions (like `callback(function namedFn() {})`) but\n  will still transform named function declarations (like `function foo() {}`).\n- When `false` (default), all functions will be transformed to arrow functions when safe to do so.\n\n### `allowObjectProperties`\n\nIf set to true, the rule won't report named methods such as\n\n```js\nconst myObj = {\n  hello() {},\n};\n```\n\n### `classPropertiesAllowed`\n\nWhen `true`, functions defined as\n[class instance fields](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Field_declarations)\nwill be converted to arrow functions when doing so would not alter or break their behaviour.\n\n### `disallowPrototype`\n\nWhen `true`, functions assigned to a `prototype` will be converted to arrow functions when doing so would not alter or\nbreak their behaviour.\n\n### `returnStyle`\n\n- When `\"implicit\"`, arrow functions such as `x => { return x; }` will be converted to `x => x`.\n- When `\"explicit\"`, arrow functions such as `x => x` will be converted to `x => { return x; }`.\n- When `\"unchanged\"` or not set, arrow functions will be left as they were.\n\n### `singleReturnOnly`\n\nWhen `true`, only `function` declarations which _only_ contain a return statement will be converted. Functions\ncontaining block statements will be ignored.\n\n> This option works well in conjunction with ESLint's built-in\n> [arrow-body-style](http://eslint.org/docs/rules/arrow-body-style) set to `as-needed`.\n\n## Credits\n\nThis project is a fork of <https://github.com/TristonJ/eslint-plugin-prefer-arrow> by\n[Triston Jones](https://github.com/TristonJ).\n\n## Badges\n\n- [![support on ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/C0C4PY4P)\n- [![NPM version](http://img.shields.io/npm/v/eslint-plugin-prefer-arrow-functions.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-prefer-arrow-functions)\n- [![NPM downloads](http://img.shields.io/npm/dm/eslint-plugin-prefer-arrow-functions.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-prefer-arrow-functions)\n- [![Build Status](https://img.shields.io/github/actions/workflow/status/JamieMason/eslint-plugin-prefer-arrow-functions/ci.yaml?branch=main)](https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions/actions)\n","publish_time":1786273872553,"_cnpm_publish_time":1786273872553,"dist-tags":{"latest":"3.10.2"}}