Skip to content

Latest commit

 

History

History
69 lines (58 loc) · 1.49 KB

unnecessary-arrow-block.md

File metadata and controls

69 lines (58 loc) · 1.49 KB

unnecessaryArrowBlock

Suggests using a concise arrow body when the block only returns an expression

Property Value
Category Style
Default severity off
Fixable Yes
Effect versions v3, v4
Diagnostic codes TS377084
Language Service name unnecessaryArrowBlock
Oxlint name effecttsgo/unnecessary-arrow-block

Preview

export const preview = (value: string) => {
/**
                                          ^ effecttsgo(unnecessary-arrow-block): This arrow function block only returns an expression and can use a concise body.
*/
	return value.trim()
/**
^^^^^^^^^^^^^^^^^^^^
*/
}
/**
^
*/

Language Service Configuration

See the Language Service setup guide for installation instructions.

{
  "$schema": "./node_modules/@effect/tsgo/schema.json",
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service",
        "diagnosticSeverity": {
          "unnecessaryArrowBlock": "warning"
        }
      }
    ]
  }
}

Oxlint Configuration

See the Oxlint setup guide for installation and patching instructions.

{
  "$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
  "options": {
    "typeAware": true
  },
  "plugins": ["effecttsgo"],
  "rules": {
    "effecttsgo/unnecessary-arrow-block": "warn"
  }
}