From 28f3ac228a3e7d97930cc4ae0701d860c385e21f Mon Sep 17 00:00:00 2001 From: Roger Qiu Date: Thu, 26 May 2022 11:45:35 +1000 Subject: [PATCH 1/2] Added postversion script to fully update package-lock.json --- package-lock.json | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index e3a754b..f136c12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "@matrixai/typescript-demo-lib-native", - "version": "2.0.2", + "version": "2.0.3", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 1061b2c..d30d7bc 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "install": "node-gyp-build", "prebuild": "prebuildify --napi --strip --target=16.14.2", "build": "rimraf ./dist && tsc -p ./tsconfig.build.json", + "postversion": "npm install --package-lock-only --ignore-scripts --silent", "ts-node": "ts-node -r tsconfig-paths/register", "test": "jest", "lint": "eslint '{src,tests}/**/*.{js,ts}'", From 83341b9640cab5bcc16e43d62a34f7187a67f80b Mon Sep 17 00:00:00 2001 From: Roger Qiu Date: Thu, 26 May 2022 11:54:37 +1000 Subject: [PATCH 2/2] WIP: attempt to bring in import/no-cycle rule --- .eslintrc | 7 +++++++ src/lib/Library.ts | 4 ++++ src/lib/NumPair.ts | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/.eslintrc b/.eslintrc index 9d5a993..a17c925 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,6 +11,7 @@ "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended", + "plugin:import/typescript", "prettier" ], "plugins": [ @@ -78,6 +79,12 @@ ] } ], + "import/no-cycle": [ + "error", + { + "ignoreExternal": true + } + ], "@typescript-eslint/no-namespace": 0, "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/explicit-module-boundary-types": 0, diff --git a/src/lib/Library.ts b/src/lib/Library.ts index 3b63855..faa80dc 100644 --- a/src/lib/Library.ts +++ b/src/lib/Library.ts @@ -1,8 +1,12 @@ +import NumPair from './NumPair'; + class Library { someParam: string; + num: NumPair; constructor(someParam = 'Parameter') { this.someParam = someParam; + this.num = new NumPair(); } } diff --git a/src/lib/NumPair.ts b/src/lib/NumPair.ts index 331a23d..2296fbd 100644 --- a/src/lib/NumPair.ts +++ b/src/lib/NumPair.ts @@ -1,10 +1,14 @@ +import Library from './Library'; + class NumPair { num1: number; num2: number; + lib: Library; constructor(firstNum = 0, secondNum = 0) { this.num1 = firstNum; this.num2 = secondNum; + this.lib = new Library(); } }