Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint-plugin): [explicit-module-boundary-types] dont report return type errors on constructor overloads #2158

Merged
merged 1 commit into from Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -380,7 +380,10 @@ export default util.createRule<Options, MessageIds>({
function checkEmptyBodyFunctionExpression(
node: TSESTree.TSEmptyBodyFunctionExpression,
): void {
if (!node.returnType) {
const isConstructor =
node.parent?.type === AST_NODE_TYPES.MethodDefinition &&
node.parent.kind === 'constructor';
if (!isConstructor && !node.returnType) {
context.report({
node,
messageId: 'missingReturnType',
Expand Down
Expand Up @@ -82,6 +82,25 @@ export class Test {
}
`,
},
{
// https://github.com/typescript-eslint/typescript-eslint/issues/2150
code: `
export class Test {
constructor();
constructor(value?: string) {
console.log(value);
}
}
`,
},
{
code: `
declare class MyClass {
constructor(options?: MyClass.Options);
}
export { MyClass };
`,
},
{
code: `
export function test(): void {
Expand Down