diff --git a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts index e189727463f..adaacaf363f 100644 --- a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts +++ b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts @@ -336,7 +336,10 @@ export default util.createRule({ return; case AST_NODE_TYPES.PropertyDefinition: - if (node.accessibility === 'private') { + if ( + node.accessibility === 'private' || + node.key.type === AST_NODE_TYPES.PrivateIdentifier + ) { return; } return checkNode(node.value); @@ -353,7 +356,10 @@ export default util.createRule({ case AST_NODE_TYPES.MethodDefinition: case AST_NODE_TYPES.TSAbstractMethodDefinition: - if (node.accessibility === 'private') { + if ( + node.accessibility === 'private' || + node.key.type === AST_NODE_TYPES.PrivateIdentifier + ) { return; } return checkNode(node.value); diff --git a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts index ba80da5b588..e511e29d682 100644 --- a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts @@ -82,6 +82,16 @@ export class Test { } `, }, + ` +export class PrivateProperty { + #property = () => null; +} + `, + ` +export class PrivateMethod { + #method() {} +} + `, { // https://github.com/typescript-eslint/typescript-eslint/issues/2150 code: `