Skip to content

Commit bcbe732

Browse files
Athira SreekumarAthira Sreekumar
authored andcommitted
fix: lint errors
fixes lint errors Contributes to: #368 Signed-off-by: Athira Sreekumar <[email protected]>
1 parent b83624e commit bcbe732

File tree

20 files changed

+106
-141
lines changed

20 files changed

+106
-141
lines changed

ui/e2e/testEnvironment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
const { mkdir } = require('fs').promises;
6-
const PlaywrightEnvironment = require('jest-playwright-preset/lib/PlaywrightEnvironment')
7-
.default;
6+
const PlaywrightEnvironment =
7+
require('jest-playwright-preset/lib/PlaywrightEnvironment').default;
88
const { saveVideo } = require('playwright-video');
99

1010
class CustomEnvironment extends PlaywrightEnvironment {

ui/src/Bootstrap/App/App.view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { NO_OP } from 'Utils';
1111
import { Grid, Column, Row } from 'carbon-components-react';
1212
import translations from './i18n.json';
1313
import { PropTypes } from 'prop-types';
14-
import clsx from 'clsx';
14+
import cx from 'clsx';
1515

1616
import es_logo from 'Images/es_logo.svg';
1717

@@ -24,7 +24,7 @@ const App = (props) => {
2424
};
2525

2626
return (
27-
<main className={clsx('App', className)}>
27+
<main className={cx('App', className)}>
2828
<Grid>
2929
<ConfigContextConsumer>
3030
{({ topic, producerPath, consumerPath }) => (

ui/src/DevUtils/MockVertx/MockVertxServer.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ const ERROR_CHANCE = -1; // -1 = no errors, 0 -> 100 % chance of an error occuri
2626
// Private helper functions
2727

2828
// maps an object of event/handler pairs (config) to the websocket server
29-
const handleWebsocketEvents = (config = {}) => (ws, { url }) => {
30-
Object.entries(config).forEach(([event, handler]) => {
31-
ws.on(event, (...args) =>
32-
handler({
33-
calledWith: args,
34-
url,
35-
ws,
36-
})
37-
);
38-
});
39-
};
29+
const handleWebsocketEvents =
30+
(config = {}) =>
31+
(ws, { url }) => {
32+
Object.entries(config).forEach(([event, handler]) => {
33+
ws.on(event, (...args) =>
34+
handler({
35+
calledWith: args,
36+
url,
37+
ws,
38+
})
39+
);
40+
});
41+
};
4042

4143
// generator for a simple logger
4244
const generateLogger = (enabled = false) =>
@@ -181,10 +183,9 @@ const generateHandlers = (
181183
{ produceEndpoint, consumeEndpoint, ...modelConfigs },
182184
otherEventHandlers = {}
183185
) => {
184-
const {
185-
handleProduceMessage,
186-
handleConsumeMessage,
187-
} = generateModelForConfig({ ...modelConfigs });
186+
const { handleProduceMessage, handleConsumeMessage } = generateModelForConfig(
187+
{ ...modelConfigs }
188+
);
188189
return handleWebsocketEvents({
189190
...otherEventHandlers,
190191
message: ({ calledWith, url, ws }) => {

ui/src/DevUtils/MockWebsocket/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ const consumerMetadata = {
2727
consumerStarted: true,
2828
};
2929

30-
// eslint-disable-next-line no-console
31-
const sendMessage = (sendFn = () => console.error('No message function!')) => (
32-
content
33-
) => sendFn({ data: JSON.stringify(content) });
30+
const sendMessage =
31+
(
32+
sendFn = () => console.error('No message function!') // eslint-disable-line no-console
33+
) =>
34+
(content) =>
35+
sendFn({ data: JSON.stringify(content) });
3436

3537
export const storybookWebsocket = (
3638
responseType = CONSTANTS.PRODUCER,

ui/src/Elements/Message/Message.view.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from 'carbon-components-react';
1818
import { CheckmarkFilled16, ErrorFilled16 } from '@carbon/icons-react';
1919
import { isEmpty, isFunction } from 'lodash-es';
20-
import clsx from 'clsx';
20+
import cx from 'clsx';
2121

2222
import { Label } from 'Elements';
2323
import { useTranslate } from 'ReactCustomHooks';
@@ -36,7 +36,7 @@ const Message = (props) => {
3636
...others
3737
} = props;
3838

39-
const classesToApply = clsx('Message', `Message--${usage}`, {
39+
const classesToApply = cx('Message', `Message--${usage}`, {
4040
[`Message--${usage}-first`]: isFirst,
4141
[`Message--${usage}-selected`]: isSelected,
4242
[`Message--${usage}-error`]: error,
@@ -98,7 +98,7 @@ const renderConsumerMessageTile = (
9898
<ExpandableTile
9999
expanded={isFirst}
100100
{...getInteractionHandler(onInteraction, CONSUMER, message)}
101-
className={clsx('Message__tile--consumer', {
101+
className={cx('Message__tile--consumer', {
102102
[`Message__tile--consumer--selected`]: isSelected,
103103
})}
104104
{...idAttributeGenerator('consumed_message_tile')}
@@ -154,18 +154,13 @@ const renderProducerMessageTile = (
154154
return (
155155
<ClickableTile
156156
{...getInteractionHandler(onInteraction, PRODUCER, message)}
157-
className={clsx(
158-
'Message',
159-
'Message__producer',
160-
'Message__tile--producer',
161-
{
162-
[`Message__tile--producer--selected`]: isSelected,
163-
}
164-
)}
157+
className={cx('Message', 'Message__producer', 'Message__tile--producer', {
158+
[`Message__tile--producer--selected`]: isSelected,
159+
})}
165160
{...idAttributeGenerator('produced_message_tile')}
166161
>
167162
<CheckmarkFilled16
168-
className={clsx('Message__icon', 'Message__icon--checkmark')}
163+
className={cx('Message__icon', 'Message__icon--checkmark')}
169164
/>
170165
{renderValueWithLabel(translate('PARTITION'), partition, 'partition')}
171166
{renderValueWithLabel(translate('OFFSET'), offset, 'offset')}
@@ -177,9 +172,7 @@ const renderErrorTile = (error) => {
177172
const { message } = error;
178173
return (
179174
<Tile className={'Message__tile--error'}>
180-
<ErrorFilled16
181-
className={clsx('Message__icon', 'Message__icon--error')}
182-
/>
175+
<ErrorFilled16 className={cx('Message__icon', 'Message__icon--error')} />
183176
<div>
184177
<Label className={'Message__error-message'}>{message}</Label>
185178
</div>
@@ -189,7 +182,7 @@ const renderErrorTile = (error) => {
189182

190183
const renderValueWithLabel = (label, value, idAttribute, additionalClasses) => {
191184
return (
192-
<div className={clsx('Message__labelled-value', additionalClasses)}>
185+
<div className={cx('Message__labelled-value', additionalClasses)}>
193186
<div>
194187
<Label className={'Message__label'}>{label}</Label>
195188
</div>

ui/src/Elements/Text/Text.spec.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ describe('Text Element component', () => {
2929
const text = 'test text here';
3030
const testClassName = 'testCssClass';
3131

32-
const confirmHasTextAndClassName = (contentExpected, classNameExpected) => (
33-
content,
34-
node
35-
) =>
36-
content === contentExpected && // has the expected content
37-
node.classList.contains('Text') && // has correct Block class
38-
node.classList.contains(classNameExpected); // has the expected classname
32+
const confirmHasTextAndClassName =
33+
(contentExpected, classNameExpected) => (content, node) =>
34+
content === contentExpected && // has the expected content
35+
node.classList.contains('Text') && // has correct Block class
36+
node.classList.contains(classNameExpected); // has the expected classname
3937

4038
it('renders the expected default type if none provided', () => {
4139
const { getByText } = render(<Text>{text}</Text>);

ui/src/Elements/Text/Text.view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* eslint-disable react/no-multi-comp */ // disabled as we have a hoc funtion in file
66
import React from 'react';
77
import PropTypes from 'prop-types';
8-
import clsx from 'clsx';
8+
import cx from 'clsx';
99

1010
import { HEADING, SUBHEADING, BODY, CODE, LABEL } from './Text.assets.js';
1111

@@ -33,7 +33,7 @@ const Text = (props) => {
3333
break;
3434
}
3535

36-
const classesToApply = clsx('Text', `Text--${typeModifier}`, {
36+
const classesToApply = cx('Text', `Text--${typeModifier}`, {
3737
[className]: className,
3838
});
3939

ui/src/Groups/Counter/Counter.view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
*/
55
import React from 'react';
66
import PropTypes from 'prop-types';
7-
import clsx from 'clsx';
7+
import cx from 'clsx';
88

99
import { Body, Subheading } from 'Elements';
1010

1111
const Counter = (props) => {
1212
const { title, subtitle, count, countLimit, className, ...others } = props;
13-
const classesToApply = clsx('Counter', { [className]: className });
13+
const classesToApply = cx('Counter', { [className]: className });
1414

1515
let countValue = count;
1616
if (count < 0) {

ui/src/Groups/Messages/Messages.view.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* eslint-disable react/no-multi-comp */ // disabled as we have a hoc funtion in file
66
import React from 'react';
77
import PropTypes from 'prop-types';
8-
import clsx from 'clsx';
8+
import cx from 'clsx';
99
import { idAttributeGenerator } from 'Utils';
1010

1111
import { useTranslate } from 'ReactCustomHooks';
@@ -16,7 +16,7 @@ const Messages = (props) => {
1616
const { usage, className, children, ...others } = props;
1717
// check if we have any child elements. If not, empty state
1818
const hasChildren = React.Children.count(children) > 0;
19-
const classesToApply = clsx('Messages', `Messages--${usage}`, {
19+
const classesToApply = cx('Messages', `Messages--${usage}`, {
2020
[className]: className,
2121
[`Messages--${usage}-empty`]: !hasChildren,
2222
});
@@ -36,7 +36,7 @@ const Messages = (props) => {
3636
) : (
3737
<div
3838
{...idAttributeGenerator('messages_empty')}
39-
className={clsx('Messages__empty', `Messages__empty--${usage}`)}
39+
className={cx('Messages__empty', `Messages__empty--${usage}`)}
4040
>
4141
<div className={'Messages__empty-title-container'}>
4242
<Subheading className={'Messages__empty-title'}>

ui/src/Groups/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
* (C) Copyright IBM Corp. 2020 All Rights Reserved.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5-
export * from './Counter';
6-
export * from './Messages';
5+
export * from './Counter'; // eslint-disable-line import/extensions
6+
export * from './Messages'; // eslint-disable-line import/extensions

0 commit comments

Comments
 (0)