Skip to content

Commit

Permalink
fix: loosen explicit-function-return-type
Browse files Browse the repository at this point in the history
This fixes #110.
  • Loading branch information
swansontec committed Aug 15, 2019
1 parent 5ed14f3 commit bdae116
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ export interface Boo { b_oo: null }
* ESLint should ignore this `no-undef` violation because that rule is turned off for TypeScript.
*/
// console.log(undef)

/**
* https://github.com/standard/eslint-config-standard-with-typescript/issues/110
*/
// Inline callbacks don't need return types:
setTimeout(() => {}, 1)

// The return type is clear from the left side of the assignment:
const double: ((n: number) => number) = n => n * 2
;[1, 2].map(double)
4 changes: 3 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ test('export', (t): void => {
'@typescript-eslint/array-type': ['error', 'array-simple'],
'@typescript-eslint/camelcase': ['error', { properties: 'never' }],
'@typescript-eslint/explicit-function-return-type': ['error', {
allowHigherOrderFunctions: true
allowExpressions: true,
allowHigherOrderFunctions: true,
allowTypedFunctionExpressions: true
}],
'@typescript-eslint/indent': ['error', 2, {
SwitchCase: 1,
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export = {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', 'array-simple'],
'@typescript-eslint/explicit-function-return-type': ['error', {
allowHigherOrderFunctions: true
allowExpressions: true,
allowHigherOrderFunctions: true,
allowTypedFunctionExpressions: true
}],
'@typescript-eslint/member-delimiter-style': [
'error',
Expand Down

0 comments on commit bdae116

Please sign in to comment.