Skip to content

Commit 59dd7e6

Browse files
docs: update func-style with examples (#19793)
1 parent 62b1c1b commit 59dd7e6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/src/rules/func-style.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,18 @@ const foo = () => {};
176176

177177
### allowTypeAnnotation
178178

179+
Examples of **incorrect** TypeScript code for this rule with the `"declaration", { "allowTypeAnnotation": true }` options:
180+
181+
::: incorrect
182+
183+
```ts
184+
/*eslint func-style: ["error", "declaration", { "allowTypeAnnotation": true }]*/
185+
186+
const foo = function(): void {};
187+
```
188+
189+
:::
190+
179191
Examples of **correct** TypeScript code for this rule with the `"declaration", { "allowTypeAnnotation": true }` options:
180192

181193
::: correct
@@ -260,6 +272,18 @@ export function foo() {
260272

261273
:::
262274

275+
Examples of **correct** code for this rule with the `"expression"` and `{ "allowTypeAnnotation": true, "overrides": { "namedExports": "declaration" }}` option:
276+
277+
::: correct
278+
279+
```ts
280+
/*eslint func-style: ["error", "expression", { "allowTypeAnnotation": true, "overrides": { "namedExports": "declaration" } }]*/
281+
282+
export const foo: () => void = function () {}
283+
```
284+
285+
:::
286+
263287
##### ignore
264288

265289
Examples of **correct** code for this rule with the `{"overrides": { "namedExports": "ignore" }}` option:

0 commit comments

Comments
 (0)