mirror of
https://github.com/apache/superset.git
synced 2026-04-26 03:24:53 +00:00
Eslint error cleanup (#10657)
* moving two console errors to logger errors * nixing unused map index * nixing unused param * linting * changing an alert to a toast * fixing tests * lint fix * one letter change, just to see if iti gets CI to pass this test.
This commit is contained in:
@@ -114,14 +114,12 @@ export default function Button(props: ButtonProps) {
|
||||
{props.children}
|
||||
</SupersetButton>
|
||||
<ul className="dropdown-menu">
|
||||
{dropdownItems.map(
|
||||
(dropdownItem: DropdownItemProps, index1: number) => (
|
||||
<MenuItem key={`${dropdownItem.label}`} href={dropdownItem.url}>
|
||||
<i className={`fa ${dropdownItem.icon}`} />
|
||||
{dropdownItem.label}
|
||||
</MenuItem>
|
||||
),
|
||||
)}
|
||||
{dropdownItems.map((dropdownItem: DropdownItemProps) => (
|
||||
<MenuItem key={`${dropdownItem.label}`} href={dropdownItem.url}>
|
||||
<i className={`fa ${dropdownItem.icon}`} />
|
||||
{dropdownItem.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -20,6 +20,7 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Tooltip, OverlayTrigger, MenuItem } from 'react-bootstrap';
|
||||
import { t } from '@superset-ui/translation';
|
||||
import withToasts from 'src/messageToasts/enhancers/withToasts';
|
||||
|
||||
const propTypes = {
|
||||
copyNode: PropTypes.node,
|
||||
@@ -30,6 +31,7 @@ const propTypes = {
|
||||
inMenu: PropTypes.bool,
|
||||
wrapped: PropTypes.bool,
|
||||
tooltipText: PropTypes.string,
|
||||
addDangerToast: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
@@ -41,7 +43,7 @@ const defaultProps = {
|
||||
tooltipText: t('Copy to clipboard'),
|
||||
};
|
||||
|
||||
export default class CopyToClipboard extends React.Component {
|
||||
class CopyToClipboard extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
@@ -95,9 +97,9 @@ export default class CopyToClipboard extends React.Component {
|
||||
throw new Error(t('Not successful'));
|
||||
}
|
||||
} catch (err) {
|
||||
window.alert(
|
||||
this.props.addDangerToast(
|
||||
t('Sorry, your browser does not support copying. Use Ctrl / Cmd + C!'),
|
||||
); // eslint-disable-line
|
||||
);
|
||||
}
|
||||
|
||||
document.body.removeChild(span);
|
||||
@@ -194,5 +196,7 @@ export default class CopyToClipboard extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default withToasts(CopyToClipboard);
|
||||
|
||||
CopyToClipboard.propTypes = propTypes;
|
||||
CopyToClipboard.defaultProps = defaultProps;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React, { useEffect } from 'react';
|
||||
import { logging } from '@superset-ui/core';
|
||||
|
||||
interface ImageLoaderProps
|
||||
extends React.DetailedHTMLProps<
|
||||
@@ -48,7 +49,7 @@ export default function ImageLoader({
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e); // eslint-disable-line no-console
|
||||
logging.error(e);
|
||||
setImgSrc(fallback);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
import { t } from '@superset-ui/translation';
|
||||
import rison from 'rison';
|
||||
import getClientErrorObject from 'src/utils/getClientErrorObject';
|
||||
import { logging } from '@superset-ui/core';
|
||||
|
||||
export const createFetchRelated = (
|
||||
resource: string,
|
||||
@@ -56,7 +57,7 @@ export const createFetchRelated = (
|
||||
export function createErrorHandler(handleErrorFunc: (errMsg?: string) => void) {
|
||||
return async (e: SupersetClientResponse | string) => {
|
||||
const parsedError = await getClientErrorObject(e);
|
||||
console.error(e);
|
||||
logging.error(e);
|
||||
handleErrorFunc(parsedError.message);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user