Skip to content

Releases: findmypast-oss/eslint-plugin-deprecate-import

Release list

v2.0.0

Choose a tag to compare

@egmcdonald egmcdonald released this 16 Aug 17:52

This release contains breaking changes:

  1. Deletion of regex rule
  2. Change in API for the module rule

This change was made due to the module rule serving just a limited functionality to that of the regex rule. The rules have been combined in order to simplify the ruleset, and remove duplicate functionality. In order to update existing usages of the rule, please take a look at the following guide, and determine which upgrade advice to follow.

I was previously using the regex rule

The new module rule is actually the old regex rule. This means that the API for the new module rule is exactly the same as the old regex rule. Simply swap out the rule definitions for regex with module.

Migration example

ESLint configuration pre-v2.0.0:

{
    "deprecate-import/regex": [
      "error",
      {
        name: "deprecated-module",
        use: "supported-module",
      },
    ]
}

ESLint configuration from v2.0.0:

{
    "deprecate-import/module": [
      "error",
      {
        name: "deprecated-module",
        use: "supported-module",
      },
    ]
}

I was previously using the module rule

The new module rule instead matches via regular expressions, rather than an exact string match. This means that the string to match on may remain the same between updates, if you wish to still perform an exact string match. It is, however, recommended that the string be updated to a regular expression that captures the start and end of strings in order to better represent the match desired. In addition, the key for the string match has changed from name to pattern to better describe its purpose.

Migration example

ESLint configuration pre-v2.0.0:

{
    "deprecate-import/module": [
      "error",
      {
        name: "deprecated-module",
        use: "supported-module",
      },
    ]
}

ESLint configuration from v2.0.0:

{
    "deprecate-import/module": [
      "error",
      {
        pattern: "^deprecated-module$",
        use: "supported-module",
      },
    ]
}