You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide an automated way to migrate imports and require statements from:
tns-core-modules to @nativescript/core;
and nativescript-angular to @nativescript/angular.
How?
The above can be achieved by providing an ESLint rule that detects the old type of imports and recommends using the new one. It should also provide an autofix that migrates the imports.
Migration description
JS/TS
The rule should work for both JS and TS projects.
tns-core-modules -> @nativescript/core
The rule should migrate the imports from that package in the following way:
for imports from application, application-settings, connectivity, image-asset, trace:
import { run } from "tns-core-modules/application" -> import { Application } from "@nativescript/core"
const run = require("tns-core-modules/application").run -> const Application = require("@nativescript/core/application")
In cases 1 and 2, the rule should also change all uses of run in the code to Application.run.
import * as application from "tns-core-modules/application" -> import { Application } from "@nativescript/core"
For isAndroid and isIOS migrate to @nativescript/core.
For screen and device migrate to import { Screen, Device } from '@nativescript/core';.
For any other path migrate to @nativescript/core/platform.
for imports from ui/*, data/observable-array, data/observable, file-system, color, image-asset, image-source, text, xml:
import { Observable } from "tns-core-modules/data/observable" -> import { Observable } from "@nativescript/core"
Why?
Provide an automated way to migrate
imports
andrequire
statements from:tns-core-modules
to@nativescript/core
;nativescript-angular
to@nativescript/angular
.How?
The above can be achieved by providing an ESLint rule that detects the old type of imports and recommends using the new one. It should also provide an autofix that migrates the imports.
Migration description
JS/TS
The rule should work for both JS and TS projects.
tns-core-modules
->@nativescript/core
The rule should migrate the imports from that package in the following way:
for imports from
application
,application-settings
,connectivity
,image-asset
,trace
:import { run } from "tns-core-modules/application"
->import { Application } from "@nativescript/core"
const run = require("tns-core-modules/application").run
->const Application = require("@nativescript/core/application")
In cases 1 and 2, the rule should also change all uses of
run
in the code toApplication.run
.import * as application from "tns-core-modules/application"
->import { Application } from "@nativescript/core"
const application = require("tns-core-modules/application")
->const Application = require("@nativescript/core").Application
In cases 3 and 4, the rule should also change all uses of
application
in the code toApplication
.for imports from
utils/utils
:The same as
application
with this exception:import * as utils from "tns-core-modules/utils/utils";
utils.ad;
->
import { Utils } from "@nativescript/core";
Utils.android;
`
for imports from
profiling
:Migrate to
import { Profiling } from @nativescript/core
for the methods that are now exported through theProfiling
constant from@nativescript/core
:NativeScript/nativescript-core/index.ts
Lines 69 to 76 in 8d2dd2e
Migrate to
import { SomeInterface } from '@nativescript/core'
for all symbols that are now directly exported from@nativescript/core
:NativeScript/nativescript-core/index.ts
Line 60 in 8d2dd2e
for imports from
trace
:Migrate to
import { Trace } from @nativescript/core
for the methods that are now exported through theTrace
constant from@nativescript/core
:NativeScript/nativescript-core/index.ts
Lines 88 to 93 in 8d2dd2e
Migrate to
import { SomeInterface } from '@nativescript/core'
for all symbols that are now directly exported from@nativescript/core
:NativeScript/nativescript-core/index.ts
Line 80 in 8d2dd2e
for imports from
http
:Migrate to
import { Http } from @nativescript/core
for the methods that are now exported through theHttp
constant from@nativescript/core
:NativeScript/nativescript-core/index.ts
Line 52 in 8d2dd2e
Migrate to
import { SomeInterface } from '@nativescript/core'
for all symbols that are now directly exported from@nativescript/core
:NativeScript/nativescript-core/index.ts
Line 49 in 8d2dd2e
for imports from
platform
:For
isAndroid
andisIOS
migrate to@nativescript/core
.For
screen
anddevice
migrate toimport { Screen, Device } from '@nativescript/core';
.For any other path migrate to
@nativescript/core/platform
.for imports from
ui/*
,data/observable-array
,data/observable
,file-system
,color
,image-asset
,image-source
,text
,xml
:import { Observable } from "tns-core-modules/data/observable"
->import { Observable } from "@nativescript/core"
const Observable = require("tns-core-modules/data/observable")
->const Observable = require("@nativescript/core").Observable
for every other import starting with
tns-core-modules
, thetns-core-modules
prefix should be replaced with@nativescript/core
.nativescript/angular
->@nativescript/angular
The text was updated successfully, but these errors were encountered: