-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionbugESLint is working incorrectlyESLint is working incorrectlypatch candidateThis issue may necessitate a patch release in the next few daysThis issue may necessitate a patch release in the next few daysregressionSomething brokeSomething brokerepro:yesIssues with a reproducible exampleIssues with a reproducible exampletypesRelated to TypeScript typesRelated to TypeScript types
Description
Environment
ESLint version: 9.20.0
What parser are you using?
Default (Espree)
What did you do?
Updated from 9.19.0 to 9.20.0.
Seems to be related to: #19157
Property 'getLocFromIndex' does not exist on type 'SourceCode<{ LangOptions: LanguageOptions; RootNode: unknown; SyntaxElementWithLoc: unknown; ConfigNode: unknown; }>'.
Property 'getLocFromIndex' does not exist on type 'TextSourceCode<{ LangOptions: LanguageOptions; RootNode: unknown; SyntaxElementWithLoc: unknown; ConfigNode: unknown; }>'.
import type { Rule } from 'eslint';
export function getPositionFromIndex(
context: Rule.RuleContext,
offset: number
) {
const code = context.sourceCode;
const pos = code.getLocFromIndex(offset);
return pos;
}
It used to compile using TypeScript. I don't think getLocFromIndex
has been removed, so it seem to be limited to the types getting broken.
What did you expect to happen?
To compile like 9.19.0.
What actually happened?
See above.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/stackblitz-starters-m8ciayku
Participation
- I am willing to submit a pull request for this issue.
Additional comments
No response
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionbugESLint is working incorrectlyESLint is working incorrectlypatch candidateThis issue may necessitate a patch release in the next few daysThis issue may necessitate a patch release in the next few daysregressionSomething brokeSomething brokerepro:yesIssues with a reproducible exampleIssues with a reproducible exampletypesRelated to TypeScript typesRelated to TypeScript types
Type
Projects
Status
Complete