mpellegrini / fullstack-typescript-monorepo-starter

1 stars 1 forks source link

Enforce the use of arrow functions is eslint config #118

Closed mpellegrini closed 1 month ago

mpellegrini commented 1 month ago

Use https://www.npmjs.com/package/eslint-plugin-prefer-arrow along with EsLint's func-style and prefer-arrow-callback

mpellegrini commented 1 month ago
"plugins": [
  "prefer-arrow"
],
"rules": {
  "prefer-arrow/prefer-arrow-functions": [
    "error",
    {
      "disallowPrototype": true,
      "singleReturnOnly": false,
      "classPropertiesAllowed": false
    }
  ],
  "prefer-arrow-callback": [
    "error",
    { "allowNamedFunctions": true }
  ],
  "func-style": [
    "error",
    "expression",
    { "allowArrowFunctions": true }
  ]
}
mpellegrini commented 1 month ago

Also look at https://eslint.org/docs/latest/rules/arrow-body-style