ESLintUtils.getParserServices should take a Readonly<RuleContext> #2232
Labels
bug
Something isn't working
good first issue
Good for newcomers
package: utils
Issues related to the @typescript-eslint/utils package
Repro
I'm writing an ESLint rule to ban code that leads to the surprising mutability described in TypeScript issue #13347.
I'd like to forbid passing an immutable value to a function that expects a mutable (but otherwise compatible) type.
I've noticed that
RuleModule.create
gives us anReadonly<RuleContext>
butESLintUtils.getParserServices
expects a (mutable)RuleContext
. This triggers my rule (see below).It looks like
ESLintUtils.getParserServices
doesn't mutate the passed incontext
, so please consider updating it to take aReadonly<RuleContext>
. This would stop my rule from complaining.Expected Result
ESLintUtils.getParserServices
takesReadonly<RuleContext>
Actual Result
ESLintUtils.getParserServices
takes (mutable)RuleContext
Additional Info
Versions
@typescript-eslint/experimental-utils
3.3.0
and earlierTypeScript
node
npm
The text was updated successfully, but these errors were encountered: