Skip to main content

Migrations & Deprecations

Motivation​

Our uilib eslint plugin is a set of rules relevant to uilib code with the purpose of enforcing correct usage of uilib.

We mainly use this plugin to deprecate and migrate old components.

The reason this plugin is so important is that you'll be aware of the changes we make and have enough time to act. Once a component's migration phase is over, the component will be removed from uilib and you might get broken.

Setup​

If you are using Shono then you got covered and you can skip these steps

  1. Make sure you have eslint installed, if not, install it as dev-dependency.
  2. Install our eslint plugin, eslint-plugin-uilib, as a dev-dependency. (also, if eslint-config-wix is not installed already, add it a dev dependency as well). eslint-plugin-uilib will be installed by uilib
  3. In your package.json change/add the lint script: "lint": "eslint [path/to/your/src] -c node_modules/wix-one-app-engine/eslintrc.js". !!! If you have and .eslintrc file of your own, please make sure you're extending from the engine.
  4. Add "pretest": "npm run lint" to your package.json scripts section, this will trigger lint before running your tests.
  5. In package.json you can change/add the lint:fix script that will automatically fix your lint issue (if there's a fix available): "lint:fix": "eslint [path/to/your/src] -c node_modules/wix-one-app-engine/eslintrc.js --fix".

Usage​

  1. Run locally to make sure nothing is broken.
  2. Run lint script to see the uilib warning and errors.
  3. lint should part of your pretest script and should run in your CI build.
  4. Run lint --fix script to auto fix where a fix is available.
  5. Fix issues by the due date mentioned on the warning (after that date the warnings will turn to errors).

Our Rules​

  • uilib/no-direct-import - Avoid importing component directly from our public repo (react-native-ui-lib)
  • uilib/no-hard-coded-color - Don't use hard-coded colors or colors that do no exists in uilib
  • uilib/component-deprecation - Our rule for migration/deprecation of a component
  • uilib/assets-deprecation - Our rule for migration/deprecation of an asset