mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
253cdb2f46
## Summary The `id-length` lint rule lets users opt out of checking property name lengths via a `properties: "never"` setting. This exemption worked correctly for plain JavaScript object properties, but was silently ignored for TypeScript interface members and object type literal members. As a result, users who explicitly disabled property length checks would still see false-positive warnings on their TypeScript type definitions. ## Why TypeScript interfaces and type literals describe object shapes using their own dedicated syntax, distinct from JavaScript object literals. The rule's internal logic only recognized the JavaScript form when deciding whether to skip the length check, so the TypeScript equivalents were treated as ordinary identifiers instead of property names, even though users intended the same exemption to apply to both. ## Changes - The rule now recognizes TypeScript interface and type literal members as property names, so the `properties: "never"` setting applies to them consistently with plain JavaScript object properties. - Added test coverage confirming both the exempted and non-exempted behavior for TypeScript interface and type literal members. ## Test plan - Added passing test cases showing the exemption now applies to TypeScript interface and type literal members. - Added failing test cases confirming the rule still flags these members under its default settings. - Verified the fix manually against the exact reproduction case reported in the issue, confirming the false-positive warning no longer occurs. - Full linter test suite passes with no regressions. ## AI disclosure Per the repo's AI usage policy: this fix was drafted with AI assistance (Claude), and reviewed, tested, and understood by me before submission. The linked issue itself was also AI-drafted and reviewed by me. Resolves #26309 --------- Signed-off-by: Cameron <cameron.clark@hey.com> Co-authored-by: Cameron <cameron.clark@hey.com>
Oxc Linter
High-performance ESLint-compatible linter for JavaScript and TypeScript.
Overview
This crate provides a fast, ESLint-compatible linting engine with comprehensive rule support. It leverages oxc's high-performance AST and semantic analysis to deliver significantly faster linting than traditional tools.
Key Features
- ESLint compatibility: Drop-in replacement for most ESLint workflows
- High performance: 50-100x faster than ESLint on large codebases
- Comprehensive rules: Supports most popular ESLint rules and plugins
- TypeScript support: Full TypeScript linting with type-aware rules
- Plugin system: Extensible architecture for custom rules
Architecture
Rule System
- Rule categories: Correctness, Suspicious, Pedantic, Style, etc.
- Configurable severity: Error, Warning, or Off for each rule
- Auto-fixing: Many rules can automatically fix issues
- Plugin support: Load external rule collections
Performance Design
- Single AST pass: Most rules run in a single traversal
- Efficient analysis: Leverages oxc's semantic analysis
- Parallel execution: Process multiple files concurrently
- Memory efficiency: Uses arena allocation for optimal performance
ESLint Compatibility
- Configuration format: Supports ESLint config files
- Rule parity: Implements behavior-compatible versions of popular rules
- Plugin ecosystem: Compatible with many ESLint plugins
- Migration path: Easy transition from ESLint to oxlint
The linter is designed to be both a standalone tool and a library component for integration into other development tools.