Skip to content

[explicit-module-boundary-types] considers "protected" members as public boundaries #2430

@bladeSk

Description

@bladeSk

The rule considers protected class methods as public, which contradicts the description in the plugin's docs:

Require explicit return and argument types on exported functions' and classes' public class methods

It's probably a matter of debate whether protected functions should be considered "exported" and I think the best solution would be to have this configurable.

This rule is generally pretty annoying, as it requires putting : void next to methods that don't return anything, but that's perhaps for another issue.

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/explicit-module-boundary-types": ["error"]
  }
}
export default class Test {
  testMethod() { // this produces an error, as expected
  }

  protected testMethod2() { // this produces an error, **but it shouldn't**
  }

  private testMethod3() { // this does not produce an error, as expected
  }
}

Versions

package version
@typescript-eslint/eslint-plugin 3.9.1
@typescript-eslint/parser 3.9.1
TypeScript 3.9.7
ESLint 7.7.0
node v12.18.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy