From 7f4f917421b11f30965c626efad95112142973d9 Mon Sep 17 00:00:00 2001 From: lucapette Date: Fri, 18 Nov 2022 09:23:46 +0100 Subject: [PATCH] feat(ui): fix eslint warnings (#1254) Co-authored-by: Ludovic DEHON --- client/.prettierignore | 2 + client/package-lock.json | 32 +- client/package.json | 6 +- client/src/components/Base/Base.jsx | 12 +- .../src/components/DatePicker/DatePicker.jsx | 17 +- client/src/components/Form/Form.jsx | 16 +- client/src/components/Form/Input/Input.jsx | 13 +- .../components/Form/RadioGroup/RadioGroup.jsx | 15 +- client/src/components/Form/Select/Select.jsx | 13 +- .../Modal/ConfirmModal/ConfirmModal.jsx | 14 +- client/src/components/Modal/Modal.jsx | 14 +- client/src/components/PageSize/PageSize.jsx | 20 +- .../src/components/Pagination/Pagination.jsx | 15 +- client/src/components/SearchBar/SearchBar.jsx | 30 +- client/src/components/Table/Table.jsx | 218 ++- .../Acl/AclDetail/AclClusters/AclClusters.jsx | 2 +- .../containers/Acl/AclDetail/AclDetails.jsx | 12 +- .../Acl/AclDetail/AclGroups/AclGroups.jsx | 2 +- .../Acl/AclDetail/AclTopics/AclTopics.jsx | 2 +- .../AclTransactionalIds.jsx | 2 +- client/src/containers/Acl/AclList/Acls.jsx | 20 +- .../Connect/ConnectCreate/ConnectCreate.jsx | 4 +- .../Connect/ConnectDetail/Connect.jsx | 28 +- .../ConnectConfigs/ConnectConfigs.jsx | 24 +- .../ConnectTasks/ConnectTasks.jsx | 3 +- .../Connect/ConnectList/ConnectList.jsx | 81 +- .../ConsumerGroupDetail/ConsumerGroup.jsx | 88 +- .../ConsumerGroupAcls/ConsumerGroupAcls.jsx | 6 +- .../ConsumerGroupMembers.jsx | 8 +- .../ConsumerGroupOffsetDelete.jsx | 50 +- .../ConsumerGroupTopics.jsx | 10 +- .../ConsumerGroupList/ConsumerGroupList.jsx | 6 +- client/src/containers/Header/Header.jsx | 2 +- client/src/containers/Loading/Loading.jsx | 7 + client/src/containers/Login/Login.jsx | 27 +- .../src/containers/Node/NodeDetail/Node.jsx | 33 +- .../Node/NodeDetail/NodeLogs/NodeLogs.jsx | 2 +- .../containers/Node/NodeList/NodesList.jsx | 3 +- .../containers/Schema/SchemaDetail/Schema.jsx | 109 +- .../SchemaUpdate/SchemaUpdate.jsx | 115 +- .../SchemaVersions/SchemaVersions.jsx | 18 +- .../Schema/SchemaList/SchemaList.jsx | 56 +- client/src/containers/SideBar/Sidebar.jsx | 12 + client/src/containers/Tail/Tail.jsx | 44 +- client/src/containers/Topic/Topic/Topic.jsx | 134 +- .../Topic/Topic/TopicAcls/TopicAcls.jsx | 6 +- .../Topic/Topic/TopicData/TopicData.jsx | 1323 +++++++++-------- .../Topic/Topic/TopicGroups/TopicGroups.jsx | 4 +- .../Topic/Topic/TopicLogs/TopicLogs.jsx | 2 +- .../Topic/TopicPartitions/TopicPartitions.jsx | 2 +- .../containers/Topic/TopicCopy/TopicCopy.jsx | 8 +- .../containers/Topic/TopicList/TopicList.jsx | 483 +++--- .../Topic/TopicProduce/TopicProduce.jsx | 300 ++-- client/src/css/tables/table.scss | 2 +- 54 files changed, 1900 insertions(+), 1577 deletions(-) create mode 100644 client/.prettierignore diff --git a/client/.prettierignore b/client/.prettierignore new file mode 100644 index 000000000..e3fbd9833 --- /dev/null +++ b/client/.prettierignore @@ -0,0 +1,2 @@ +build +node_modules diff --git a/client/package-lock.json b/client/package-lock.json index 925a2cfd5..3058f96ab 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "akhq-front-end", - "version": "0.1.0", + "version": "0.23.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "akhq-front-end", - "version": "0.1.0", + "version": "0.23.0", "dependencies": { "@date-io/moment": "^2.8.0", "@material-ui/core": "^4.9.5", @@ -16,7 +16,7 @@ "ace-builds": "^1.4.8", "axios": "^0.21.1", "axios-progress-bar": "^1.2.0", - "bootstrap": "^4.5.0", + "bootstrap": "^4.6.1", "convert-units": "^2.3.4", "css-loader": "^3.4.1", "font-awesome": "^4.7.0", @@ -5846,13 +5846,19 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" }, "node_modules/bootstrap": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.0.tgz", - "integrity": "sha512-Io55IuQY3kydzHtbGvQya3H+KorS/M9rSNyfCGCg9WZ4pyT/lCxIlpJgG1GXW/PswzC84Tr2fBYi+7+jFVQQBw==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/bootstrap" - }, + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz", + "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/twbs" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + } + ], "peerDependencies": { "jquery": "1.9.1 - 3", "popper.js": "^1.16.1" @@ -27369,9 +27375,9 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" }, "bootstrap": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.0.tgz", - "integrity": "sha512-Io55IuQY3kydzHtbGvQya3H+KorS/M9rSNyfCGCg9WZ4pyT/lCxIlpJgG1GXW/PswzC84Tr2fBYi+7+jFVQQBw==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz", + "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==", "requires": {} }, "brace-expansion": { diff --git a/client/package.json b/client/package.json index 8c491f574..311135e69 100644 --- a/client/package.json +++ b/client/package.json @@ -12,7 +12,7 @@ "ace-builds": "^1.4.8", "axios": "^0.21.1", "axios-progress-bar": "^1.2.0", - "bootstrap": "^4.5.0", + "bootstrap": "^4.6.1", "convert-units": "^2.3.4", "css-loader": "^3.4.1", "font-awesome": "^4.7.0", @@ -35,11 +35,11 @@ }, "scripts": { "start": "react-scripts start", - "build": "set INLINE_RUNTIME_CHUNK=false&& CI=false DISABLE_ESLINT_PLUGIN=true react-scripts build", + "build": "set INLINE_RUNTIME_CHUNK=false&& react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "lint": "eslint src", - "lint:fix": "eslint --fix ." + "lint:fix": "eslint --fix src/**/*.js{,x}" }, "eslintConfig": { "extends": "react-app" diff --git a/client/src/components/Base/Base.jsx b/client/src/components/Base/Base.jsx index 40d488ba4..b03fae13b 100644 --- a/client/src/components/Base/Base.jsx +++ b/client/src/components/Base/Base.jsx @@ -1,10 +1,12 @@ import './Base.scss'; -import React, { Component } from 'react'; +import React, { Component } from 'react' +import PropTypes from 'prop-types'; import { withRouter } from 'react-router-dom'; import Sidebar from '../../containers/SideBar'; import constants from '../../utils/constants'; import Loading from '../../containers/Loading'; import { Helmet } from 'react-helmet'; + class Base extends Component { state = { clusterId: '', @@ -88,4 +90,12 @@ class Base extends Component { } } +Base.propTypes = { + history: PropTypes.object, + match: PropTypes.object, + location: PropTypes.object, + clusters: PropTypes.array, + children: PropTypes.any, +} + export default withRouter(Base); diff --git a/client/src/components/DatePicker/DatePicker.jsx b/client/src/components/DatePicker/DatePicker.jsx index 1587793b0..bb3f81af3 100644 --- a/client/src/components/DatePicker/DatePicker.jsx +++ b/client/src/components/DatePicker/DatePicker.jsx @@ -1,14 +1,10 @@ -import React from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import DateTimePicker from 'react-datepicker'; import moment from 'moment'; import { formatDateTime } from '../../utils/converters'; -class DatePicker extends React.Component { - static propTypes = { - value: PropTypes.string, - onChange: PropTypes.func - }; +class DatePicker extends Component { state = { value: '', @@ -95,4 +91,13 @@ class DatePicker extends React.Component { }; } +DatePicker.propTypes = { + value: PropTypes.string, + onChange: PropTypes.func, + showDateTimeInput: PropTypes.bool, + showTimeInput: PropTypes.bool, + showTimeSelect: PropTypes.bool, + onClear: PropTypes.func, +}; + export default DatePicker; diff --git a/client/src/components/Form/Form.jsx b/client/src/components/Form/Form.jsx index 24601e557..489a54f00 100644 --- a/client/src/components/Form/Form.jsx +++ b/client/src/components/Form/Form.jsx @@ -87,7 +87,6 @@ class Form extends Root { label, placeholder, type = 'text', - onChange = this.handleChange, noStyle, wrapperClass, inputClass, @@ -114,7 +113,7 @@ class Form extends Root { renderJSONInput = (name, label, onChange, textMode, options, rest) => { const { formData, errors } = this.state; - const inputMode = textMode ? "text" : (formData.schemaType === "PROTOBUF" ? "protobuf" : "json") + const inputMode = textMode ? 'text' : formData.schemaType === 'PROTOBUF' ? 'protobuf' : 'json'; return (
{label !== '' ? ( @@ -126,7 +125,7 @@ class Form extends Root { )}
{ + renderCheckbox = (name, isChecked, onChange, isDefaultChecked, rest) => { return ( - + /> ); }; } export default Form; - diff --git a/client/src/components/Form/Input/Input.jsx b/client/src/components/Form/Input/Input.jsx index 64bc2b079..7b7926516 100644 --- a/client/src/components/Form/Input/Input.jsx +++ b/client/src/components/Form/Input/Input.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; const Input = props => { const { name, label, placeholder, error, noStyle, wrapperClass, inputClass, ...rest } = props; @@ -16,7 +17,7 @@ const Input = props => { } return ( -
+
{label !== '' ? (