Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(FDS-149): Resolve eslint no- prefixed errors and multiline-comment-style #170

Merged
merged 5 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ module.exports = {
'eslint-comments/no-unused-disable': 0,
'eslint-comments/require-description': 0,
'jest/no-done-callback': 0,
'multiline-comment-style': 0,
'no-alert': 0,
'no-extra-boolean-cast': 0,
'no-prototype-builtins': 0,
'no-useless-return': 0,
'react/forbid-prop-types': 0,
'react/jsx-key': 0,
'react/jsx-no-bind': 0,
Expand Down
18 changes: 9 additions & 9 deletions docs/src/components/PropTable/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ const PropTable = ({ docData, ...rest }) => {
{JSON.stringify(propData?.type?.value, null, ' ')}
</pre>
) : (
/* propData.type.value.map((value, i) => {
const item = value.name ? (
<span key={i}>{value.name}</span>
) : (
<code key={i}>{value.value}</code>
);
return item;
}) */
// propData.type.value.map((value, i) => {
// const item = value.name ? (
// <span key={i}>{value.name}</span>
// ) : (
// <code key={i}>{value.value}</code>
// );
//
// return item;
// })
<pre>
{JSON.stringify(propData?.type?.value, null, ' ')}
</pre>
Expand Down
18 changes: 9 additions & 9 deletions packages/cascara/src/modules/ActionButton/ActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ const ActionButton = ({
const { isEditing, onAction, record } = useContext(ModuleContext);
const { content = label, ...restWithoutLabel } = rest;

/**
initially, this was called actionName, but now we ...spread
all props into the button. So the correct way of calling it
is just 'name'.
This is a breaking change. in order to prevent any breakage
in the our Apps, we are temporarily deriving it from one if
the other is not passed. Once we have the resources to go
and update our Apps we will revisit. */
//
// initially, this was called actionName, but now we ...spread
// all props into the button. So the correct way of calling it
// is just 'name'.
//
// This is a breaking change. in order to prevent any breakage
// in the our Apps, we are temporarily deriving it from one if
// the other is not passed. Once we have the resources to go
// and update our Apps we will revisit.
const name = actionName || rest.name;

// FDS-137: use action name for button name if no content is specified
Expand Down
12 changes: 5 additions & 7 deletions packages/cascara/src/modules/ActionEdit/ActionEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ const ActionEdit = ({ dataTestIDs, editLabel = 'Edit' }) => {
const recordId = record[uniqueIdAttribute];
const whenAnotherRowIsEditing = Boolean(idOfRecordInEditMode);

/**
* this seems like ugly, we need to find a better way
* to ease testing.. */
// this seems like ugly, we need to find a better way
// to ease testing..
const cancelTestId = {};
const editTestId = {};
const saveTestId = {};
Expand All @@ -61,15 +60,14 @@ const ActionEdit = ({ dataTestIDs, editLabel = 'Edit' }) => {

const handleCancel = () => {
isDirty
? // eslint-disable-next-line no-restricted-globals
? // eslint-disable-next-line no-restricted-globals, no-alert -- For now we do not have our own confirmation dialog so we are using native confirms
confirm('Abandon unsaved changes?') && handleReset()
: handleReset();
};

const handleEdit = () => {
/**
* FDS-91: We are resetting the form with whatever is in record.
* We don't know if this is the best way to do it in React. */
// FDS-91: We are resetting the form with whatever is in record.
// We don't know if this is the best way to do it in React.
reset({ ...record });
onAction(
// fake target
Expand Down
5 changes: 4 additions & 1 deletion packages/cascara/src/shared/recordUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const getAttributeValueFromRecord = (attribute, record = {}) => {
const attributeExists = record.hasOwnProperty(attribute);
const attributeExists = Object.prototype.hasOwnProperty.call(
record,
attribute
);

if (attributeExists) {
return record[attribute];
Expand Down
2 changes: 1 addition & 1 deletion packages/cascara/src/ui/Chat/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Chat = ({ sessionUserID, messages, users }) => {
const isTranslated = Boolean(msg.isTranslated); // This can probably get cleaned up later.

// Only return if we have a defined component for this type
return Boolean(getMessageObject)
return getMessageObject
? getMessageObject({
attached: getMessageGroup(msg, previousMessage, nextMessage),
handleScrollToBottom,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const platforms = {
cordova: Boolean(window.hasOwnProperty('cordova')),
cordova: Boolean(Object.prototype.hasOwnProperty.call(window, 'cordova')),
electron: Boolean(process.versions['electron']),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const WidgetStatsStat = ({ onClick, label, value, sub }) => {
return (
<Clickable
as='div'
className={Boolean(onClick) ? styles.ClickableStat : styles.Stat}
disabled={!Boolean(onClick)}
className={onClick ? styles.ClickableStat : styles.Stat}
disabled={!onClick}
focusable={Boolean(onClick)}
key={label}
onClick={onClick}
Expand Down
38 changes: 19 additions & 19 deletions packages/cascara/src/ui/Pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ const Pagination = ({
currentPage = 1,
...rest
}) => {
/**
* Handles pagination changes
*
* This function updates the pagination values
* and invokes upstream logic to handle the change.
*
* @param {Event} _ Usually the click event
* @param {Object} component Component object passed by SUIR
* @param {String} component.name The name of the component
* @param {Any} component.value The new value in the component */
//
// Handles pagination changes
//
// This function updates the pagination values
// and invokes upstream logic to handle the change.
//
// @param {Event} _ Usually the click event
// @param {Object} component Component object passed by SUIR
// @param {String} component.name The name of the component
// @param {Any} component.value The new value in the component
const handlePaginationChange = (_, component) => {
let newPage = currentPage;
let newitemsPerPageLimit = itemsPerPageLimit;
Expand All @@ -73,15 +73,15 @@ const Pagination = ({
});
};

/**
* Handles button's click event
*
* This handler decides wether to increase or decrease page
* based on button name. It acts as a proxy for `handlePaginationChange`
*
* @param {Event} _ Usually the click event
* @param {Object} component Component object passed by SUIR
* @param {String} component.name The name of the component */
//
// Handles button's click event
//
// This handler decides wether to increase or decrease page
// based on button name. It acts as a proxy for `handlePaginationChange`
//
// @param {Event} _ Usually the click event
// @param {Object} component Component object passed by SUIR
// @param {String} component.name The name of the component
const handleButtonClick = (_, button) => {
let newPage = currentPage;

Expand Down
10 changes: 5 additions & 5 deletions packages/cascara/src/ui/Table/ActionBar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const ACTION_MODULES = {
};

describe('ActionBar', () => {
/**
* */
//
//
describe('component tree', () => {
const actions = [
{
Expand All @@ -33,9 +33,9 @@ describe('ActionBar', () => {
const { module, ...rest } = action;
const Action = ACTION_MODULES[module];

/**
* In certain predefined-action modules in which a label is not required, e.g. `edit`,
* the following unique key generation fails, as it relies on the label (content). */
//
// In certain predefined-action modules in which a label is not required, e.g. `edit`,
// the following unique key generation fails, as it relies on the label (content).
const key = `${module}.${rest.label || module}`;

return <Action key={key} {...rest} />;
Expand Down
30 changes: 15 additions & 15 deletions packages/cascara/src/ui/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ const propTypes = {
})
),

/** Resolve record actions.
* A function that returns the actions available to the current row */
// Resolve record actions.
// A function that returns the actions available to the current row
resolveRecordActions: pt.func,
}),

/** An array of objects.
*
* Every object in this array will potencially be rendered as a table row. */
// An array of objects.
//
// Every object in this array will potencially be rendered as a table row.
data: pt.arrayOf(pt.shape({})),

/** The main configuration for your table. Here you can specify the columns to display
* as well as the available actions (if any) for each row. */
// The main configuration for your table. Here you can specify the columns to display
// as well as the available actions (if any) for each row.
dataConfig: pt.shape({
actionButtonMenuIndex: pt.number,

Expand All @@ -54,18 +54,18 @@ const propTypes = {
),
}),

/** Event handler.
*
* An event handler you can pass to handle every event your table emits.*/
// Event handler.
//
// An event handler you can pass to handle every event your table emits.
onAction: pt.func,

/** Resolve record actions.
* A function that returns the actions available to the current row */
// Resolve record actions.
// A function that returns the actions available to the current row
resolveRecordActions: pt.func,

/** Unique ID Attribute.
*
* specifies the attribute that uniquely identifies every object in the 'data' array. */
// Unique ID Attribute.
//
// specifies the attribute that uniquely identifies every object in the 'data' array.
uniqueIdAttribute: pt.string,
};

Expand Down
Loading