Skip to content

Rule Change: [no-array-constructor] Switch suggestions to full fixes #19608

@JoshuaKGoldberg

Description

@JoshuaKGoldberg

What rule do you want to change?

no-array-constructor

What change do you want to make?

Implement autofix

How do you think the change should be implemented?

A new default behavior

Example code

/*eslint no-array-constructor: "error"*/

Array();

What does the rule currently do for this code?

Provides a suggestion to switch to [].

What will the rule do after it's changed?

Switch to providing a full fix to switch to []. This way it'll be automatically applied with --fix & co.

Participation

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

Additional comments

Coming over from typescript-eslint/typescript-eslint#11013: the core ESLint rule provides suggestions, while @typescript-eslint/no-array-constructor provides a full --fix fixer.

#17711 added the suggestions originally. I couldn't find any discussion on whether to use fix or suggest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionautofixThis change is related to ESLint's autofixing capabilitiesenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions