Skip to content

Commit

Permalink
Build: Introduce stricter typechecking (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackw authored Apr 17, 2024
1 parent 0d436bb commit ab15469
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/create-plugin/src/utils/utils.packageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function getPackageManagerFromLockFile(): PackageManager | undefined {
if (error instanceof Error) {
throw error;
}
return undefined;
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/create-plugin/src/utils/utils.templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path';
import fs from 'node:fs';
import { mkdirp } from 'mkdirp';
import createDebug from 'debug';
import { directoryExists, filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
import { renderHandlebarsTemplate } from './utils.handlebars.js';
import { getPluginJson } from './utils.plugin.js';
import {
Expand All @@ -17,7 +17,7 @@ import { TemplateData } from '../types.js';
import { getPackageManagerInstallCmd, getPackageManagerWithFallback } from './utils.packageManager.js';
import { getExportFileName } from '../utils/utils.files.js';
import { getVersion } from './utils.version.js';
import { FeatureFlags, getConfig } from './utils.config.js';
import { getConfig } from './utils.config.js';

const debug = createDebug('templates');

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-e2e/src/fixtures/isFeatureToggleEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PlaywrightArgs } from '../types';

type FeatureToggleFixture = TestFixture<<T = object>(featureToggle: keyof T) => Promise<boolean>, PlaywrightArgs>;

export const isFeatureToggleEnabled: FeatureToggleFixture = async ({ page, grafanaVersion }, use) => {
export const isFeatureToggleEnabled: FeatureToggleFixture = async ({ page }, use) => {
await use(async <T = object>(featureToggle: keyof T) => {
const featureToggles: T = await page.evaluate('window.grafanaBootData.settings.featureToggles');
return Boolean(featureToggles[featureToggle]);
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-e2e/src/models/pages/ExplorePage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as semver from 'semver';
import { Locator, expect } from '@playwright/test';
import { Locator } from '@playwright/test';
import { NavigateOptions, PluginTestCtx, RequestOptions } from '../../types';
import { DataSourcePicker } from '../components/DataSourcePicker';
import { GrafanaPage } from './GrafanaPage';
Expand All @@ -8,10 +8,8 @@ import { Panel } from '../components/Panel';

const TIME_SERIES_PANEL_SELECTOR_SUFFIX = 'Graph';
const TABLE_PANEL_SELECTOR_SUFFIX = 'Table';
const LOGS_PANEL_SELECTOR_SUFFIX = 'Logs';
const TIME_SERIES_PANEL_TEXT = 'Graph Lines Bars Points';
const TABLE_PANEL_TEXT = 'Table';
const LOGS_PANEL_TEXT = 'Logs';

export class ExplorePage extends GrafanaPage {
datasource: DataSourcePicker;
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-e2e/src/models/pages/PluginConfigPage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Response as PlaywrightResponse } from '@playwright/test';
import { PluginPageArgs, NavigateOptions, PluginTestCtx } from '../../types';
import { GrafanaPage } from './GrafanaPage';

Expand Down
6 changes: 6 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": ["@tsconfig/recommended/tsconfig.json", "@tsconfig/node20/tsconfig.json"],
"compilerOptions": {
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": true,
"types": ["vitest/globals"]
}
Expand Down

0 comments on commit ab15469

Please sign in to comment.