{"name":"eslint-plugin-prefer-arrow-functions","version":"3.10.1","keywords":["es6","eslint","eslint-plugin"],"author":{"url":"https://github.com/JamieMason","name":"Jamie Mason"},"license":"MIT","_id":"eslint-plugin-prefer-arrow-functions@3.10.1","maintainers":[{"name":"fold_left","email":"jamie@foldleft.io"}],"contributors":[{"url":"https://github.com/Kristinita","name":"Саша “Nelie” Черных"},{"url":"https://github.com/andersk","name":"Anders Kaseorg"},{"url":"https://github.com/gabmontes","name":"Gabriel Montes"},{"url":"https://github.com/gurgunday","name":"Gürgün Dayıoğlu"},{"url":"https://github.com/harelmo","name":"Harel Moshe"},{"url":"https://github.com/keithkml","name":"Keith Lea"},{"url":"https://github.com/loucyx","name":"Lou Cyx"},{"url":"https://github.com/marekdedic","name":"Marek Dědič"},{"url":"https://github.com/mikeapr4","name":"Michael Gallagher"},{"url":"https://github.com/mitchell-merry","name":"Mitchell Merry"},{"url":"https://github.com/nbouvrette","name":"Nicolas Bouvrette"},{"url":"https://github.com/pablen","name":"Pablo Enrici"},{"url":"https://github.com/renato-bohler","name":"Renato Böhler"},{"url":"https://github.com/SamuelT-Beslogic","name":"Samuel T"},{"url":"https://github.com/TristonJ","name":"Triston Jones"}],"homepage":"https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions","bugs":{"url":"https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions/issues"},"dist":{"shasum":"5a120f00125b537c61903df6456cb86d591e031f","tarball":"http://registry-npm.ywwl.com/eslint-plugin-prefer-arrow-functions/download/eslint-plugin-prefer-arrow-functions-3.10.1.tgz","fileCount":18,"integrity":"sha512-wutwnNG0S/wqNhqryS7ee2yX01dkvgFMDvdaXcdEfSGcxz37FRfJUCD0YL2Jur0ANCKocgplF7n6GBPhe+DNNg==","signatures":[{"sig":"MEUCIQDE+pX2SPDAJkczJVK06+mD+2kdzcpbc9wMJ7eIB+Ke0gIgYylOcCqWV7AG/BJur5mUcsJYQlIcM/X0nQMw/7pl0GU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":84637,"size":20800,"noattachment":false,"key":"/eslint-plugin-prefer-arrow-functions/-/eslint-plugin-prefer-arrow-functions-3.10.1.tgz"},"main":"dist/index.js","type":"commonjs","types":"./dist/index.d.ts","engines":{"node":"^20.19.0 || ^22.13.0 || >=24.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"a939e9d639d57767292b3b28c27152fc999697ac","scripts":{"lint":"eslint .","test":"vitest run","build":"tsc --project .","format":"prettier --write src test","prelint":"npm run format","prepack":"npm run build","pretest":"npm run typecheck","release":"release-it","prebuild":"rimraf ./dist","typecheck":"tsc --project tsconfig.test.json","test:watch":"vitest watch"},"_npmUser":{"name":"fold_left","email":"jamie@foldleft.io"},"repository":{"url":"git+https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions.git","type":"git"},"_npmVersion":"11.17.0","description":"Convert functions to arrow functions","directories":{},"_nodeVersion":"24.11.1","dependencies":{"@typescript-eslint/types":"^8.62.1","@typescript-eslint/utils":"^8.62.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"10.6.0","rimraf":"6.1.3","vitest":"4.1.9","globals":"17.7.0","prettier":"3.9.4","@eslint/js":"10.0.1","release-it":"20.2.1","typescript":"6.0.3","@types/node":"26.1.0","auto-changelog":"2.6.0","@eslint/eslintrc":"3.3.5","@vitest/coverage-v8":"4.1.9","@typescript-eslint/parser":"8.62.1","@typescript-eslint/rule-tester":"8.62.1","@typescript-eslint/eslint-plugin":"8.62.1","@release-it/conventional-changelog":"11.0.1"},"peerDependencies":{"eslint":"^8.57.0 || ^9.0.0 || ^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/eslint-plugin-prefer-arrow-functions_3.10.1_1783117108882_0.3729569480239254","host":"s3://npm-registry-packages-npm-production"},"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":1783117109032,"_cnpm_publish_time":1783117109032,"dist-tags":{"latest":"3.10.2"}}