From 73518bf1e74d1017e2fd8bc8e478d1253ed751aa Mon Sep 17 00:00:00 2001
From: Chi-Hsuan Huang
Date: Wed, 2 Dec 2020 17:03:37 +0800
Subject: [PATCH] Chore: Enable remaining eslint-plugin-react rules (#29519)
* Chore: Enable eslint react/no-render-return-value rule
Eanble the rule and remove the unused render return
part of: #29201
* Chore: Enable eslint react/no-children-prop rule
Not linting issues after turning on this. No other file changes requried
part of: #29201
* Chore: Enable eslint react/no-unknown-property rule
Correct enable-background to enableBackground
part of: #29201
* Chore: Enable eslint react/no-unescaped-entities rule
Replaced " with " replaced ' with '
part of: #29201
---
.eslintrc | 4 ----
packages/grafana-ui/src/components/Icon/assets/Import.tsx | 2 +-
.../TimePicker/TimeRangePicker/TimePickerContent.tsx | 4 ++--
public/app/core/components/PluginHelp/PluginHelp.tsx | 2 +-
public/app/core/services/util_srv.ts | 2 +-
public/app/features/admin/AdminOrgsTable.tsx | 2 +-
public/app/features/api-keys/ApiKeysAddedModal.tsx | 2 +-
.../SaveDashboard/forms/SaveProvisionedDashboardForm.tsx | 4 ++--
.../dashboard/components/ShareModal/ShareSnapshot.tsx | 2 +-
.../TransformationsEditor/TransformationsEditor.tsx | 4 ++--
public/app/features/variables/pickers/PickerRenderer.tsx | 2 +-
.../datasource/influxdb/components/ConfigEditor.tsx | 3 ++-
.../components/__snapshots__/ConfigEditor.test.tsx.snap | 8 ++++----
.../datasource/prometheus/components/PromQueryEditor.tsx | 2 +-
public/app/plugins/datasource/testdata/QueryEditor.tsx | 2 +-
15 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index c88e985c2d3..5d7f9ea5c0d 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -15,10 +15,6 @@
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off",
"react/prop-types": "off",
- "react/no-unescaped-entities": "off",
- "react/no-unknown-property": "off",
- "react/no-children-prop": "off",
- "react/no-render-return-value": "off",
"no-only-tests/no-only-tests": "error"
}
}
diff --git a/packages/grafana-ui/src/components/Icon/assets/Import.tsx b/packages/grafana-ui/src/components/Icon/assets/Import.tsx
index 4659a307c0a..2eb978da784 100644
--- a/packages/grafana-ui/src/components/Icon/assets/Import.tsx
+++ b/packages/grafana-ui/src/components/Icon/assets/Import.tsx
@@ -11,7 +11,7 @@ export const Import: FunctionComponent = ({ size, ...rest }) => {
height={size}
{...rest}
>
-
+
{
- It looks like you haven't used this timer picker before. As soon as you enter some time intervals, recently
- used intervals will appear here.
+ It looks like you haven't used this timer picker before. As soon as you enter some time intervals,
+ recently used intervals will appear here.
diff --git a/public/app/core/components/PluginHelp/PluginHelp.tsx b/public/app/core/components/PluginHelp/PluginHelp.tsx
index 67364ea9366..cf55ac09ee3 100644
--- a/public/app/core/components/PluginHelp/PluginHelp.tsx
+++ b/public/app/core/components/PluginHelp/PluginHelp.tsx
@@ -71,7 +71,7 @@ export class PluginHelp extends PureComponent
{
}
if (isError) {
- return 'Error occurred when loading help' ;
+ return 'Error occurred when loading help' ;
}
if (type === 'panel_help' && help === '') {
diff --git a/public/app/core/services/util_srv.ts b/public/app/core/services/util_srv.ts
index 345410bed97..71e8c46e224 100644
--- a/public/app/core/services/util_srv.ts
+++ b/public/app/core/services/util_srv.ts
@@ -39,7 +39,7 @@ export class UtilSrv {
const elem = React.createElement(provideTheme(AngularModalProxy), modalProps);
this.reactModalRoot.appendChild(this.reactModalNode);
- return ReactDOM.render(elem, this.reactModalNode);
+ ReactDOM.render(elem, this.reactModalNode);
}
onReactModalDismiss = () => {
diff --git a/public/app/features/admin/AdminOrgsTable.tsx b/public/app/features/admin/AdminOrgsTable.tsx
index e581478a5db..77e8d3fe986 100644
--- a/public/app/features/admin/AdminOrgsTable.tsx
+++ b/public/app/features/admin/AdminOrgsTable.tsx
@@ -40,7 +40,7 @@ export const AdminOrgsTable: FC = ({ orgs, onDelete }) => {
title="Delete"
body={
- Are you sure you want to delete '{deleteOrg.name}'?
+ Are you sure you want to delete '{deleteOrg.name}'?
All dashboards for this organization will be removed!
}
diff --git a/public/app/features/api-keys/ApiKeysAddedModal.tsx b/public/app/features/api-keys/ApiKeysAddedModal.tsx
index 3503555dc6a..0cb207311cb 100644
--- a/public/app/features/api-keys/ApiKeysAddedModal.tsx
+++ b/public/app/features/api-keys/ApiKeysAddedModal.tsx
@@ -36,7 +36,7 @@ export const ApiKeysAddedModal = (props: Props) => {
- curl -H "Authorization: Bearer {props.apiKey}" {props.rootPath}/api/dashboards/home
+ curl -H "Authorization: Bearer {props.apiKey}" {props.rootPath}/api/dashboards/home
diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveProvisionedDashboardForm.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveProvisionedDashboardForm.tsx
index 24089f3fd9a..d9eee7a6280 100644
--- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveProvisionedDashboardForm.tsx
+++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveProvisionedDashboardForm.tsx
@@ -31,8 +31,8 @@ export const SaveProvisionedDashboardForm: React.FC = ({
<>
- This dashboard cannot be saved from Grafana's UI since it has been provisioned from another source. Copy the
- JSON or save it to a file below. Then you can update your dashboard in corresponding provisioning source.
+ This dashboard cannot be saved from Grafana's UI since it has been provisioned from another source. Copy
+ the JSON or save it to a file below. Then you can update your dashboard in corresponding provisioning source.
See{' '}
diff --git a/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx b/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx
index b2203fa012e..344a7ac5de5 100644
--- a/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx
+++ b/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx
@@ -239,7 +239,7 @@ export class ShareSnapshot extends PureComponent {
- You may need to configure the timeout value if it takes a long time to collect your dashboard's metrics.
+ You may need to configure the timeout value if it takes a long time to collect your dashboard's metrics.
diff --git a/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx b/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx
index a50aa36e8c4..42fecaee995 100644
--- a/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx
+++ b/public/app/features/dashboard/components/TransformationsEditor/TransformationsEditor.tsx
@@ -215,8 +215,8 @@ export class TransformationsEditor extends React.PureComponent
Transformations allow you to join, calculate, re-order, hide and rename your query results before being
visualized.
- Many transforms are not suitable if you're using the Graph visualization as it currently only supports
- time series.
+ Many transforms are not suitable if you're using the Graph visualization as it currently only
+ supports time series.
It can help to switch to Table visualization to understand what a transformation is doing.
diff --git a/public/app/features/variables/pickers/PickerRenderer.tsx b/public/app/features/variables/pickers/PickerRenderer.tsx
index ed5f42ce946..75eca6396d9 100644
--- a/public/app/features/variables/pickers/PickerRenderer.tsx
+++ b/public/app/features/variables/pickers/PickerRenderer.tsx
@@ -12,7 +12,7 @@ export const PickerRenderer: FunctionComponent = props => {
const PickerToRender = useMemo(() => variableAdapters.get(props.variable.type).picker, [props.variable]);
if (!props.variable) {
- return Couldn't load variable
;
+ return Couldn't load variable
;
}
return (
diff --git a/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx b/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx
index 55dd957a153..c050b2ff8a5 100644
--- a/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx
+++ b/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx
@@ -256,7 +256,8 @@ export class ConfigEditor extends PureComponent {
Setting the database for this datasource does not deny access to other databases. The InfluxDB query
syntax allows switching the database in the query. For example:
- SHOW MEASUREMENTS ON _internal or SELECT * FROM "_internal".."database" LIMIT 10
+ SHOW MEASUREMENTS ON _internal or
+ SELECT * FROM "_internal".."database" LIMIT 10
To support data isolation and security, make sure appropriate permissions are configured in InfluxDB.
diff --git a/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap b/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap
index 4d560e5aa12..fd4dce305c6 100644
--- a/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap
+++ b/public/app/plugins/datasource/influxdb/components/__snapshots__/ConfigEditor.test.tsx.snap
@@ -245,7 +245,7 @@ exports[`Render should disable basic auth password input 1`] = `
SHOW MEASUREMENTS ON _internal
- or
+ or
SELECT * FROM "_internal".."database" LIMIT 10
@@ -533,7 +533,7 @@ exports[`Render should hide basic auth fields when switch off 1`] = `
SHOW MEASUREMENTS ON _internal
- or
+ or
SELECT * FROM "_internal".."database" LIMIT 10
@@ -821,7 +821,7 @@ exports[`Render should hide white listed cookies input when browser access chose
SHOW MEASUREMENTS ON _internal
- or
+ or
SELECT * FROM "_internal".."database" LIMIT 10
@@ -1109,7 +1109,7 @@ exports[`Render should render component 1`] = `
SHOW MEASUREMENTS ON _internal
- or
+ or
SELECT * FROM "_internal".."database" LIMIT 10
diff --git a/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx b/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx
index fbbb59018fb..fb6ba792d82 100644
--- a/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx
+++ b/public/app/plugins/datasource/prometheus/components/PromQueryEditor.tsx
@@ -137,7 +137,7 @@ export class PromQueryEditor extends PureComponent {
<>
An additional lower limit for the step parameter of the Prometheus query and for the{' '}
$__interval and $__rate_interval variables. The limit is absolute and not
- modified by the "Resolution" setting.
+ modified by the "Resolution" setting.
>
}
>
diff --git a/public/app/plugins/datasource/testdata/QueryEditor.tsx b/public/app/plugins/datasource/testdata/QueryEditor.tsx
index e589cdcc812..f3fd3f889ec 100644
--- a/public/app/plugins/datasource/testdata/QueryEditor.tsx
+++ b/public/app/plugins/datasource/testdata/QueryEditor.tsx
@@ -168,7 +168,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
{`{ key = "value", key2 = "value" }`}
- key="value", key2="value"
+ key="value", key2="value"
key=value, key2=value