Skip to content

Repo: Make utility for static member access #8323

Closed
@kirkwaiblinger

Description

@kirkwaiblinger

Suggestion

This is a refactoring opportunity that comes from #8216 (comment).

In short, it may be a common pattern to want to check for either code that looks like

object.filter

or

const computedMember = "filter";
object[computedMember];

This could be extracted to a utility with approximate usage

declare const memberExpression: MemberExpressionComputedName | MemberExpressionNonComputedName,
const isFilterCall = isStaticMemberAccessOfValue(memberExpression, "filter");

An example implementation of this is 581e9ae#diff-5af06c156c2d34d6ea1d2b8f91d583d82d7e629cbd5226145c6c0b72449bcfb2R298, implemented in a way that did not aim to be more generic than the needs of that specific module. This might be possible to replace with a more general utility

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuelocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: utilsIssues related to the @typescript-eslint/utils packagerepo maintenancethings to do with maintenance of the repo, and not with code/docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions