Commit Graph

8 Commits

Author SHA1 Message Date
Jack Westbrook
8c41137bcf
Frontend: Update to Eslint 9 (#94823)
* chore(eslint): bump all eslint related packages to latest

* chore(eslint): update linting scripts work with v9

* chore(eslint): introduce flat config

* chore(eslint): delete legacy configs

* feat(grafana-eslint-rules): update rules to use eslint 9 APIs

* chore(eslint): migrate all nested eslintrc files over to root config

* chore(packages): bump eslint dependencies

* feat(betterer): make it work with eslint 9

* style(grafana-data): remove non-existant ban-types rule from disable declarations

* chore(wip): [wip] link eslint-config-grafana

* chore(packages): add @eslint/compat

* chore(eslint): add compat to testing library and fix alerting rules

* chore(eslint): bump grafana eslint-config to v8

* chore(explore): delete legacy eslint config

* chore: clean codeowners file, remove grafana/eslint-config from e2e plugins

* test(eslint-rules): fix no-border-radius-literal and no-aria-label-e2e-selectors rule tests

* Add .js to prettier checks so new eslint.config.js file isn't missed

* chore(eslint): move emotion/syntax-preference to grafana/defaults

* test(eslint): use core-js structured-clone

* revert(services): undo merge backend-format githook changes

* test(eslint-rules): remove structured-clone polyfill from tests

* chore(eslint): add back public/lib/monaco to ignore list, sort alphabetically

* chore(e2e-plugins): remove eslint config 7 from plugins package.json

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2024-11-07 16:31:06 +01:00
Erik Sundell
c29ed503db
Test plugins: Add datasource test plugin with field tests (#95472)
* add new test plugin

* add some field validation tests

* update lockfile

* fix bad test file name
2024-11-01 08:25:27 +01:00
grafana-delivery-bot[bot]
032d0669cd
Release: Bump version to 11.4.0-pre (#94569)
bump version 11.4.0-pre

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-11 11:31:04 +01:00
Levente Balogh
6096f46774
Plugin Extensions: Require meta-data to be defined in plugin.json during development mode (#93429)
* feat: add extensions to the backend plugin model

* feat: update the frontend plugin types

* feat(pluginContext): return a `null` if there is no context found

This will be necessary to understand if a certain hook is running inside a plugin context or not.

* feat: add utility functions for checking extension configs

* tests: fix failing tests due to the type updates

* feat(AddedComponentsRegistry): validate plugin meta-info

* feat(AddedLinksRegistry): validate  meta-info

* feat(ExposedComponentsRegistry): validate meta-info

* feat(usePluginComponent): add meta-info validation

* feat(usePluginComponents): add meta-info validation

* feat(usePluginLinks): add meta-info validation

* fix: only validate meta-info in registries if dev mode is enabled

* tests: add unit tests for the restrictions functionality

* tests: fix Go tests

* fix(tests): revert accidental changes

* fix: run goimports

* fix: api tests

* add nested app so that meta data can bested e2e tested

* refactor(types): extract the ExtensionInfo into a separate type

* refactor(extensions/utils): use Array.prototype.some() instead of .find()

* refactor(usePluginLinks): update warning message

* feat(usePluginExtensions()): validate plugin meta-info

* Wip

* fix(e2e): E2E tests for extensions

* fix(extensions): allow multiple "/" slashes in the extension point id

* fix(extensions/validators): stop validating the plugin id pattern

---------

Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
2024-10-04 08:41:26 +02:00
Jack Westbrook
1aed1d8017
Chore: Bump webpack for e2e test plugins (#93831)
chore(e2e-plugins): bump version of webpack to silence dependabot
2024-09-30 10:06:54 +02:00
Erik Sundell
db0cc24f2b
Plugin extensions: Introduce new registry for added links (#92343)
* add added component registry

* fix broken test

* add tests for usePluginComponents hook

* readd expose components

* add type assertion exceptions to betterer results

* use new addedComponent registry in legacy endpoints

* remove unused code

* cleanup

* revert test code

* remove commented code

* initial commit

* refactor sync method and hook

* fix tests

* subscribe to the correct registry

* remove old registry

* cleanup types

* add use usePluginLinks hook

* add more tests

* fix import order

* fix typo

* fix and temporarly skip failing tests

* wip

* add hook tests

* add more tests

* remove old hook

* fix versioning

* add version to all extension point ids

* remove cleanup

* remove unused imports

* revert touched file

* fix test

* test: remove hook creation

* catch init error

* send error to faro

* fix broken hook

* comment out call hook initialization

* use the right import ofr isString

* remove unused import

* remove registryState type

* pr feedback

* Update public/app/features/plugins/extensions/validators.test.tsx

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* Update public/app/features/plugins/extensions/validators.test.tsx

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* remove no longer relevant comment

* fix broken tests

* Fixed test to verify that the memotization works properly.

* simplify hooks

---------

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2024-08-30 10:09:01 +02:00
Erik Sundell
1373b37166
Plugin Extensions: E2E test addLink and legacy APIs (#92394)
* cleanup tests

* more cleanup

* added links

* test legacy hooks

* test legacy hooks

* update codeowners

* revert package changes

* add project specfic example script

* remove console log

* Update .github/CODEOWNERS

Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>

* Update CODEOWNERS

* use correct file names

* cleanup tests

---------

Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
2024-08-26 16:01:32 +02:00
Erik Sundell
d8ec95e9b1
E2E: Add support for building test plugins (#91873)
* build test apps with webpack

* add extensions test app

* update e2e tests

* remove non-build test apps using amd

* use @grafana/plugin-configs rather than create-plugin config

* Update e2e/plugin-e2e/plugin-e2e-api-tests/as-admin-user/extensions/usePluginComponents.spec.ts

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>

* Update package.json

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>

* use run dir variable instead of hardcoded path

* add dummy licence file

* add separate step for building test plugins

* support nested plugins

* remove react-router-dom from the externals array

* remove add_mode dev

* lint starlark

* pass license path as env variable

* fix the path

* chore(e2e-plugins): clean up dependencies to match core versions

* refactor(e2e-plugins): prefer extending webpack plugins-config

* docs(e2e-plugins): add basic info to extensions test plugin readme

* update readme

* change dir name from custom plugins to test plugins

* change root readme

* update lockfile

---------

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2024-08-23 09:00:03 +02:00