Skip to content

feat: add no-runtime-private methods rule#1476

Open
tobias47n9e wants to merge 1 commit into
denoland:mainfrom
tobias47n9e:feature/no-runtime-private-methods
Open

feat: add no-runtime-private methods rule#1476
tobias47n9e wants to merge 1 commit into
denoland:mainfrom
tobias47n9e:feature/no-runtime-private-methods

Conversation

@tobias47n9e
Copy link
Copy Markdown
Contributor

This optional rule discourages the usage of methods with #-prefix in favor of private method. This encourages users to trust typescript's private keyword and does not prevent debuggers from accessing the method.

Note: I would like to make a similar rule for #-prefixed instance properties. Those are also not accessible by Deno debug, and I think it would be good if the linter could discourage using them.

@tobias47n9e tobias47n9e force-pushed the feature/no-runtime-private-methods branch from 6b5ff94 to 4cfdaf4 Compare February 27, 2026 21:50
@tobias47n9e tobias47n9e force-pushed the feature/no-runtime-private-methods branch from 4cfdaf4 to 5d14272 Compare February 27, 2026 21:51
@0f-0b
Copy link
Copy Markdown
Contributor

0f-0b commented Feb 27, 2026

At least V8 provides APIs for debuggers to access private elements. This is what I get using VS Code's built-in debugger with Deno:

@tobias47n9e
Copy link
Copy Markdown
Contributor Author

tobias47n9e commented Mar 3, 2026

@0f-0b For me it is also about the watch functionality of the debugger. I cannot easily check on nested methods and fields that have the #-prefix at a breakpoint.

this.#database.#somePrivateMethod()
this.#database.#privateField

It could be out of scope for deno lint, but I just wanted to check if something like this would be considered 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants