Skip to content

chore: Add oxlint plugin to warn about TS-private class members - #4035

Merged
janbuchar merged 1 commit into
v4from
native-private-oxlint-rule
Aug 17, 2026
Merged

chore: Add oxlint plugin to warn about TS-private class members#4035
janbuchar merged 1 commit into
v4from
native-private-oxlint-rule

Conversation

@janbuchar

Copy link
Copy Markdown
Contributor

It's a warning for now

@janbuchar janbuchar added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Aug 14, 2026
@janbuchar
janbuchar requested review from B4nan and barjin August 14, 2026 11:59

@barjin barjin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you @janbuchar

{ name: 'field', code: 'class A { private a = 1; }', errors: [{ messageId: 'preferHash' }] },
{ name: 'static field', code: 'class A { private static a = 1; }', errors: [{ messageId: 'preferHash' }] },
{ name: 'readonly field', code: 'class A { private readonly a = 1; }', errors: [{ messageId: 'preferHash' }] },
{ name: 'method', code: 'class A { private a() {} }', errors: [{ messageId: 'preferHash' }] },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC my PR left methods with TS private, so I am puzzled this is not screaming already

up to you if you really want to enforce those, no strong opinions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it produces warnings, not errors, now I get it. Honestly, I hate linter warnings, they just get ignored. If we care about this, I'd make it a hard error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I hate linter warnings, they just get ignored

Me too, but this should at least make coding assistants stop generating ts-private fields. We should make the rule an error after the existing issues are fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just 10 of them, i'd fix them as part of this PR, but up to you...

@barjin

barjin commented Aug 17, 2026

Copy link
Copy Markdown
Member

Second thought - shall we (eventually) enable the github output format in oxlint in CI (so we get the linter CI warnings showing directly in the GitHub UI)?

Once we fix the current warnings, it might be useful as a "regression" test.

@B4nan

B4nan commented Aug 17, 2026

Copy link
Copy Markdown
Member

I believe that's already the case, oxlint does that by default.

@B4nan

B4nan commented Aug 17, 2026

Copy link
Copy Markdown
Member

Indeed, you wouldn't get this on top of the logs without the github output format.

image

@janbuchar
janbuchar merged commit bf3dd89 into v4 Aug 17, 2026
8 checks passed
@janbuchar
janbuchar deleted the native-private-oxlint-rule branch August 17, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants