feat(linter): implement typescript/class-literal-property-style#19252
Merged
camc314 merged 2 commits intooxc-project:mainfrom Feb 11, 2026
Merged
Conversation
This commit introduces a new linting rule, `class_literal_property_style`, which enforces a consistent style for exposing literal values on classes in TypeScript. The rule allows configuration between using readonly fields and getters for literals, helping to maintain a clean and consistent class API. Additionally, the rule has been integrated into the rule runner and added to the rules enumeration.
6b4b4af to
276028b
Compare
class-literal-property-style to TypeScript linting
Merging this PR will not alter performance
Comparing Footnotes
|
camc314
added a commit
that referenced
this pull request
Feb 12, 2026
# Oxlint ### 🚀 Features - ebb80b3 ast: Add `node_id` field to all AST struct nodes (#18138) (Boshen) - 2879fc5 linter: Implement fixer for unicorn/prefer-math-trunc (#19275) (camc314) - a204eda linter: Implement fixer for unicorn/no-typeof-undefined (#19274) (camc314) - ab46d9c linter: Implement typescript/class-literal-property-style (#19252) (Vincent R) - 1a61f58 linter: Implement typescript/no-invalid-void-type (#19242) (Vincent R) ### 🐛 Bug Fixes - 45adda2 oxlint/lsp: Use blocking stdio in Oxlint (#19292) (overlookmotel) - 05bc855 linter/import: Count unique module sources in max-dependencies (#19270) (camc314) - 8566b44 linter: Check for preceeding token in math trunc fixer (#19277) (camc314) - f16f2b6 linter/import-no-cycle: Avoid traversal-order false negatives with type-only edges (#19267) (camc314) - d4937e7 linter: Recognize module-scoped callback refs as stable in exhaustive-deps (#19220) (Sreetam Das) - 140c9bd linter: Detect fallthrough from `default` when it is not the last case (#19261) (Boshen) - 740a009 linter: Accept digits after 'use' in hook names (#19254) (Sreetam Das) - 31b562f linter: Update `import/no-named-as-default` to allow named import if equivalent to the default import (#19100) (connorshea) - 79c82cc linter: Avoid applying object-level docs to nested object methods in require-param (#19231) (camc314) ### ⚡ Performance - 5670291 linter/class-literal-property-style: Avoid unneeded string allocations (#19262) (camc314) # Oxfmt ### 🚀 Features - ebb80b3 ast: Add `node_id` field to all AST struct nodes (#18138) (Boshen) ### 🐛 Bug Fixes - 1957908 formatter: Avoid unnecessary parentheses for string literal in labeled statement (#19272) (Dunqing) Co-authored-by: camc314 <[email protected]>
OskarLebuda
pushed a commit
to OskarLebuda/oxc
that referenced
this pull request
Feb 17, 2026
…project#19252) This commit introduces a new linting rule, `class_literal_property_style`, which enforces a consistent style for exposing literal values on classes in TypeScript. The rule allows configuration between using readonly fields and getters for literals, helping to maintain a clean and consistent class API. Additionally, the rule has been integrated into the rule runner and added to the rules enumeration. --------- Co-authored-by: Cameron Clark <[email protected]>
OskarLebuda
pushed a commit
to OskarLebuda/oxc
that referenced
this pull request
Feb 17, 2026
# Oxlint ### 🚀 Features - ebb80b3 ast: Add `node_id` field to all AST struct nodes (oxc-project#18138) (Boshen) - 2879fc5 linter: Implement fixer for unicorn/prefer-math-trunc (oxc-project#19275) (camc314) - a204eda linter: Implement fixer for unicorn/no-typeof-undefined (oxc-project#19274) (camc314) - ab46d9c linter: Implement typescript/class-literal-property-style (oxc-project#19252) (Vincent R) - 1a61f58 linter: Implement typescript/no-invalid-void-type (oxc-project#19242) (Vincent R) ### 🐛 Bug Fixes - 45adda2 oxlint/lsp: Use blocking stdio in Oxlint (oxc-project#19292) (overlookmotel) - 05bc855 linter/import: Count unique module sources in max-dependencies (oxc-project#19270) (camc314) - 8566b44 linter: Check for preceeding token in math trunc fixer (oxc-project#19277) (camc314) - f16f2b6 linter/import-no-cycle: Avoid traversal-order false negatives with type-only edges (oxc-project#19267) (camc314) - d4937e7 linter: Recognize module-scoped callback refs as stable in exhaustive-deps (oxc-project#19220) (Sreetam Das) - 140c9bd linter: Detect fallthrough from `default` when it is not the last case (oxc-project#19261) (Boshen) - 740a009 linter: Accept digits after 'use' in hook names (oxc-project#19254) (Sreetam Das) - 31b562f linter: Update `import/no-named-as-default` to allow named import if equivalent to the default import (oxc-project#19100) (connorshea) - 79c82cc linter: Avoid applying object-level docs to nested object methods in require-param (oxc-project#19231) (camc314) ### ⚡ Performance - 5670291 linter/class-literal-property-style: Avoid unneeded string allocations (oxc-project#19262) (camc314) # Oxfmt ### 🚀 Features - ebb80b3 ast: Add `node_id` field to all AST struct nodes (oxc-project#18138) (Boshen) ### 🐛 Bug Fixes - 1957908 formatter: Avoid unnecessary parentheses for string literal in labeled statement (oxc-project#19272) (Dunqing) Co-authored-by: camc314 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces a new linting rule,
class_literal_property_style, which enforces a consistent style for exposing literal values on classes in TypeScript. The rule allows configuration between using readonly fields and getters for literals, helping to maintain a clean and consistent class API. Additionally, the rule has been integrated into the rule runner and added to the rules enumeration.