Skip to content

Change Request: Require that rule export defines configuration defaults #15428

@gajus

Description

@gajus

ESLint version

next major

What problem do you want to solve?

Currently, it is impossible to automate tracking of breaking changes because of changing defaults.

A very simple fix to this would be requiring rule authors to export the default configuration of the plugin in addition to schema.

What do you think is the correct solution?

A defaultConfiguration property mandated in plugin export, e.g.

module.exports = {
  create,
  meta: {
    defaultConfiguration: {
      sortCharacterClasses: true,
    },
    docs: {
      description:
        "Improve regexes by making them shorter, consistent, and safer.",
    },
    fixable: "code",
    messages,
    schema: [
      {
        additionalProperties: false,
        properties: {
          sortCharacterClasses: {
            type: "boolean",
          },
        },
        type: "object",
      },
    ],
    type: "suggestion",
  },
};

Participation

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

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    archived due to ageThis issue has been archived; please open a new issue for any further discussionbreakingThis change is backwards-incompatiblecoreRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLint

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions