feat(linter/plugins): add SourceCode#getLines method#17177
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merge activity
|
There was a problem hiding this comment.
Pull request overview
This PR implements the SourceCode#getLines method, an undocumented ESLint API discovered through conformance tests. The method returns the source text split into lines according to the ECMAScript specification's definition of line breaks.
- Adds the
getLines()method to theSOURCE_CODEobject which lazily initializes and returns thelinesarray - Updates test fixture to verify the method works correctly
- Fixes all 11 failing tests for the
no-tabsESLint rule
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxlint/src-js/plugins/source_code.ts | Adds the getLines() method implementation with proper documentation and lazy initialization |
| apps/oxlint/test/fixtures/sourceCode/plugin.ts | Adds test assertion to verify getLines() returns the expected lines array |
| apps/oxlint/conformance/snapshot.md | Updates conformance test statistics showing 11 new passing tests and removes the no-tabs rule from the failing section |
The implementation looks correct and follows the established patterns in the codebase. The getLines() method properly:
- Lazily initializes the
linesarray by checking if it's empty and callinginitLines()if needed - Returns the shared
linesarray (matching the pattern used by properties likelineStartIndices) - Includes clear JSDoc documentation
No issues were identified in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ESLint has an undocumented `SourceCode#getLines` method. Implement it. Discovered the existence of this method from conformance tests.
ee35e6d to
563b039
Compare

ESLint has an undocumented
SourceCode#getLinesmethod. Implement it.Discovered the existence of this method from conformance tests.