Add eslint rule to disallow console.log (#6717)

This commit is contained in:
Hetu Nandu 2021-08-20 09:43:16 +05:30 committed by GitHub
parent 6061206970
commit 17edf11d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 26 additions and 26 deletions

View File

@ -35,7 +35,10 @@
"react/jsx-sort-props": "error",
"react/jsx-fragments": "error",
"react/jsx-no-useless-fragment": "error",
"sort-destructure-keys/sort-destructure-keys": ["error", {"caseSensitive": false}]
"sort-destructure-keys/sort-destructure-keys": ["error", {"caseSensitive": false}],
"no-console": ["error", {
"allow": ["error"]
}]
},
"settings": {
"react": {

View File

@ -139,6 +139,6 @@ export const apiFailureResponseInterceptor = (error: any) => {
// Something happened in setting up the request that triggered an Error
log.error("Error", error.message);
}
console.log(error.config);
log.debug(error.config);
return Promise.resolve(error);
};

View File

@ -17,6 +17,7 @@ import {
} from "actions/commentActions";
import "@blueprintjs/popover2/lib/css/blueprint-popover2.css";
import log from "loglevel";
export const options = [
{ label: "Show all comments", value: "show-all" },
@ -49,7 +50,7 @@ const useSetResolvedFilterFromQuery = () => {
useEffect(() => {
const url = new URL(window.location.href);
const searchParams = url.searchParams;
console.log(window.location.href, "window.location.href");
log.debug(window.location.href, "window.location.href");
if (searchParams.get("isResolved")) {
dispatch(setShouldShowResolvedComments(true));
}

View File

@ -226,7 +226,6 @@ function IconButtonComponent(props: IconButtonComponentProps) {
* we will use that for the dimension of the widget
*/
const dimension = useMemo(() => {
console.log({ width, height });
if (width > height) {
return height - WIDGET_PADDING * 2;
}

View File

@ -5,6 +5,7 @@ import InputComponent from "components/designSystems/blueprint/InputComponent";
import { Provider } from "react-redux";
import ReactDOM from "react-dom";
import { act } from "react-dom/test-utils";
import { noop } from "utils/AppsmithUtils";
let container: HTMLDivElement | null;
@ -30,15 +31,9 @@ describe("<InputComponent />", () => {
isLoading={false}
label="label"
multiline
onCurrencyTypeChange={(code?: string) => {
console.log(code);
}}
onFocusChange={(state: boolean) => {
console.log(state);
}}
onValueChange={(valueAsString: string) => {
console.log(valueAsString);
}}
onCurrencyTypeChange={noop}
onFocusChange={noop}
onValueChange={noop}
showError={false}
value="something"
widgetId="24234r35"

View File

@ -101,10 +101,6 @@ class IconSelectControl extends BaseControl<
componentDidMount() {
this.timer = setTimeout(() => {
const iconSelectTargetElement = this.iconSelectTargetRef.current;
console.log(
`target width: => `,
iconSelectTargetElement?.getBoundingClientRect().width,
);
this.setState((prevState: IconSelectControlState) => {
return {
...prevState,

View File

@ -1,5 +1,6 @@
import React from "react";
import FilePicker, { CloudinaryUploader, FileType } from "../ads/FilePicker";
import log from "loglevel";
export default {
title: "FilePicker",
@ -7,7 +8,7 @@ export default {
};
function ShowUploadedFile(data: any) {
console.log(data);
log.debug(data);
}
export const withDynamicProps = () => (

View File

@ -5,6 +5,7 @@ import Icon, { IconSize } from "components/ads/Icon";
import TableDropdown from "components/ads/TableDropdown";
import { Position } from "@blueprintjs/core/lib/esm/common/position";
import { StoryWrapper, Variant } from "components/ads/common";
import { noop } from "utils/AppsmithUtils";
export default {
title: "Table",
@ -59,7 +60,7 @@ const data = [
col2: "dustin_01@jlegue.com",
col3: (
<TableDropdown
onSelect={(selectedValue) => console.log(selectedValue)}
onSelect={noop}
options={options}
position={Position.BOTTOM}
selectedIndex={0}
@ -81,7 +82,7 @@ const data = [
col2: "dustin_02@jlegue.com",
col3: (
<TableDropdown
onSelect={(selectedValue) => console.log(selectedValue)}
onSelect={noop}
options={options}
position={Position.BOTTOM}
selectedIndex={1}
@ -103,7 +104,7 @@ const data = [
col2: "dustin_03@jlegue.com",
col3: (
<TableDropdown
onSelect={(selectedValue) => console.log(selectedValue)}
onSelect={noop}
options={options}
position={Position.BOTTOM}
selectedIndex={2}

View File

@ -4,6 +4,7 @@ import { withDesign } from "storybook-addon-designs";
import TableDropdown from "components/ads/TableDropdown";
import { Position } from "@blueprintjs/core/lib/esm/common/position";
import { StoryWrapper } from "components/ads/common";
import { noop } from "utils/AppsmithUtils";
export default {
title: "Dropdown",
@ -36,7 +37,7 @@ export function TableDropdownStory() {
}}
>
<TableDropdown
onSelect={(selectedValue) => console.log(selectedValue)}
onSelect={noop}
options={options}
position={select("position", Object.values(Position), Position.BOTTOM)}
selectedIndex={0}

View File

@ -3,6 +3,7 @@ import { withKnobs, boolean, text } from "@storybook/addon-knobs";
import TextInput from "components/ads/TextInput";
import { action } from "@storybook/addon-actions";
import { StoryWrapper } from "components/ads/common";
import { noop } from "utils/AppsmithUtils";
export default {
title: "Text Input",
@ -46,7 +47,7 @@ export function ErrorTextInputStory() {
defaultValue={text("defaultValue", "This is wrong")}
disabled={boolean("disabled", false)}
fill={boolean("fill", true)}
onChange={(value) => console.log(value)}
onChange={noop}
placeholder={text("placeholder", "Your name")}
validator={() => callValidator2()}
/>

View File

@ -15,6 +15,7 @@ import {
executeDatasourceQuerySuccessPayload,
} from "../../../../actions/datasourceActions";
import { DropdownOptions, DatasourceTableDropdownOption } from "./constants";
import log from "loglevel";
// const GOOGLE_SHEET_METHODS = {
// GET_ALL_SPREADSHEETS: "LIST", // Get all the spreadsheets
@ -149,7 +150,7 @@ function GoogleSheetForm(props: Props) {
// TODO :- Create loading state and set Loading state false on success or error
const onFetchAllSpreadsheetFailure = (error: any) => {
console.log({ error });
log.error(error);
};
const onFetchAllSpreadsheetSuccess = (

View File

@ -1821,7 +1821,7 @@ function* addSuggestedWidget(action: ReduxAction<Partial<WidgetProps>>) {
);
yield put(forceOpenPropertyPane(newWidget.newWidgetId));
} catch (error) {
console.log(error, "Error");
log.error(error);
}
}

View File

@ -23,7 +23,8 @@ export const resetAuthExpiration = () => {
.add(1, "h")
.format();
store.setItem(STORAGE_KEYS.AUTH_EXPIRATION, expireBy).catch((error) => {
console.log("Unable to set expiration time", error);
log.error("Unable to set expiration time");
log.error(error);
});
};