Skip to content

Commit

Permalink
Update to TypeScript 4.x #1071 (#1130)
Browse files Browse the repository at this point in the history
* Update to TypeScript 4.x #1071
- Enable ESLint-Fix during compilation
- Fold react and React Native projects back into main build

* Update new PerfMarkMeasure to TypeScript 4.x build

* Missed updates from previous PR -- remove unused variables
  • Loading branch information
MSNev committed Aug 16, 2021
1 parent 9b10d60 commit f3f1a80
Show file tree
Hide file tree
Showing 59 changed files with 30,862 additions and 18,148 deletions.
36 changes: 36 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"env": {
"browser": true,
"es2021": true
},
"plugins": [
"security"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:security/recommended"
],
"rules": {
"quotes": ["off", "double"], // Re-enable for auto fixing
"prefer-const": "off",
"prefer-spread": "off",
"no-var": "off",
"no-extra-boolean-cast": "off",
"prefer-rest-params": "off",
"no-case-declarations": "off",
"no-prototype-builtins": "off",
"no-useless-escape": "off", // Suppressing Error -- need to Review Later
"security/detect-object-injection": "off", // Suppress Warning -- need to Review Later
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-vars": "off", // Re-enable for auto fixing
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-extra-semi": "off" // Re-enable for auto fixing
}
}
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ jobs:

strategy:
matrix:
node-version: [10.x]
node-version: [10.x, 12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install rollup -g
- run: npm install grunt-cli findup-sync nopt pify@2.3.0
- run: npm install
- run: node common/scripts/install-run-rush.js check
- run: node common/scripts/install-run-rush.js install
- run: npm run build --verbose
timeout-minutes: 10
- run: npm run test --verbose
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build --if-present
- run: npm test
# - run: npm install
# - run: npm run build --if-present
# - run: npm test
22 changes: 11 additions & 11 deletions .github/workflows/reactnative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install root dependencies
run: npm install
- name: Install ReactNative plugin dependencies
working-directory: extensions/applicationinsights-react-native
run: npm install
- name: Build ReactNative plugin
working-directory: extensions/applicationinsights-react-native
run: npm run build --if-present
- name: Run tests for ReactNative plugin
working-directory: extensions/applicationinsights-react-native
run: npm test
# - name: Install root dependencies
# run: npm install
# - name: Install ReactNative plugin dependencies
# working-directory: extensions/applicationinsights-react-native
# run: npm install
# - name: Build ReactNative plugin
# working-directory: extensions/applicationinsights-react-native
# run: npm run build --if-present
# - name: Run tests for ReactNative plugin
# working-directory: extensions/applicationinsights-react-native
# run: npm test
4 changes: 2 additions & 2 deletions AISKU/Tests/applicationinsights.e2e.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,8 @@ export class ApplicationInsightsTests extends TestClass {
}

class CustomTestError extends Error {
constructor(message = "", ...args) {
super(message, ...args);
constructor(message = "") {
super(message);
this.name = "CustomTestError";
this.message = message + " -- test error.";
}
Expand Down
13 changes: 7 additions & 6 deletions AISKU/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
"@microsoft/applicationinsights-rollup-es3": "1.1.3",
"sinon": "^7.3.1",
"chromedriver": "^2.45.0",
"@microsoft/api-extractor": "^7.9.11",
"@microsoft/api-extractor": "^7.18.1",
"finalhandler": "^1.1.1",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^5.0.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"grunt-tslint": "^5.0.2",
"@nevware21/grunt-eslint-ts": "^0.2.1",
"globby": "^11.0.0",
"magic-string": "^0.25.7",
"pako": "^2.0.3",
Expand All @@ -56,10 +56,11 @@
"selenium-server-standalone-jar": "^3.141.5",
"serve-static": "^1.13.2",
"source-map-loader": "^0.2.3",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "2.5.3",
"tslib": "^1.13.0"
"typescript": "^4.3.4",
"tslib": "^2.0.0"
},
"peerDependencies": {
"tslib": "*"
},
"dependencies": {
"@microsoft/dynamicproto-js": "^1.1.4",
Expand Down
6 changes: 3 additions & 3 deletions AISKU/src/Initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ export class Initialization implements IApplicationInsights {

// apply updated properties to the global instance (snippet)
objForEachKey(_self, (field, value) => {
if (isString(field) &&
!isFunction(value) &&
if (isString(field) &&
!isFunction(value) &&
field && field[0] !== "_" && // Don't copy "internal" values
_ignoreUpdateSnippetProperties.indexOf(field) === -1) {
_ignoreUpdateSnippetProperties.indexOf(field) === -1) {
snippet[field as string] = value;
}
});
Expand Down
13 changes: 7 additions & 6 deletions AISKULight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
"devDependencies": {
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
"@microsoft/applicationinsights-rollup-es3": "1.1.3",
"@microsoft/api-extractor": "^7.9.11",
"@microsoft/api-extractor": "^7.18.1",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^5.0.1",
"grunt-run": "^0.8.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"@nevware21/grunt-eslint-ts": "^0.2.1",
"globby": "^11.0.0",
"magic-string": "^0.25.7",
"@rollup/plugin-commonjs": "^18.0.0",
Expand All @@ -35,10 +36,11 @@
"rollup-plugin-cleanup": "3.2.1",
"rollup": "^2.32.0",
"source-map-loader": "^0.2.3",
"typescript": "2.5.3",
"tslib": "^1.13.0",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0"
"typescript": "^4.3.4",
"tslib": "^2.0.0"
},
"peerDependencies": {
"tslib": "*"
},
"dependencies": {
"@microsoft/dynamicproto-js": "^1.1.4",
Expand All @@ -47,6 +49,5 @@
"@microsoft/applicationinsights-channel-js": "2.6.5",
"@microsoft/applicationinsights-core-js": "2.6.5"
},
"peerDependencies": {},
"license": "MIT"
}
13 changes: 7 additions & 6 deletions channels/applicationinsights-channel-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,27 @@
"@microsoft/ai-test-framework": "0.0.1",
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
"@microsoft/applicationinsights-rollup-es3": "1.1.3",
"@microsoft/api-extractor": "^7.9.11",
"@microsoft/api-extractor": "^7.18.1",
"@types/sinon": "4.3.3",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^5.0.1",
"grunt-run": "^0.8.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"@nevware21/grunt-eslint-ts": "^0.2.1",
"globby": "^11.0.0",
"magic-string": "^0.25.7",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@rollup/plugin-replace": "^2.3.3",
"rollup-plugin-cleanup": "3.2.1",
"rollup": "^2.32.0",
"typescript": "2.5.3",
"tslib": "^1.13.0",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.3.4",
"tslib": "^2.0.0",
"sinon": "^7.3.1"
},
"peerDependencies": {
"tslib": "*"
},
"dependencies": {
"@microsoft/dynamicproto-js": "^1.1.4",
"@microsoft/applicationinsights-shims": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion channels/applicationinsights-channel-js/src/Sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
const xdr = new XDomainRequest();
xdr.onload = () => _self._xdrOnLoad(xdr, payload);
xdr.onerror = (event: ErrorEvent|any) => _self._onError(payload, _formatErrorMessageXdr(xdr), event);

// XDomainRequest requires the same protocol as the hosting page.
// If the protocol doesn't match, we can't send the telemetry :(.
const hostingProtocol = _window && _window.location && _window.location.protocol || "";
Expand Down
11 changes: 6 additions & 5 deletions common/Tests/Framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@
"grunt": "^1.4.1",
"grunt-contrib-qunit": "^5.0.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0",
"tslint-microsoft-contrib": "^5.2.1",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@rollup/plugin-replace": "^2.3.3",
"rollup": "^2.32.0",
"typescript": "2.5.3",
"tslib": "^1.13.0",
"typescript": "^4.3.4",
"tslib": "^2.0.0",
"qunit": "^2.11.2",
"sinon": "^7.3.1",
"globby": "^11.0.0",
"magic-string": "^0.25.7"
},
"peerDependencies": {
"tslib": "*"
},
"dependencies": {
"@microsoft/dynamicproto-js": "^1.1.4"
}
Expand Down
1 change: 1 addition & 0 deletions common/Tests/Framework/src/AITestClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ export class AITestClass {
try {
this._removeFuncHooks(target[name]);
} catch (e) {
// eslint-disable-next-line no-empty
}
});
}
Expand Down
Loading

0 comments on commit f3f1a80

Please sign in to comment.