Skip to content

Commit bdae116

Browse files
committed
fix: loosen explicit-function-return-type
This fixes #110.
1 parent 5ed14f3 commit bdae116

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/fixture.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,13 @@ export interface Boo { b_oo: null }
2424
* ESLint should ignore this `no-undef` violation because that rule is turned off for TypeScript.
2525
*/
2626
// console.log(undef)
27+
28+
/**
29+
* https://github.com/standard/eslint-config-standard-with-typescript/issues/110
30+
*/
31+
// Inline callbacks don't need return types:
32+
setTimeout(() => {}, 1)
33+
34+
// The return type is clear from the left side of the assignment:
35+
const double: ((n: number) => number) = n => n * 2
36+
;[1, 2].map(double)

src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ test('export', (t): void => {
2121
'@typescript-eslint/array-type': ['error', 'array-simple'],
2222
'@typescript-eslint/camelcase': ['error', { properties: 'never' }],
2323
'@typescript-eslint/explicit-function-return-type': ['error', {
24-
allowHigherOrderFunctions: true
24+
allowExpressions: true,
25+
allowHigherOrderFunctions: true,
26+
allowTypedFunctionExpressions: true
2527
}],
2628
'@typescript-eslint/indent': ['error', 2, {
2729
SwitchCase: 1,

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export = {
4242
'@typescript-eslint/adjacent-overload-signatures': 'error',
4343
'@typescript-eslint/array-type': ['error', 'array-simple'],
4444
'@typescript-eslint/explicit-function-return-type': ['error', {
45-
allowHigherOrderFunctions: true
45+
allowExpressions: true,
46+
allowHigherOrderFunctions: true,
47+
allowTypedFunctionExpressions: true
4648
}],
4749
'@typescript-eslint/member-delimiter-style': [
4850
'error',

0 commit comments

Comments
 (0)