mirror of
https://github.com/grafana/grafana.git
synced 2026-08-05 19:07:06 -05:00
Chore: run knip against the testdata datasource (#125634)
* run knip against the testdata datasource * add to lint check
This commit is contained in:
@@ -381,6 +381,7 @@ jobs:
|
||||
run: |
|
||||
yarn run knip --workspace '@grafana/*'
|
||||
yarn run knip --workspace '@test-plugins/*'
|
||||
yarn run knip --workspace '@grafana-plugins/grafana-testdata-datasource'
|
||||
|
||||
yarn-install-validation:
|
||||
needs:
|
||||
|
||||
@@ -31,6 +31,9 @@ const config: KnipConfig = {
|
||||
webpack: false,
|
||||
jest: true,
|
||||
entry: [...packageEntries, 'module.{ts,tsx,js}'],
|
||||
// these are provided by grafana-plugin-configs
|
||||
ignoreDependencies: ['@swc/jest'],
|
||||
ignoreUnresolved: ['identity-obj-proxy'],
|
||||
},
|
||||
'e2e-playwright/test-plugins/*': {
|
||||
// TODO figure out how to properly include webpack/jest configs
|
||||
|
||||
@@ -1,31 +1,6 @@
|
||||
import { LogLevel } from '@grafana/data';
|
||||
|
||||
let index = 0;
|
||||
|
||||
export function getRandomLogLevel(): LogLevel {
|
||||
const v = Math.random();
|
||||
if (v > 0.9) {
|
||||
return LogLevel.critical;
|
||||
}
|
||||
if (v > 0.8) {
|
||||
return LogLevel.error;
|
||||
}
|
||||
if (v > 0.7) {
|
||||
return LogLevel.warning;
|
||||
}
|
||||
if (v > 0.4) {
|
||||
return LogLevel.info;
|
||||
}
|
||||
if (v > 0.3) {
|
||||
return LogLevel.debug;
|
||||
}
|
||||
if (v > 0.1) {
|
||||
return LogLevel.trace;
|
||||
}
|
||||
return LogLevel.unknown;
|
||||
}
|
||||
|
||||
export function getNextWord() {
|
||||
function getNextWord() {
|
||||
index = (index + Math.floor(Math.random() * 5)) % words.length;
|
||||
return words[index];
|
||||
}
|
||||
|
||||
+2
-2
@@ -67,13 +67,13 @@ export const usaQueryModes = [
|
||||
'timeseries-wide',
|
||||
].map((f) => ({ label: f, value: f }));
|
||||
|
||||
export const fieldNames = [
|
||||
const fieldNames = [
|
||||
'foo',
|
||||
'bar',
|
||||
'baz', // all short
|
||||
].map((f) => ({ label: f, value: f }));
|
||||
|
||||
export const stateNames = [
|
||||
const stateNames = [
|
||||
'AL',
|
||||
'AK',
|
||||
'AZ',
|
||||
|
||||
@@ -79,11 +79,6 @@ export interface USAQuery {
|
||||
states?: string[];
|
||||
}
|
||||
|
||||
export const defaultUSAQuery: Partial<USAQuery> = {
|
||||
fields: [],
|
||||
states: [],
|
||||
};
|
||||
|
||||
export interface CSVWave {
|
||||
labels?: string;
|
||||
name?: string;
|
||||
@@ -130,9 +125,3 @@ export interface TestDataDataQuery extends common.DataQuery {
|
||||
usa?: USAQuery;
|
||||
errorSource?: 'plugin' | 'downstream';
|
||||
}
|
||||
|
||||
export const defaultTestDataDataQuery: Partial<TestDataDataQuery> = {
|
||||
csvWave: [],
|
||||
points: [],
|
||||
scenarioId: TestDataQueryType.RandomWalk,
|
||||
};
|
||||
|
||||
@@ -11,13 +11,10 @@
|
||||
"@grafana/ui": "13.1.0-pre",
|
||||
"d3-random": "^3.0.1",
|
||||
"lodash": "^4.17.23",
|
||||
"micro-memoize": "^4.1.2",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-select": "5.10.2",
|
||||
"react-use": "17.6.0",
|
||||
"rxjs": "7.8.2",
|
||||
"tslib": "2.8.1"
|
||||
"rxjs": "7.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@grafana/e2e-selectors": "13.1.0-pre",
|
||||
@@ -33,7 +30,6 @@
|
||||
"@types/react": "18.3.18",
|
||||
"@types/react-dom": "18.3.5",
|
||||
"jest": "29.7.0",
|
||||
"ts-node": "10.9.2",
|
||||
"typescript": "6.0.2",
|
||||
"webpack": "^5.105.0"
|
||||
},
|
||||
|
||||
@@ -51,7 +51,7 @@ export function runStream(
|
||||
throw new Error(`Unknown Stream Type: ${query.type}`);
|
||||
}
|
||||
|
||||
export function runSignalStream(
|
||||
function runSignalStream(
|
||||
target: TestDataDataQuery,
|
||||
query: StreamingQuery,
|
||||
req: DataQueryRequest<TestDataDataQuery>
|
||||
@@ -131,7 +131,7 @@ export function runSignalStream(
|
||||
});
|
||||
}
|
||||
|
||||
export function runLogsStream(
|
||||
function runLogsStream(
|
||||
target: TestDataDataQuery,
|
||||
query: StreamingQuery,
|
||||
req: DataQueryRequest<TestDataDataQuery>
|
||||
@@ -183,7 +183,7 @@ interface StreamMessage {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export function runWatchStream(
|
||||
function runWatchStream(
|
||||
target: TestDataDataQuery,
|
||||
query: StreamingQuery,
|
||||
req: DataQueryRequest<TestDataDataQuery>
|
||||
@@ -260,7 +260,7 @@ export function runWatchStream(
|
||||
});
|
||||
}
|
||||
|
||||
export function runFetchStream(
|
||||
function runFetchStream(
|
||||
target: TestDataDataQuery,
|
||||
query: StreamingQuery,
|
||||
req: DataQueryRequest<TestDataDataQuery>
|
||||
@@ -340,7 +340,7 @@ export function runFetchStream(
|
||||
});
|
||||
}
|
||||
|
||||
export function runTracesStream(
|
||||
function runTracesStream(
|
||||
target: TestDataDataQuery,
|
||||
query: StreamingQuery,
|
||||
req: DataQueryRequest<TestDataDataQuery>
|
||||
|
||||
@@ -1907,14 +1907,10 @@ __metadata:
|
||||
d3-random: "npm:^3.0.1"
|
||||
jest: "npm:29.7.0"
|
||||
lodash: "npm:^4.17.23"
|
||||
micro-memoize: "npm:^4.1.2"
|
||||
react: "npm:18.3.1"
|
||||
react-dom: "npm:18.3.1"
|
||||
react-select: "npm:5.10.2"
|
||||
react-use: "npm:17.6.0"
|
||||
rxjs: "npm:7.8.2"
|
||||
ts-node: "npm:10.9.2"
|
||||
tslib: "npm:2.8.1"
|
||||
typescript: "npm:6.0.2"
|
||||
webpack: "npm:^5.105.0"
|
||||
peerDependencies:
|
||||
|
||||
Reference in New Issue
Block a user