@exadel/eslint-plugin-esl
TypeScript icon, indicating that this package has built-in type declarations

4.14.1 • Public • Published

ESL ESL migration support

Authors: Natalia Smirnova, Alexey Stsefanovich (ala'n).

This article aims to assist the smooth migration process from older versions of ESL to the latest version. To support this transition, we have developed an ESLint plugin designed specifically for ESL library. This plugin targets deprecated features and aliases within the library, offering a seamless means of identifying these outdated elements. Additionally, it suggests suitable replacements, thereby ensuring a hassle-free upgrade to the newest version of ESL.

Installation

Note: Before installing the plugin, ensure that you have the ESLint package of version 8.0.0 or higher. If you do not intend to install ESLint, this article may not as helpful. However, there are deprecated features listed in the Rules section, that may assist in manual migration. Alternatively, see our Release notes.

To use custom ESLint plugin, you need to install it as npm package:

npm install --save-dev @exadel/eslint-plugin-esl

Once installed, the plugin needs to be added in eslint configuration file:

{
  // ...
  "plugins": [
    "@exadel/esl"
  ]
  // ...
}

Or in YAML:

  plugins: 
    - "@exadel/esl"

Configuration

We strongly recommend using a built-in preset tailored to your specific needs:

  • If you use ESL version 4 and wish to receive notifications about ESL best practices and deprecations with a lighter approach, we recommend using the default-4.0 preset. It is configured to display all recommendations as warnings. Provide the following line to extend the section of eslint configuration: plugin:@exadel/esl/default-4
  • If you want to stay up-to-date and be prepared for ESL version 5, consider using the default-5.0 preset. It treats all items on the deprecation list with the error severity. Provide the following line to extend the section of eslint configuration: plugin:@exadel/esl/default-5

However, you still have the option to manually manage the rules if needed.

Note: All the rules in our custom ESLint plugin are auto-correctable. This means you can take advantage of ESLint's --fix option to perform automatic adjustments to your code.

Rules

The ESLint plugin provides a separate rule for each deprecated utility within the ESL project, that's considered to be deprecated. Below is the list of them:

  • @exadel/esl/deprecated-4/generate-uid - Rule for deprecated generateUId alias for randUID. Can be set to warn or error.
  • @exadel/esl/deprecated-4/deep-compare - Rule for deprecated deepCompare alias for isEqual. Can be set to warn or error.
  • @exadel/esl/deprecated-4/event-utils - Rule for deprecated EventUtils alias for ESLEventUtils. Can be set to warn or error.
  • @exadel/esl/deprecated-4/traversing-query - Rule for deprecated TraversingQuery alias for ESLTraversingQuery. Can be set to warn or error.
  • @exadel/esl/deprecated-4/toggleable-action-params - Rule for deprecated ToggleableActionParams alias for ESLToggleableActionParams. Can be set to warn or error.

These rules can be configured manually inside the rules section of your ESLint configuration file.

For example, previously mentioned plugin:@exadel/esl/default-4 preset is equal to the following rules configuration:

{
  // ...
  "rules": {
    "@exadel/esl/deprecated-4/generate-uid" : "warn",
    "@exadel/esl/deprecated-4/deep-compare" : "warn",
    "@exadel/esl/deprecated-4/event-utils" : "warn",
    "@exadel/esl/deprecated-4/traversing-query" : "warn",
    "@exadel/esl/deprecated-4/toggleable-action-params" : "warn"
  }
  // ...
}

And plugin:@exadel/esl/default-5 is equal to:

{
  // ...
  "rules": {
    "@exadel/esl/deprecated-4/generate-uid" : "error",
    "@exadel/esl/deprecated-4/deep-compare" : "error",
    "@exadel/esl/deprecated-4/event-utils" : "error",
    "@exadel/esl/deprecated-4/traversing-query" : "error",
    "@exadel/esl/deprecated-4/toggleable-action-params" : "error"
  }
  // ...
}

Package Sidebar

Install

npm i @exadel/eslint-plugin-esl

Weekly Downloads

5

Version

4.14.1

License

MIT

Unpacked Size

25.7 kB

Total Files

24

Last publish

Collaborators

  • alitoit-eng
  • sbondarau
  • spospielov
  • dastn
  • ysauko
  • ala-n
  • yadamska
  • ymurashko