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
- Make sure you have
eslintinstalled, if not, install it as dev-dependency. Install our eslint plugin,eslint-plugin-uilib, as a dev-dependency. (also, ifeslint-config-wixis not installed already, add it a dev dependency as well).eslint-plugin-uilibwill be installed by uilib- 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.eslintrcfile of your own, please make sure you're extending from the engine. - Add
"pretest": "npm run lint"to your package.jsonscriptssection, this will trigger lint before running your tests. - 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
- Run locally to make sure nothing is broken.
- Run
lintscript to see the uilib warning and errors. lintshould part of yourpretestscript and should run in your CI build.- Run
lint --fixscript to auto fix where a fix is available. - 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