diff --git a/.eslintrc.json b/.eslintrc.json index 95370249e2..0e2128aaf0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,6 +2,16 @@ "root": true, "ignorePatterns": ["**/*"], "plugins": ["@nx"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 2020, + "sourceType": "module", + "project": "tsconfig.eslint.json", + "warnOnUnsupportedTypeScriptVersion": false + }, "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/.gitignore b/.gitignore index d9476c44e2..b815e438a7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ **/yarn.lock **/pnpm-lock.yaml .npmrc +.yarn # IDEs and editors .idea @@ -55,3 +56,4 @@ Thumbs.db # types ios-typings-prj +/packages/core/platforms/android/core.aar diff --git a/.husky/pre-commit b/.husky/pre-commit index a3cebf1ec5..56984d3cb0 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,8 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" +# . "$(dirname "$0")/_/husky.sh" + +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" diff --git a/.vscode/settings.json b/.vscode/settings.json index 1358635a74..002d871ab2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,6 @@ "**/*.js": true, "**/*.js.map": true }, - "eslint.validate": ["json"] + "eslint.validate": ["json"], + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000000..2e872d653d --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,5 @@ +nmHoistingLimits: workspaces + +nodeLinker: node-modules + +yarnPath: tools/.yarn/releases/yarn-4.0.2.cjs diff --git a/apps/automated/nativescript.config.ts b/apps/automated/nativescript.config.ts index 043f59c668..413b3e554e 100644 --- a/apps/automated/nativescript.config.ts +++ b/apps/automated/nativescript.config.ts @@ -7,7 +7,4 @@ export default { android: { v8Flags: '--expose_gc', }, - cli: { - packageManager: 'npm', - }, } as NativeScriptConfig; diff --git a/apps/automated/package.json b/apps/automated/package.json index f2d232f515..0607303294 100644 --- a/apps/automated/package.json +++ b/apps/automated/package.json @@ -7,13 +7,13 @@ "url": "https://github.com/NativeScript/NativeScript.git" }, "dependencies": { - "@nativescript/core": "file:../../packages/core", - "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core" + "@nativescript/core": "*", + "@nativescript/theme": "*" }, "devDependencies": { "@nativescript/android": "~8.5.0", "@nativescript/ios": "~8.5.0", - "@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz", + "@nativescript/webpack": "*", "circular-dependency-plugin": "^5.2.2", "typescript": "~5.2.0" }, diff --git a/apps/automated/src/pages/page11.ts b/apps/automated/src/pages/page11.ts index 624b57a266..63eeb754e8 100644 --- a/apps/automated/src/pages/page11.ts +++ b/apps/automated/src/pages/page11.ts @@ -51,7 +51,7 @@ export function createPage() { //page.content = GridLayout; page.content = StackLayout; var x = 1; - btn1.on(button.Button.tapEvent, function () { + btn1.on(button.tapEvent, function () { x++; var gravity; //btn1.android.setLayoutParams(new android.view.ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.FILL_PARENT)); diff --git a/apps/automated/src/pages/page7.ts b/apps/automated/src/pages/page7.ts index be65104d63..93d464ec15 100644 --- a/apps/automated/src/pages/page7.ts +++ b/apps/automated/src/pages/page7.ts @@ -13,7 +13,7 @@ export function createPage() { var vAligns: CoreTypes.VerticalAlignmentType[] = ['stretch', 'top', 'middle', 'bottom']; //var hAligns = ["stretch", "left", "center", "right"]; var count = 0; - btn.on(buttons.Button.tapEvent, function () { + btn.on(buttons.tapEvent, function () { //page.css = "button { vertical-align:" + vAligns[(count++) % 4] + " }"; btn.verticalAlignment = vAligns[count++ % 4]; }); diff --git a/apps/automated/src/pages/page8.ts b/apps/automated/src/pages/page8.ts index 8d8687d82c..94cce4df33 100644 --- a/apps/automated/src/pages/page8.ts +++ b/apps/automated/src/pages/page8.ts @@ -41,7 +41,7 @@ export function createPage() { var counter = 0; var btn = new btns.Button(); btn.text = 'tap'; - btn.on(btns.Button.tapEvent, function () { + btn.on(btns.tapEvent, function () { btn.text = 'hi: ' + counter++; }); btn.isEnabled = false; @@ -52,7 +52,7 @@ export function createPage() { var info = new btns.Button(); info.text = 'info'; info.className = 'info'; - info.on(btns.Button.tapEvent, function () { + info.on(btns.tapEvent, function () { info.text = 'hi: ' + counter++; btn.isEnabled = true; }); diff --git a/apps/automated/src/pages/property-bindings.ts b/apps/automated/src/pages/property-bindings.ts index 12a9ec9fcd..e57e6defc7 100644 --- a/apps/automated/src/pages/property-bindings.ts +++ b/apps/automated/src/pages/property-bindings.ts @@ -41,7 +41,7 @@ export function createPage() { var count = 0; var control = new btns.Button(); control.text = 'test control'; - control.on(btns.Button.tapEvent, (data) => { + control.on(btns.tapEvent, (data) => { control.text = 'count: ' + count++; }); grid.addChild(control); diff --git a/apps/automated/src/tk-unit.ts b/apps/automated/src/tk-unit.ts index c875f60f4c..14a94147d1 100644 --- a/apps/automated/src/tk-unit.ts +++ b/apps/automated/src/tk-unit.ts @@ -379,7 +379,7 @@ export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 5, s // Setup for the Android modal loop implementation // TODO: If these platform-specific implementations continue to grow, think of per-platform separation (TKUnit.android) -let nextMethod; +let nextMethod: java.lang.reflect.Method; let targetField; let prepared; diff --git a/apps/automated/src/ui/animation/animation-tests.ts b/apps/automated/src/ui/animation/animation-tests.ts index ad75839ce4..49798955b5 100644 --- a/apps/automated/src/ui/animation/animation-tests.ts +++ b/apps/automated/src/ui/animation/animation-tests.ts @@ -267,15 +267,6 @@ export function test_AnimateOpacity(done) { }); } -export function test_AnimateOpacity_ShouldThrow_IfNotNumber() { - var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { - TKUnit.assertThrows(() => { - label.animate({ opacity: '0.75' }); - }, 'Setting opacity to a non number should throw.'); - }); -} - export function test_AnimateDelay_ShouldThrow_IfNotNumber() { var label = new Label(); helper.buildUIAndRunTest(label, (views: Array) => { @@ -303,15 +294,6 @@ export function test_AnimateIterations_ShouldThrow_IfNotNumber() { }); } -export function test_AnimateRotate_ShouldThrow_IfNotNumber() { - var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { - TKUnit.assertThrows(() => { - label.animate({ rotate: '1' }); - }, 'Setting rotate to a non number should throw.'); - }); -} - export function test_AnimateScale_ShouldThrow_IfNotPair() { var label = new Label(); helper.buildUIAndRunTest(label, (views: Array) => { diff --git a/apps/automated/src/ui/button/button-tests.ts b/apps/automated/src/ui/button/button-tests.ts index cc3dfd7036..3398916dfb 100644 --- a/apps/automated/src/ui/button/button-tests.ts +++ b/apps/automated/src/ui/button/button-tests.ts @@ -3,6 +3,7 @@ import * as helper from '../../ui-helper'; import { View, EventData, Button, Observable, Color, Page, FormattedString } from '@nativescript/core'; import * as buttonTestsNative from './button-tests-native'; import * as spanModule from '@nativescript/core/text/span'; +import { tapEvent } from '@nativescript/core/ui/button'; // >> button-require-others import { BindingOptions } from '@nativescript/core/ui/core/bindable'; @@ -100,7 +101,7 @@ var _testOnClick = function (views: Array) { var actualValue = false; // >> button-tap - button.on(Button.tapEvent, function (args: EventData) { + button.on(tapEvent, function (args: EventData) { // Do something // >> (hide) actualValue = true; diff --git a/apps/automated/src/ui/page/page-tests-common.ts b/apps/automated/src/ui/page/page-tests-common.ts index 00f5035d85..d33ca95dc7 100644 --- a/apps/automated/src/ui/page/page-tests-common.ts +++ b/apps/automated/src/ui/page/page-tests-common.ts @@ -181,7 +181,7 @@ function _test_PageNavigation_EventSequence(withTransition: boolean) { helper.navigateWithEntry(navigationEntry); helper.goBack(); - const expectedEventSequence = ['navigatingTo', 'loaded', 'navigatedTo', 'navigatingFrom', 'unloaded', 'navigatedFrom']; + const expectedEventSequence = ['navigatingTo', 'loaded', 'navigatedTo', 'navigatingFrom', 'navigatedFrom', 'unloaded']; TKUnit.arrayAssert(eventSequence, expectedEventSequence, 'Actual event sequence is not equal to expected. Actual: ' + eventSequence + '; Expected: ' + expectedEventSequence); } diff --git a/apps/automated/src/ui/root-view/mymodule/MyControl.ts b/apps/automated/src/ui/root-view/mymodule/MyControl.ts index dd0382909c..36df8b0695 100644 --- a/apps/automated/src/ui/root-view/mymodule/MyControl.ts +++ b/apps/automated/src/ui/root-view/mymodule/MyControl.ts @@ -13,7 +13,7 @@ export class MyControl extends stackLayoutModule.StackLayout { lbl.id = 'my-test-label'; var btn = new button.Button(); btn.text = 'Tap me!'; - btn.on(button.Button.tapEvent, (args: EventData) => { + btn.on(button.tapEvent, (args: EventData) => { lbl.text = 'Tap ' + counter++; }); diff --git a/apps/automated/src/ui/tab-view/tab-view-navigation-tests.ts b/apps/automated/src/ui/tab-view/tab-view-navigation-tests.ts index 225dac2892..3bbae7622f 100644 --- a/apps/automated/src/ui/tab-view/tab-view-navigation-tests.ts +++ b/apps/automated/src/ui/tab-view/tab-view-navigation-tests.ts @@ -7,7 +7,7 @@ import { Frame } from '@nativescript/core/ui/frame'; import { Page } from '@nativescript/core/ui/page'; import { ListView, ItemEventData } from '@nativescript/core/ui/list-view'; import { TabView, TabViewItem } from '@nativescript/core/ui/tab-view'; -import { Button } from '@nativescript/core/ui/button'; +import { Button, tapEvent} from '@nativescript/core/ui/button'; var ASYNC = 2; @@ -44,7 +44,7 @@ function _createListView(): ListView { var button =