Open ahmedkotb opened 4 years ago
trying to lint async functions in typescript that has a return type of Promise<void> will cause the plugin to crash.
Promise<void>
functions that returns something seems to be ok.
this is an example that repros the case
tester.run('lib/rules/prefer-arrow-functions', rule, { parserOptions: {ecmaVersion: 6}, valid: [ ], invalid: [ ...[ // Support fixes with typescript typings ...[ [ `const good = { async myFunc(a: number, b: number): Promise<number> { return Promise.resolve(1); } }`, `const good = { async myFunc: (a: number, b: number): Promise<number> => Promise.resolve(1) }`, ], [ `const bad = { async myFunc(a: number, b: number): Promise<void> { return; } }`, `const bad = { async myFunc: (a: number, b: number): Promise<void> => {} }`, ], ].map(test => [...test, null, { parser: require.resolve('@typescript-eslint/parser') }]) ].map(inputOutput => Object.assign( { errors: ['Prefer using arrow functions over plain functions which only return a value'], output: inputOutput[1], ...(inputOutput[3] || {}), }, { ...singleReturnOnly(inputOutput[0], inputOutput[2]), parserOptions: { ...singleReturnOnly(inputOutput[0], inputOutput[2]).parserOptions, ...((inputOutput[3] || {}).parserOptions || {}) }, } )), ] });
trying to lint async functions in typescript that has a return type of
Promise<void>
will cause the plugin to crash.functions that returns something seems to be ok.
this is an example that repros the case