aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-30 10:55:59 -0600
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2023-07-30 23:57:51 +0000
commit080d8b05297f3f5afcf33354a40a5201697b1df5 (patch)
tree35180bd3cb9fcd137feca3fe169032cbbb469463 /src/components/ui
parentrefactor: various improvements (#1296) (diff)
downloadferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.gz
ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.zst
ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.zip
refactor: more lint improvements
- set parserOptions.ecmaVersion to latest and env to es2024 in eslint config - install missing types libraries - install eslint-plugin-sonar - enable eslint-plugin-sonar recommended rules and declare jsx-runtime for react in eslint config - clean up disabled lint rules which don't inflict problems anymore - disable various lint issues and fix others
Diffstat (limited to 'src/components/ui')
-rw-r--r--src/components/ui/Tabs/TabItem.tsx4
-rw-r--r--src/components/ui/button/index.tsx1
-rw-r--r--src/components/ui/select/index.tsx38
3 files changed, 22 insertions, 21 deletions
diff --git a/src/components/ui/Tabs/TabItem.tsx b/src/components/ui/Tabs/TabItem.tsx
index 815dced8c..55dee42c6 100644
--- a/src/components/ui/Tabs/TabItem.tsx
+++ b/src/components/ui/Tabs/TabItem.tsx
@@ -12,8 +12,8 @@ export interface IProps {
12 title?: string; // it is used on Tabs.tsx 12 title?: string; // it is used on Tabs.tsx
13} 13}
14 14
15function TabItem({ children, title = '' }: IProps): ReactElement { 15const TabItem = ({ children, title = '' }: IProps): ReactElement => {
16 return <Fragment key={title}>{children}</Fragment>; 16 return <Fragment key={title}>{children}</Fragment>;
17} 17};
18 18
19export default TabItem; 19export default TabItem;
diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx
index 3c31ca952..c37a88afa 100644
--- a/src/components/ui/button/index.tsx
+++ b/src/components/ui/button/index.tsx
@@ -237,6 +237,7 @@ class ButtonComponent extends Component<IProps, IState> {
237 ) : ( 237 ) : (
238 <button 238 <button
239 id={id} 239 id={id}
240 // eslint-disable-next-line react/button-has-type
240 type={type} 241 type={type}
241 onClick={onClick} 242 onClick={onClick}
242 className={classnames({ 243 className={classnames({
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx
index 902eb7748..650600fb3 100644
--- a/src/components/ui/select/index.tsx
+++ b/src/components/ui/select/index.tsx
@@ -191,12 +191,23 @@ class SelectComponent extends Component<IProps, IState> {
191 this.arrowKeysHandler = this.arrowKeysHandler.bind(this); 191 this.arrowKeysHandler = this.arrowKeysHandler.bind(this);
192 } 192 }
193 193
194 componentDidUpdate(): void { 194 UNSAFE_componentWillMount(): void {
195 const { open } = this.state; 195 const { value } = this.props;
196 196
197 if (this.searchInputRef?.current && open) { 197 if (this.componentRef?.current) {
198 this.searchInputRef.current.focus(); 198 this.componentRef.current.removeEventListener(
199 'keydown',
200 this.keyListener,
201 );
199 } 202 }
203
204 if (value) {
205 this.setState({
206 value,
207 });
208 }
209
210 this.setFilter();
200 } 211 }
201 212
202 componentDidMount(): void { 213 componentDidMount(): void {
@@ -212,23 +223,12 @@ class SelectComponent extends Component<IProps, IState> {
212 window.addEventListener('keydown', this.arrowKeysHandler, false); 223 window.addEventListener('keydown', this.arrowKeysHandler, false);
213 } 224 }
214 225
215 UNSAFE_componentWillMount(): void { 226 componentDidUpdate(): void {
216 const { value } = this.props; 227 const { open } = this.state;
217
218 if (this.componentRef?.current) {
219 this.componentRef.current.removeEventListener(
220 'keydown',
221 this.keyListener,
222 );
223 }
224 228
225 if (value) { 229 if (this.searchInputRef?.current && open) {
226 this.setState({ 230 this.searchInputRef.current.focus();
227 value,
228 });
229 } 231 }
230
231 this.setFilter();
232 } 232 }
233 233
234 componentWillUnmount(): void { 234 componentWillUnmount(): void {