From fdce47ea86a17495b3c2dd1096bec9442df4464b Mon Sep 17 00:00:00 2001 From: Alexandre Trovato Date: Sun, 29 Nov 2020 21:26:37 +0100 Subject: [PATCH] Add prefer-template rule --- front/.eslintrc.json | 4 +++- .../boxs/device-in-room/RoomCard.jsx | 7 +++--- .../boxs/weather/EditWeatherBox.jsx | 2 +- .../components/boxs/weather/WeatherBox.jsx | 12 ++++++---- front/src/components/header/index.jsx | 23 ++++++++++++------- .../src/routes/dashboard/EditAddBoxButton.jsx | 2 +- .../gateway-confirm-email/ConfirmEmail.js | 2 +- .../ResetPasswordForm.js | 5 ++-- .../all/bluetooth/device-page/actions.js | 2 +- .../setup-page/BluetoothPeripheral.jsx | 2 +- .../philips-hue/device-page/FoundDevices.jsx | 2 +- .../all/philips-hue/device-page/actions.js | 2 +- .../all/philips-hue/setup-page/actions.js | 2 +- .../routes/integration/all/xiaomi/actions.js | 2 +- .../all/zwave/node-page/actions.js | 2 +- .../integration/all/zwave/setup-page/Node.jsx | 2 +- .../settings-gateway-open-api/OpenApi.js | 3 ++- .../settings-gateway-users/UserRow.js | 2 +- front/src/routes/signup-gateway/SignupForm.js | 7 +++--- .../signup-gateway/SignupGeneratingKeys.js | 7 +++--- .../routes/signup/1-welcome/WelcomeTab.jsx | 5 ++-- .../routes/signup/5-success/SuccessTab.jsx | 5 ++-- front/src/utils/bytesFormat.js | 2 +- server/.eslintrc.json | 4 +++- 24 files changed, 63 insertions(+), 45 deletions(-) diff --git a/front/.eslintrc.json b/front/.eslintrc.json index efe29bf76e..fd30876ae1 100644 --- a/front/.eslintrc.json +++ b/front/.eslintrc.json @@ -6,7 +6,9 @@ "preact-i18n/no-missing-template-field": "error", "preact-i18n/no-text-as-attribute": "error", "preact-i18n/no-text-as-children": "error", - "preact-i18n/no-unknown-key": "error" + "preact-i18n/no-unknown-key": "error", + "no-useless-concat": "error", + "prefer-template": "error" }, "plugins": ["json", "preact-i18n"], "parserOptions": { diff --git a/front/src/components/boxs/device-in-room/RoomCard.jsx b/front/src/components/boxs/device-in-room/RoomCard.jsx index 0db2cbec39..952a49e868 100644 --- a/front/src/components/boxs/device-in-room/RoomCard.jsx +++ b/front/src/components/boxs/device-in-room/RoomCard.jsx @@ -1,3 +1,5 @@ +import cx from 'classnames'; + import DeviceRow from './DeviceRow'; const RoomCard = ({ children, ...props }) => { @@ -6,10 +8,7 @@ const RoomCard = ({ children, ...props }) => { } return ( -
+

{props.room.name}

diff --git a/front/src/components/boxs/weather/EditWeatherBox.jsx b/front/src/components/boxs/weather/EditWeatherBox.jsx index f7c304cde2..840232a0d5 100644 --- a/front/src/components/boxs/weather/EditWeatherBox.jsx +++ b/front/src/components/boxs/weather/EditWeatherBox.jsx @@ -32,7 +32,7 @@ const EditWeatherBox = ({ children, ...props }) => (
{Object.keys(GetWeatherModes).map(key => { const mode = GetWeatherModes[key]; - const label = 'dashboard.boxes.weather.displayModes.' + mode; + const label = `dashboard.boxes.weather.displayModes.${mode}`; return (
( color: '#76838f' }} > - {props.datetimeBeautiful + ' - ' + props.houseName} + {`${props.datetimeBeautiful} - ${props.houseName}`}
@@ -134,7 +136,7 @@ const WeatherBox = ({ children, ...props }) => ( }} >

- {hour.datetime_beautiful + 'h'} + {`${hour.datetime_beautiful}h`}

- +

@@ -267,7 +269,7 @@ class WeatherBoxComponent extends Component {

{day.datetime_beautiful}
- +
{
-
+
@@ -53,7 +53,11 @@ const Header = ({ ...props }) => { -
+
@@ -86,7 +90,10 @@ const Header = ({ ...props }) => {
-
+
@@ -94,7 +101,7 @@ const Header = ({ ...props }) => {
diff --git a/front/src/routes/gateway-reset-password/ResetPasswordForm.js b/front/src/routes/gateway-reset-password/ResetPasswordForm.js index 541e42345c..7c6788601b 100644 --- a/front/src/routes/gateway-reset-password/ResetPasswordForm.js +++ b/front/src/routes/gateway-reset-password/ResetPasswordForm.js @@ -1,4 +1,5 @@ import { Text, Localizer } from 'preact-i18n'; +import cx from 'classnames'; const ResetPassworFrom = ({ children, ...props }) => (
@@ -28,7 +29,7 @@ const ResetPassworFrom = ({ children, ...props }) => ( } value={props.password} onInput={props.updatePassword} @@ -45,7 +46,7 @@ const ResetPassworFrom = ({ children, ...props }) => ( } value={props.passwordRepeat} onInput={props.updatePasswordRepeat} diff --git a/front/src/routes/integration/all/bluetooth/device-page/actions.js b/front/src/routes/integration/all/bluetooth/device-page/actions.js index 50da77827f..68648376b0 100644 --- a/front/src/routes/integration/all/bluetooth/device-page/actions.js +++ b/front/src/routes/integration/all/bluetooth/device-page/actions.js @@ -45,7 +45,7 @@ function createActions(store) { store.setState(newState); }, async deleteDevice(state, device, index) { - await state.httpClient.delete('/api/v1/device/' + device.selector); + await state.httpClient.delete(`/api/v1/device/${device.selector}`); const newState = update(state, { bluetoothDevices: { $splice: [[index, 1]] diff --git a/front/src/routes/integration/all/bluetooth/setup-page/BluetoothPeripheral.jsx b/front/src/routes/integration/all/bluetooth/setup-page/BluetoothPeripheral.jsx index 7ec2849ab4..88caaa727f 100644 --- a/front/src/routes/integration/all/bluetooth/setup-page/BluetoothPeripheral.jsx +++ b/front/src/routes/integration/all/bluetooth/setup-page/BluetoothPeripheral.jsx @@ -52,7 +52,7 @@ class BluetoothPeripheral extends Component { />
{bluetoothDevice && ( - + {!peripheralService && (