From f75bbe9f43ba33d111d09f1d6cfe1a1853bb5545 Mon Sep 17 00:00:00 2001 From: Tom Ratcliffe Date: Thu, 9 Jan 2025 10:02:52 +0000 Subject: [PATCH] Alerting: Add self closing comp rule to alerting eslint config (#98603) --- eslint.config.js | 2 ++ .../unified/components/permissions/ManagePermissions.tsx | 2 +- .../alerting/unified/components/receivers/TemplateForm.tsx | 2 +- .../alerting/unified/components/receivers/TemplatesTable.tsx | 4 ++-- .../components/receivers/form/GenerateAlertDataModal.tsx | 2 +- .../components/receivers/form/fields/KeyValueMapInput.tsx | 2 +- .../alert-rule-form/simplifiedRouting/AlertManagerRouting.tsx | 4 ++-- .../notificaton-preview/NotificationPreviewByAlertManager.tsx | 4 ++-- .../unified/components/rules/Filter/RulesFilter.v2.tsx | 4 ++-- .../unified/components/silences/SilencedAlertsTable.tsx | 4 ++-- .../unified/components/silences/SilencedAlertsTableRow.tsx | 2 +- .../app/features/alerting/unified/rule-list/GroupedView.tsx | 2 +- 12 files changed, 18 insertions(+), 16 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 7c1b5d23fb4..17be1ebc4e0 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -249,6 +249,7 @@ module.exports = [ name: 'grafana/alerting-overrides', plugins: { unicorn: unicornPlugin, + react: reactPlugin, }, files: ['public/app/features/alerting/**/*.{ts,tsx,js,jsx}'], rules: { @@ -256,6 +257,7 @@ module.exports = [ 'dot-notation': 'error', 'prefer-const': 'error', 'react/no-unused-prop-types': 'error', + 'react/self-closing-comp': 'error', 'unicorn/no-unused-properties': 'error', }, }, diff --git a/public/app/features/alerting/unified/components/permissions/ManagePermissions.tsx b/public/app/features/alerting/unified/components/permissions/ManagePermissions.tsx index 6bbe527fafd..aa82b4b794c 100644 --- a/public/app/features/alerting/unified/components/permissions/ManagePermissions.tsx +++ b/public/app/features/alerting/unified/components/permissions/ManagePermissions.tsx @@ -30,7 +30,7 @@ export const ManagePermissionsDrawer = ({ const defaultTitle = t('alerting.manage-permissions.title', 'Manage permissions'); return ( - + ); }; diff --git a/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx b/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx index d9304ae90c6..96ca2dedd46 100644 --- a/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx @@ -324,7 +324,7 @@ export const TemplateForm = ({ originalTemplate, prefill, alertmanager }: Props) {isGrafanaAlertManager && ( <>
-
+
{ - + Template group {isExpanded && ( - + -
+
{alerts.length > 0 && (
Review alert data to add to the payload:
diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx index 0bd18538cf1..5a1bccdd34e 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx @@ -47,7 +47,7 @@ export const KeyValueMapInput = ({ value, onChange, readOnly = false }: Props) = Name Value - {!readOnly && } + {!readOnly && } diff --git a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/simplifiedRouting/AlertManagerRouting.tsx b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/simplifiedRouting/AlertManagerRouting.tsx index 521a4c8e7c5..1d6b7c0b3f3 100644 --- a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/simplifiedRouting/AlertManagerRouting.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/simplifiedRouting/AlertManagerRouting.tsx @@ -40,13 +40,13 @@ export function AlertManagerManualRouting({ alertManager }: AlertManagerManualRo return ( -
+
Alertmanager: Alert manager logo {alertManagerName}
-
+
diff --git a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx index 813187556cb..ddf78bef3fe 100644 --- a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx @@ -49,13 +49,13 @@ function NotificationPreviewByAlertManager({
{!onlyOneAM && ( -
+
Alertmanager: {alertManagerSource.name}
-
+
)} diff --git a/public/app/features/alerting/unified/components/rules/Filter/RulesFilter.v2.tsx b/public/app/features/alerting/unified/components/rules/Filter/RulesFilter.v2.tsx index 7faa69f1f83..1c682cc689e 100644 --- a/public/app/features/alerting/unified/components/rules/Filter/RulesFilter.v2.tsx +++ b/public/app/features/alerting/unified/components/rules/Filter/RulesFilter.v2.tsx @@ -84,7 +84,7 @@ const FilterOptions = () => { - + {}}> +