Skip to content

feat(linter/plugins): add SourceCode#getLines method#17177

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-feat_linter_plugins_add_sourcecode_getlines_method
Dec 20, 2025
Merged

feat(linter/plugins): add SourceCode#getLines method#17177
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-feat_linter_plugins_add_sourcecode_getlines_method

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 20, 2025

ESLint has an undocumented SourceCode#getLines method. Implement it.

Discovered the existence of this method from conformance tests.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request labels Dec 20, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@overlookmotel overlookmotel marked this pull request as ready for review December 20, 2025 13:47
Copilot AI review requested due to automatic review settings December 20, 2025 13:47
@overlookmotel overlookmotel self-assigned this Dec 20, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
Copy link
Member Author

overlookmotel commented Dec 20, 2025

Merge activity

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 the SOURCE_CODE object which lazily initializes and returns the lines array
  • Updates test fixture to verify the method works correctly
  • Fixes all 11 failing tests for the no-tabs ESLint 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 lines array by checking if it's empty and calling initLines() if needed
  • Returns the shared lines array (matching the pattern used by properties like lineStartIndices)
  • 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.
@graphite-app graphite-app bot force-pushed the om/12-20-feat_linter_plugins_add_sourcecode_getlines_method branch from ee35e6d to 563b039 Compare December 20, 2025 13:52
@graphite-app graphite-app bot merged commit 563b039 into main Dec 20, 2025
18 checks passed
@graphite-app graphite-app bot deleted the om/12-20-feat_linter_plugins_add_sourcecode_getlines_method branch December 20, 2025 13:58
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants