/v4-migration-tslint

TSLint rules for Ionic Angular v4 Migration

Primary LanguageTypeScriptMIT LicenseMIT

@ionic/v4-migration-tslint

Build Status Code Style: Prettier semantic-release Coverage Status Commitizen friendly

An effort to warn about and automatically fix syntax changes listed in BREAKING.md using tslint, codelyzer, and the Angular compiler.

We are looking for contributors to help build these rules out! See CONTRIBUTING.md to help out. ๐Ÿ’–

How to Use

  1. Install the lint rules:

    npm i -D @ionic/v4-migration-tslint
    
  2. Add a file called ionic-migration.json at the root of your project and paste in the following JSON.

    {
      "rulesDirectory": ["@ionic/v4-migration-tslint/rules"],
      "rules": {
        "ion-action-sheet-method-create-parameters-renamed": true,
        "ion-alert-method-create-parameters-renamed": true,
        "ion-back-button-not-added-by-default": { "options": [true], "severity": "warning" },
        "ion-button-attributes-renamed": true,
        "ion-button-is-now-an-element": true,
        "ion-buttons-attributes-renamed": true,
        "ion-col-attributes-renamed": true,
        "ion-datetime-capitalization-changed": true,
        "ion-fab-attributes-renamed": true,
        "ion-fab-button-is-now-an-element": true,
        "ion-fab-fixed-content": true,
        "ion-icon-attribute-is-active-removed": true,
        "ion-item-attributes-renamed": true,
        "ion-item-divider-ion-label-required": true,
        "ion-item-ion-label-required": true,
        "ion-item-is-now-an-element": true,
        "ion-item-option-is-now-an-element": true,
        "ion-item-option-method-get-sliding-percent-renamed": true,
        "ion-item-options-attribute-values-renamed": true,
        "ion-label-attributes-renamed": true,
        "ion-list-header-ion-label-required": true,
        "ion-loading-method-create-parameters-renamed": true,
        "ion-menu-events-renamed": true,
        "ion-menu-toggle-is-now-an-element": true,
        "ion-navbar-is-now-ion-toolbar": true,
        "ion-option-is-now-ion-select-option": true,
        "ion-overlay-method-create-should-use-await": true,
        "ion-overlay-method-present-should-use-await": true,
        "ion-radio-attributes-renamed": true,
        "ion-radio-group-is-now-an-element": true,
        "ion-radio-slot-required": true,
        "ion-range-attributes-renamed": true,
        "ion-segment-button-ion-label-required": true,
        "ion-spinner-attribute-values-renamed": true,
        "ion-tabs-refactored": { "options": [true], "severity": "warning" },
        "ion-text-is-now-an-element": true
      }
    }
  3. Lint your project:

    npx tslint -c ionic-migration.json -p tsconfig.json

    ๐Ÿ“ Hints:

    • Run tslint with -t verbose to output the rule names of lint errors which correspond to the table of rules below.
    • Run tslint with --fix to attempt automatic fixes (note: not all rules have fixes, and be sure to save a backup in version control before running with --fix)

Rules

โฌœ โ€“ These rules need to be completed! See CONTRIBUTING.md to get started.

๐Ÿ”ง โ€“ These rules can be automatically fixed with --fix.

category rule contributors
Code Changes
Action Sheet ๐Ÿ”ง โœ… ion-action-sheet-method-create-parameters-renamed @cwoolum
Alert ๐Ÿ”ง โœ… ion-alert-method-create-parameters-renamed @cwoolum
Datetime ๐Ÿ”ง โœ… ion-datetime-capitalization-changed @mhartington
Item Sliding ๐Ÿ”ง โœ… ion-item-option-method-get-sliding-percent-renamed @mhartington
Loading ๐Ÿ”ง โœ… ion-loading-method-create-parameters-renamed @areo
Nav โฌœ ion-nav-controller-method-remove-renamed
Option โฌœ ion-option-class-renamed
Overlays โœ… ion-overlay-method-create-should-use-await @cwoolum
โœ… ion-overlay-method-present-should-use-await @cwoolum
Markup Changes
Back Button โœ… ion-back-button-not-added-by-default @dwieeb
Button ๐Ÿ”ง โœ… ion-button-attributes-renamed @cwoolum
๐Ÿ”ง โœ… ion-button-is-now-an-element @cwoolum, @j3gb3rt
FAB ๐Ÿ”ง โœ… ion-fab-button-is-now-an-element @dwieeb, @j3gb3rt
๐Ÿ”ง โœ… ion-fab-attributes-renamed @dwieeb
๐Ÿ”ง โœ… ion-fab-fixed-content @dwieeb
Grid ๐Ÿ”ง โœ… ion-col-attributes-renamed @dwieeb
Icon โœ… ion-icon-attribute-is-active-removed @dwieeb
Item ๐Ÿ”ง โœ… ion-item-is-now-an-element @dwieeb, @j3gb3rt
โœ… ion-item-ion-label-required @dwieeb
๐Ÿ”ง โœ… ion-item-attributes-renamed @dwieeb
Item Divider โœ… ion-item-divider-ion-label-required @dwieeb
Item Options ๐Ÿ”ง โœ… ion-item-options-attribute-values-renamed @dwieeb
Item Sliding โœ… ion-item-option-is-now-an-element @dwieeb
Label ๐Ÿ”ง โœ… ion-label-attributes-renamed @dwieeb
List Header โœ… ion-list-header-ion-label-required @dwieeb
Menu ๐Ÿ”ง โœ… ion-menu-events-renamed @mhartington
Menu Toggle โœ… ion-menu-toggle-is-now-an-element @dwieeb
Navbar ๐Ÿ”ง โœ… ion-navbar-is-now-ion-toolbar @cwoolum
Option ๐Ÿ”ง โœ… ion-option-is-now-ion-select-option @dwieeb
Radio ๐Ÿ”ง โœ… ion-radio-attributes-renamed @dwieeb
๐Ÿ”ง โœ… ion-radio-slot-required @dwieeb
๐Ÿ”ง โœ… ion-radio-group-is-now-an-element @dwieeb, @j3gb3rt
Range ๐Ÿ”ง โœ… ion-range-attributes-renamed @dwieeb
Segment Button ๐Ÿ”ง โœ… ion-segment-button-ion-label-required @dwieeb
Select โฌœ ion-select-attributes-renamed
Spinner ๐Ÿ”ง โœ… ion-spinner-attribute-values-renamed @dwieeb
Tabs โœ… ion-tabs-refactored @mhartington,
Text / Typography ๐Ÿ”ง โœ… ion-text-is-now-an-element @dwieeb, @j3gb3rt
Toolbar ๐Ÿ”ง โœ… ion-buttons-attributes-renamed @dwieeb

Not Covered

Some changes are not covered by this fixer due to their complexity or because it would make no sense to do in automated fashion. They are: