Chore: Set tsconfig target to ES6 (#44842)

* chore(tsconfig): update grafana/tsconfig to 1.2.0 for outputting es6

* rewrote the unsubscription part to use first().

* test: update failing tests to work with es6 output

* removed bug where we dispatch a promise instead of an array of ritch history.

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
Jack Westbrook 2022-02-10 14:37:39 +01:00 committed by GitHub
parent 57ecabf319
commit 979907e9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 42 additions and 50 deletions

View File

@ -87,7 +87,7 @@
"@grafana/e2e": "workspace:*",
"@grafana/eslint-config": "2.5.2",
"@grafana/toolkit": "workspace:*",
"@grafana/tsconfig": "^1.1.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@lingui/cli": "3.13.2",
"@lingui/macro": "3.13.2",
"@microsoft/api-extractor": "7.19.4",

View File

@ -42,7 +42,7 @@
"xss": "1.0.10"
},
"devDependencies": {
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@rollup/plugin-commonjs": "21.0.1",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.1.3",

View File

@ -34,7 +34,7 @@
},
"types": "src/index.ts",
"dependencies": {
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"tslib": "2.3.1",
"typescript": "4.4.4"
}

View File

@ -49,7 +49,7 @@
"@babel/preset-env": "7.16.11",
"@cypress/webpack-preprocessor": "5.11.0",
"@grafana/e2e-selectors": "8.5.0-pre",
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@mochajs/json-file-reporter": "^1.2.0",
"babel-loader": "8.2.3",
"blink-diff": "1.0.13",

View File

@ -35,7 +35,7 @@
"tslib": "2.3.1"
},
"devDependencies": {
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@rollup/plugin-commonjs": "21.0.1",
"@rollup/plugin-node-resolve": "13.1.3",
"@testing-library/dom": "8.11.3",

View File

@ -22,7 +22,7 @@
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@rollup/plugin-commonjs": "21.0.1",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.1.3",

View File

@ -30,7 +30,7 @@
"@babel/preset-env": "7.13.12",
"@grafana/data": "8.5.0-pre",
"@grafana/eslint-config": "2.5.2",
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@grafana/ui": "8.5.0-pre",
"@jest/core": "26.6.3",
"@rushstack/eslint-patch": "1.0.6",

View File

@ -95,7 +95,7 @@
},
"devDependencies": {
"@babel/core": "7.17.0",
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@mdx-js/react": "1.6.22",
"@rollup/plugin-commonjs": "21.0.1",
"@rollup/plugin-image": "2.1.1",

View File

@ -9,7 +9,7 @@
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.2.0-rc1",
"@types/classnames": "^2.2.7",
"@types/deep-freeze": "^0.1.1",
"@types/grafana__slate-react": "npm:@types/slate-react@0.22.5",

View File

@ -1,5 +1,5 @@
import { throwError } from 'rxjs';
import { delay } from 'rxjs/operators';
import { delay, first } from 'rxjs/operators';
import { setDataSourceSrv } from '@grafana/runtime';
import { AlertState, AlertStateInfo } from '@grafana/data';
@ -60,18 +60,19 @@ function expectOnResults(args: {
expect: (results: DashboardQueryRunnerResult) => void;
}) {
const { runner, done, panelId, expect: expectCallback } = args;
const subscription = runner.getResult(panelId).subscribe({
next: (value) => {
try {
expectCallback(value);
subscription?.unsubscribe();
done();
} catch (err) {
subscription?.unsubscribe();
done.fail(err);
}
},
});
runner
.getResult(panelId)
.pipe(first())
.subscribe({
next: (value) => {
try {
expectCallback(value);
done();
} catch (err) {
done.fail(err);
}
},
});
}
describe('DashboardQueryRunnerImpl', () => {

View File

@ -17,7 +17,7 @@ describe('OpenTsQueryCtrl', () => {
refresh: () => {},
};
OpenTsQueryCtrl.prototype = Object.assign(OpenTsQueryCtrl.prototype, ctx);
Object.assign(OpenTsQueryCtrl.prototype, ctx);
beforeEach(() => {
ctx.ctrl = new OpenTsQueryCtrl({}, {} as any);

View File

@ -10,11 +10,9 @@ import { dateTime, EventBusSrv } from '@grafana/data';
import { DashboardModel } from '../../../../features/dashboard/state';
jest.mock('../event_manager', () => ({
EventManager: () => {
return {
on: () => {},
addFlotEvents: () => {},
};
EventManager: class EventManagerMock {
on() {}
addFlotEvents() {}
},
}));
@ -47,7 +45,7 @@ describe('grafanaGraph', () => {
lightTheme: false,
},
};
GraphCtrl.prototype = {
Object.assign(GraphCtrl.prototype, {
...MetricsPanelCtrl.prototype,
...PanelCtrl.prototype,
...GraphCtrl.prototype,
@ -96,7 +94,7 @@ describe('grafanaGraph', () => {
annotationsSrv: {
getAnnotations: () => Promise.resolve({}),
},
} as any;
}) as any;
ctx.data = [];
ctx.data.push(

View File

@ -3970,7 +3970,7 @@ __metadata:
dependencies:
"@braintree/sanitize-url": 5.0.2
"@grafana/schema": 8.5.0-pre
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@rollup/plugin-commonjs": 21.0.1
"@rollup/plugin-json": 4.1.0
"@rollup/plugin-node-resolve": 13.1.3
@ -4025,7 +4025,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors"
dependencies:
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@rollup/plugin-commonjs": 21.0.1
"@rollup/plugin-node-resolve": 13.1.3
"@types/node": 16.11.22
@ -4046,7 +4046,7 @@ __metadata:
"@babel/preset-env": 7.16.11
"@cypress/webpack-preprocessor": 5.11.0
"@grafana/e2e-selectors": 8.5.0-pre
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@mochajs/json-file-reporter": ^1.2.0
"@rollup/plugin-commonjs": 21.0.1
"@rollup/plugin-node-resolve": 13.1.3
@ -4127,7 +4127,7 @@ __metadata:
dependencies:
"@grafana/data": 8.5.0-pre
"@grafana/e2e-selectors": 8.5.0-pre
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@grafana/ui": 8.5.0-pre
"@rollup/plugin-commonjs": 21.0.1
"@rollup/plugin-node-resolve": 13.1.3
@ -4161,7 +4161,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@grafana/schema@workspace:packages/grafana-schema"
dependencies:
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@rollup/plugin-commonjs": 21.0.1
"@rollup/plugin-json": 4.1.0
"@rollup/plugin-node-resolve": 13.1.3
@ -4212,7 +4212,7 @@ __metadata:
"@babel/preset-env": 7.13.12
"@grafana/data": 8.5.0-pre
"@grafana/eslint-config": 2.5.2
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@grafana/ui": 8.5.0-pre
"@jest/core": 26.6.3
"@rushstack/eslint-patch": 1.0.6
@ -4290,17 +4290,10 @@ __metadata:
languageName: unknown
linkType: soft
"@grafana/tsconfig@npm:^1.0.0-rc1":
version: 1.0.0-rc1
resolution: "@grafana/tsconfig@npm:1.0.0-rc1"
checksum: addb8b27fe2d1fb525c535a7eb38c8066a07638cb26cd4bc5b2e781ac542ba3dca3e82b87141218c44879894e37303e491e09a40c4bd25434b4554c51ce7f9e3
languageName: node
linkType: hard
"@grafana/tsconfig@npm:^1.1.0-rc1":
version: 1.1.0-rc1
resolution: "@grafana/tsconfig@npm:1.1.0-rc1"
checksum: cc66393faffe4574d63c35a8516b53bab0025c320d89d3acd559647cf2ce81384bbcfb250837e588e39b1abefda7b279e2877cf18bae8ddb0dd6254d5e9688f2
"@grafana/tsconfig@npm:^1.2.0-rc1":
version: 1.2.0-rc1
resolution: "@grafana/tsconfig@npm:1.2.0-rc1"
checksum: 621a400a762b97a33aade0c03eb8e7bdd1aa1635fab9eb2c03cd7cb7d80fb56e0fbdfc68b74a2abafacc623ad118e2ccaaf46164ee577b9c9c186a83a923d01d
languageName: node
linkType: hard
@ -4316,7 +4309,7 @@ __metadata:
"@grafana/e2e-selectors": 8.5.0-pre
"@grafana/schema": 8.5.0-pre
"@grafana/slate-react": 0.22.10-grafana
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@mdx-js/react": 1.6.22
"@monaco-editor/react": 4.3.1
"@popperjs/core": 2.11.2
@ -4551,7 +4544,7 @@ __metadata:
dependencies:
"@emotion/css": 11.7.1
"@grafana/data": 8.5.0-pre
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@grafana/ui": 8.5.0-pre
"@types/classnames": ^2.2.7
"@types/deep-freeze": ^0.1.1
@ -20321,7 +20314,7 @@ __metadata:
"@grafana/schema": "workspace:*"
"@grafana/slate-react": 0.22.10-grafana
"@grafana/toolkit": "workspace:*"
"@grafana/tsconfig": ^1.1.0-rc1
"@grafana/tsconfig": ^1.2.0-rc1
"@grafana/ui": "workspace:*"
"@jaegertracing/jaeger-ui-components": "workspace:*"
"@kusto/monaco-kusto": 4.1.3