Alerting: Add self closing comp rule to alerting eslint config (#98603)

pull/98726/head
Tom Ratcliffe 6 months ago committed by GitHub
parent 42894ba840
commit f75bbe9f43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      eslint.config.js
  2. 2
      public/app/features/alerting/unified/components/permissions/ManagePermissions.tsx
  3. 2
      public/app/features/alerting/unified/components/receivers/TemplateForm.tsx
  4. 4
      public/app/features/alerting/unified/components/receivers/TemplatesTable.tsx
  5. 2
      public/app/features/alerting/unified/components/receivers/form/GenerateAlertDataModal.tsx
  6. 2
      public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx
  7. 4
      public/app/features/alerting/unified/components/rule-editor/alert-rule-form/simplifiedRouting/AlertManagerRouting.tsx
  8. 4
      public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx
  9. 4
      public/app/features/alerting/unified/components/rules/Filter/RulesFilter.v2.tsx
  10. 4
      public/app/features/alerting/unified/components/silences/SilencedAlertsTable.tsx
  11. 2
      public/app/features/alerting/unified/components/silences/SilencedAlertsTableRow.tsx
  12. 2
      public/app/features/alerting/unified/rule-list/GroupedView.tsx

@ -249,6 +249,7 @@ module.exports = [
name: 'grafana/alerting-overrides', name: 'grafana/alerting-overrides',
plugins: { plugins: {
unicorn: unicornPlugin, unicorn: unicornPlugin,
react: reactPlugin,
}, },
files: ['public/app/features/alerting/**/*.{ts,tsx,js,jsx}'], files: ['public/app/features/alerting/**/*.{ts,tsx,js,jsx}'],
rules: { rules: {
@ -256,6 +257,7 @@ module.exports = [
'dot-notation': 'error', 'dot-notation': 'error',
'prefer-const': 'error', 'prefer-const': 'error',
'react/no-unused-prop-types': 'error', 'react/no-unused-prop-types': 'error',
'react/self-closing-comp': 'error',
'unicorn/no-unused-properties': 'error', 'unicorn/no-unused-properties': 'error',
}, },
}, },

@ -30,7 +30,7 @@ export const ManagePermissionsDrawer = ({
const defaultTitle = t('alerting.manage-permissions.title', 'Manage permissions'); const defaultTitle = t('alerting.manage-permissions.title', 'Manage permissions');
return ( return (
<Drawer onClose={onClose} title={title || defaultTitle} subtitle={resourceName}> <Drawer onClose={onClose} title={title || defaultTitle} subtitle={resourceName}>
<Permissions {...permissionsProps} canSetPermissions></Permissions> <Permissions {...permissionsProps} canSetPermissions />
</Drawer> </Drawer>
); );
}; };

@ -324,7 +324,7 @@ export const TemplateForm = ({ originalTemplate, prefill, alertmanager }: Props)
{isGrafanaAlertManager && ( {isGrafanaAlertManager && (
<> <>
<div {...rowSplitter.secondaryProps}> <div {...rowSplitter.secondaryProps}>
<div {...rowSplitter.splitterProps}></div> <div {...rowSplitter.splitterProps} />
<TemplatePreview <TemplatePreview
payload={payload} payload={payload}
templateName={watch('title')} templateName={watch('title')}

@ -61,7 +61,7 @@ export const TemplatesTable = ({ alertManagerName, templates }: Props) => {
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th></th> <th />
<th>Template group</th> <th>Template group</th>
<Authorize <Authorize
actions={[ actions={[
@ -189,7 +189,7 @@ function TemplateRow({ notificationTemplate, idx, alertManagerName, onDeleteClic
</tr> </tr>
{isExpanded && ( {isExpanded && (
<tr className={idx % 2 === 0 ? tableStyles.evenRow : undefined}> <tr className={idx % 2 === 0 ? tableStyles.evenRow : undefined}>
<td></td> <td />
<td colSpan={2}> <td colSpan={2}>
<DetailsField label="" horizontal={true}> <DetailsField label="" horizontal={true}>
<TemplateEditor <TemplateEditor

@ -122,7 +122,7 @@ export const GenerateAlertDataModal = ({ isOpen, onDismiss, onAccept }: Props) =
</Stack> </Stack>
</Card> </Card>
</> </>
<div className={styles.onSubmitWrapper}></div> <div className={styles.onSubmitWrapper} />
{alerts.length > 0 && ( {alerts.length > 0 && (
<Stack direction="column" gap={1}> <Stack direction="column" gap={1}>
<h5> Review alert data to add to the payload:</h5> <h5> Review alert data to add to the payload:</h5>

@ -47,7 +47,7 @@ export const KeyValueMapInput = ({ value, onChange, readOnly = false }: Props) =
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Value</th> <th>Value</th>
{!readOnly && <th></th>} {!readOnly && <th />}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

@ -40,13 +40,13 @@ export function AlertManagerManualRouting({ alertManager }: AlertManagerManualRo
return ( return (
<Stack direction="column"> <Stack direction="column">
<Stack direction="row" alignItems="center"> <Stack direction="row" alignItems="center">
<div className={styles.firstAlertManagerLine}></div> <div className={styles.firstAlertManagerLine} />
<div className={styles.alertManagerName}> <div className={styles.alertManagerName}>
Alertmanager: Alertmanager:
<img src={alertManager.imgUrl} alt="Alert manager logo" className={styles.img} /> <img src={alertManager.imgUrl} alt="Alert manager logo" className={styles.img} />
{alertManagerName} {alertManagerName}
</div> </div>
<div className={styles.secondAlertManagerLine}></div> <div className={styles.secondAlertManagerLine} />
</Stack> </Stack>
<Stack direction="row" gap={1} alignItems="center"> <Stack direction="row" gap={1} alignItems="center">
<ContactPointSelector alertManager={alertManagerName} onSelectContactPoint={onSelectContactPoint} /> <ContactPointSelector alertManager={alertManagerName} onSelectContactPoint={onSelectContactPoint} />

@ -49,13 +49,13 @@ function NotificationPreviewByAlertManager({
<div className={styles.alertManagerRow}> <div className={styles.alertManagerRow}>
{!onlyOneAM && ( {!onlyOneAM && (
<Stack direction="row" alignItems="center"> <Stack direction="row" alignItems="center">
<div className={styles.firstAlertManagerLine}></div> <div className={styles.firstAlertManagerLine} />
<div className={styles.alertManagerName}> <div className={styles.alertManagerName}>
<Trans i18nKey="alerting.notification-preview.alertmanager">Alertmanager:</Trans> <Trans i18nKey="alerting.notification-preview.alertmanager">Alertmanager:</Trans>
<img src={alertManagerSource.imgUrl} alt="" className={styles.img} /> <img src={alertManagerSource.imgUrl} alt="" className={styles.img} />
{alertManagerSource.name} {alertManagerSource.name}
</div> </div>
<div className={styles.secondAlertManagerLine}></div> <div className={styles.secondAlertManagerLine} />
</Stack> </Stack>
)} )}
<Stack gap={1} direction="column"> <Stack gap={1} direction="column">

@ -84,7 +84,7 @@ const FilterOptions = () => {
<Label> <Label>
<Trans i18nKey="alerting.search.property.namespace">Folder / Namespace</Trans> <Trans i18nKey="alerting.search.property.namespace">Folder / Namespace</Trans>
</Label> </Label>
<Select options={[]} onChange={() => {}}></Select> <Select options={[]} onChange={() => {}} />
<Label> <Label>
<Trans i18nKey="alerting.search.property.rule-name">Alerting rule name</Trans> <Trans i18nKey="alerting.search.property.rule-name">Alerting rule name</Trans>
</Label> </Label>
@ -100,7 +100,7 @@ const FilterOptions = () => {
<Label> <Label>
<Trans i18nKey="alerting.search.property.data-source">Data source</Trans> <Trans i18nKey="alerting.search.property.data-source">Data source</Trans>
</Label> </Label>
<Select options={[]} onChange={() => {}}></Select> <Select options={[]} onChange={() => {}} />
<Label> <Label>
<Trans i18nKey="alerting.search.property.state">State</Trans> <Trans i18nKey="alerting.search.property.state">State</Trans>
</Label> </Label>

@ -28,11 +28,11 @@ const SilencedAlertsTable = ({ silencedAlerts }: Props) => {
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th></th> <th />
<th> <th>
<Trans i18nKey="silences-table.header.state">State</Trans> <Trans i18nKey="silences-table.header.state">State</Trans>
</th> </th>
<th></th> <th />
<th> <th>
<Trans i18nKey="silences-table.header.alert-name">Alert name</Trans> <Trans i18nKey="silences-table.header.alert-name">Alert name</Trans>
</th> </th>

@ -40,7 +40,7 @@ export const SilencedAlertsTableRow = ({ alert, className }: Props) => {
</tr> </tr>
{!isCollapsed && ( {!isCollapsed && (
<tr className={className}> <tr className={className}>
<td></td> <td />
<td colSpan={5}> <td colSpan={5}>
<AlertLabels labels={alert.labels} size="sm" /> <AlertLabels labels={alert.labels} size="sm" />
</td> </td>

@ -43,7 +43,7 @@ interface DataSourceLoaderProps {
} }
export function GrafanaDataSourceLoader() { export function GrafanaDataSourceLoader() {
return <DataSourceSection name="Grafana" application="grafana" uid="grafana" isLoading={true}></DataSourceSection>; return <DataSourceSection name="Grafana" application="grafana" uid="grafana" isLoading={true} />;
} }
export function DataSourceLoader({ uid, name }: DataSourceLoaderProps) { export function DataSourceLoader({ uid, name }: DataSourceLoaderProps) {

Loading…
Cancel
Save