Skip to content

Commit 88c3a7f

Browse files
authored
Forbid and remove console.log and console.info calls (#835)
1 parent 047e396 commit 88c3a7f

File tree

11 files changed

+15
-19
lines changed

11 files changed

+15
-19
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ module.exports = {
5858
}
5959
],
6060
"prefer-arrow-callback": "error",
61+
"no-console": ["error", {"allow": ["error", "warn", "debug"]}],
6162
"no-duplicate-imports": "error",
6263
},
6364
};

packages/base/src/commands/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,6 @@ export function addCommands(
735735
if (!currentWidget || !completionProviderManager) {
736736
return;
737737
}
738-
console.log('zooming');
739738
const model = tracker.currentWidget.model;
740739
const selectedItems = model.localState?.selected.value;
741740

@@ -1140,7 +1139,7 @@ namespace Private {
11401139
const selected = model?.localState?.selected?.value;
11411140

11421141
if (!selected) {
1143-
console.info('Nothing selected');
1142+
console.error('Failed to remove selected item -- nothing selected');
11441143
return;
11451144
}
11461145

packages/base/src/dialogs/symbology/vector_layer/types/Categorized.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ const Categorized: React.FC<ISymbologyTabbedDialogWithAttributesProps> = ({
207207
const newStyle = { ...layer.parameters.color };
208208

209209
if (method === 'color') {
210-
console.log('delecol');
211-
212210
delete newStyle['fill-color'];
213211
delete newStyle['stroke-color'];
214212
delete newStyle['circle-fill-color'];

packages/base/src/mainview/mainView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ export class MainView extends React.Component<IProps, IStates> {
22702270
const olLayer = this.getLayer(layerId);
22712271

22722272
if (!jgisLayer || !olLayer) {
2273-
console.log('Layer not found');
2273+
console.error('Failed to update layer -- layer not found');
22742274
return;
22752275
}
22762276

packages/base/src/stacBrowser/hooks/useStacSearch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function useStacSearch({ model }: IUseStacSearchProps): IUseStacSearchReturn {
209209
)) as IStacSearchResult;
210210

211211
if (!data) {
212-
console.log('No Results found');
212+
console.debug('STAC search failed -- no results found');
213213
setResults([]);
214214
setTotalPages(1);
215215
setTotalResults(0);
@@ -221,7 +221,7 @@ function useStacSearch({ model }: IUseStacSearchProps): IUseStacSearchReturn {
221221
setTotalPages(Math.ceil(pages));
222222
setTotalResults(data.context.matched);
223223
} catch (error) {
224-
console.error('Error fetching data:', error);
224+
console.error('STAC search failed -- error fetching data:', error);
225225
setResults([]);
226226
setTotalPages(1);
227227
setTotalResults(0);

packages/base/src/tools.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ export async function requestAPI<T>(
111111
try {
112112
data = JSON.parse(data);
113113
} catch (error) {
114-
console.log('Not a JSON response body.', response);
114+
console.error(
115+
'Jupyter API request failed -- not a JSON response body:',
116+
response,
117+
);
115118
}
116119
}
117120

packages/schema/src/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ export class JupyterGISModel implements IJupyterGISModel {
735735
layerTreeInfo.mainGroup,
736736
);
737737
} else {
738-
console.log('Something went wrong when renaming layer');
738+
console.error('Layer group rename failed -- could not get layer tree.');
739739
}
740740
}
741741

python/jupytergis_core/src/jgisplugin/plugins.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,8 @@ const activate = async (
6767
window.jupytergisMaps = {};
6868
}
6969

70-
let settings: ISettingRegistry.ISettings | null = null;
71-
7270
try {
73-
settings = await settingRegistry.load(SETTINGS_ID);
74-
console.log(`Loaded settings for ${SETTINGS_ID}`, settings);
71+
await settingRegistry.load(SETTINGS_ID);
7572
} catch (error) {
7673
console.warn(`Failed to load settings for ${SETTINGS_ID}`, error);
7774
}

python/jupytergis_core/src/plugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const trackerPlugin: JupyterFrontEndPlugin<IJupyterGISTracker> = {
4141
const tracker = new WidgetTracker<IJupyterGISWidget>({
4242
namespace: NAME_SPACE,
4343
});
44-
console.log('jupytergis:core:tracker is activated!');
44+
console.debug('jupytergis:core:tracker is activated!');
4545
return tracker;
4646
},
4747
};
@@ -80,8 +80,7 @@ export const layerBrowserRegistryPlugin: JupyterFrontEndPlugin<IJGISLayerBrowser
8080
requires: [],
8181
provides: IJGISLayerBrowserRegistryToken,
8282
activate: (app: JupyterFrontEnd) => {
83-
console.log('jupytergis:core:layer-browser-registry is activated');
84-
83+
console.debug('jupytergis:core:layer-browser-registry is activated');
8584
const registry = new JupyterGISLayerBrowserRegistry();
8685
return registry;
8786
},

python/jupytergis_lab/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
4949
translator?: ITranslator,
5050
completionProviderManager?: ICompletionProviderManager,
5151
): void => {
52-
console.log('jupytergis:lab:main-menu is activated!');
52+
console.debug('jupytergis:lab:main-menu is activated!');
5353
translator = translator ?? nullTranslator;
5454
const isEnabled = (): boolean => {
5555
return (

0 commit comments

Comments
 (0)