{"name":"eslint-plugin-prefer-arrow-functions","version":"3.6.2","keywords":["es6","eslint","eslint-plugin"],"author":{"url":"https://github.com/JamieMason","name":"Jamie Mason"},"license":"MIT","_id":"eslint-plugin-prefer-arrow-functions@3.6.2","maintainers":[{"name":"fold_left","email":"jamie@foldleft.io"}],"contributors":[{"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/pablen","name":"Pablo Enrici"},{"url":"https://github.com/renato-bohler","name":"Renato Böhler"},{"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":"f34e0420937428c3d635c47b23fed2badd96a0be","tarball":"http://registry-npm.ywwl.com/eslint-plugin-prefer-arrow-functions/download/eslint-plugin-prefer-arrow-functions-3.6.2.tgz","fileCount":18,"integrity":"sha512-rSgMW1GFRXacz4FoLV+y56QoDj+pQOtpikaFL2OzEpoDK4umMMG4ONd9W59NLqSjstRqHjefrxco5KRkqxAe9g==","signatures":[{"sig":"MEUCIEyWCpDFIHn3+78AGZeXsGMJg9kcpDWn1siGKOFS51PwAiEAnZy+nY18BM2MAuqHyQaq0REwxpY8YkCUzbplqfqe8Sk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43298,"size":10882,"noattachment":false,"key":"/eslint-plugin-prefer-arrow-functions/-/eslint-plugin-prefer-arrow-functions-3.6.2.tgz"},"main":"dist/index.js","type":"commonjs","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"34c519d4dcde5a3ea14c5530182bef52f34e526f","scripts":{"lint":"eslint .","test":"vitest run","build":"tsc --project .","format":"prettier --write src test","prelint":"npm run format","prepack":"npm run build","release":"release-it","prebuild":"rimraf ./dist","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":"10.9.2","description":"Convert functions to arrow functions","directories":{},"_nodeVersion":"20.10.0","dependencies":{"@typescript-eslint/types":"8.19.1","@typescript-eslint/utils":"8.19.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"9.17.0","rimraf":"6.0.1","vitest":"2.1.8","globals":"15.14.0","prettier":"3.4.2","@eslint/js":"9.17.0","release-it":"17.11.0","typescript":"5.7.3","@types/node":"22.10.5","@types/eslint":"9.6.1","auto-changelog":"2.5.0","@eslint/eslintrc":"3.2.0","@vitest/coverage-v8":"2.1.8","@typescript-eslint/parser":"8.19.1","@typescript-eslint/rule-tester":"8.19.1","@typescript-eslint/eslint-plugin":"8.19.1","@release-it/conventional-changelog":"8.0.2"},"peerDependencies":{"eslint":">=9.17.0"},"_npmOperationalInternal":{"tmp":"tmp/eslint-plugin-prefer-arrow-functions_3.6.2_1736787220470_0.04967461514235083","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":1736787220659,"_cnpm_publish_time":1736787220659,"dist-tags":{"latest":"3.10.2"}}