Skip to content

Change Request: Reject non string replacements in fixer.replaceText() #18807

Open
@fisker

Description

ESLint version

v9

What problem do you want to solve?

In a rule fix function,

fixer.replaceText(node, replacement.text);

when replacement.text is undefined, it will replace the node with undefined.

What do you think is the correct solution?

Throw an error instead.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

Prevent mistakes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionbreakingThis change is backwards-incompatiblecoreRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLint

    Type

    No type

    Projects

    • Status

      Feedback Needed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions