- Set the browser target to ES6 and reduce the JS bundle size considerably

- Upgrade ESLint to v9.x and migrate the .eslintrc.js file to make it work
This commit is contained in:
Aditya Toshniwal
2024-07-04 18:25:47 +05:30
committed by GitHub
parent 10b2e91e29
commit dcfef154ce
21 changed files with 266 additions and 233 deletions
@@ -32,8 +32,8 @@ export default class RoleSchema extends BaseUISchema {
variables: [],
rolbypassrls: false,
});
this.getVariableSchema = getVariableSchema;
this.getMembershipSchema = getMembershipSchema;
this.variableSchema = getVariableSchema();
this.membershipSchema = getMembershipSchema();
this.fieldOptions = {
role: [],
...fieldOptions,
@@ -165,7 +165,7 @@ export default class RoleSchema extends BaseUISchema {
disabled: obj.readOnly,
mode: ['edit', 'create'], cell: 'text',
type: 'collection',
schema: new obj.getMembershipSchema(),
schema: obj.membershipSchema,
helpMessage: obj.isReadOnly ? gettext('Select the checkbox for roles to include WITH ADMIN OPTION.') : gettext('Roles shown with a check mark have the WITH ADMIN OPTION set.'),
},
{
@@ -183,7 +183,7 @@ export default class RoleSchema extends BaseUISchema {
id: 'rolmembers', label: gettext('Members'), group: gettext('Membership'),
mode: ['edit', 'create'], cell: 'text',
type: 'collection',
schema: new obj.getMembershipSchema(),
schema: obj.membershipSchema,
disabled: obj.readOnly,
helpMessage: obj.isReadOnly ? gettext('Select the checkbox for roles to include WITH ADMIN OPTION.') : gettext('Roles shown with a check mark have the WITH ADMIN OPTION set.') ,
},
@@ -201,7 +201,7 @@ export default class RoleSchema extends BaseUISchema {
{
id: 'variables', label: '', type: 'collection',
group: gettext('Parameters'),
schema: this.getVariableSchema(),
schema: this.variableSchema,
mode: [ 'edit', 'create'], canAdd: true, canDelete: true,
disabled: obj.readOnly,
},
@@ -468,7 +468,7 @@ function Dashboard({
link.click();
}
document.body.removeChild(link);
} catch (error) {
} catch {
setSsMsg(gettext('Failed to download the logs.'));
}
};
@@ -6,7 +6,7 @@
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
// eslint-disable-next-line react/display-name
import React, { useState, useEffect, useRef, useReducer, useMemo } from 'react';
import PgTable from 'sources/components/PgTable';
import gettext from 'sources/gettext';
+1 -1
View File
@@ -3,7 +3,7 @@ import pgAdmin from 'sources/pgadmin';
export async function copyToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
} catch(err) {
} catch {
/* Suppress error */
pgAdmin.Browser.notifier.error('Does not have clipboard access');
}
@@ -66,7 +66,7 @@ function handleDrop(e, editor) {
if (e.stopPropagation) {
e.stopPropagation();
}
} catch (error) {
} catch {
/* if parsing fails, it must be the drag internal of codemirror text */
return false;
}
@@ -15,7 +15,7 @@ import PropTypes from 'prop-types';
import { fullHexColor } from '../utils';
export function withColorPicker(Component) {
// eslint-disable-next-line react/display-name
const HOCComponent = ({value, currObj, onChange, onSave, options, ...props})=>{
const pickrOptions = {
showPalette: true,
@@ -14,7 +14,7 @@ import { usePgAdmin } from '../../../static/js/BrowserComponent';
import ErrorBoundary from './ErrorBoundary';
export default function withStandardTabInfo(Component, tabId) {
// eslint-disable-next-line react/display-name
const HOCComponent = (props)=>{
const [[isStale, nodeItem, nodeData], setNodeInfo] = useState([true, undefined, undefined]);
const pgAdmin = usePgAdmin();
+1 -1
View File
@@ -84,7 +84,7 @@ export default function toPx(value, prop, force, el) {
// set the style on the target element
try {
style[prop] = value;
} catch (e) {
} catch {
// IE 8 and below throw an exception when setting unsupported units
return 0;
}
@@ -141,7 +141,7 @@ export default function ObjectExplorer() {
try {
const _node_path = parentPath + '/' + _data.id;
return mtree.addNode(parentPath, _node_path, _data);
} catch (error) {
} catch {
return null; // or throw error as you see fit
}
};
@@ -151,7 +151,7 @@ export default function ObjectExplorer() {
try {
await mtree.removeNode(path, _removeOnlyChild);
return true;
} catch (error) {
} catch {
return false; // or throw error as you see fit
}
};
@@ -161,7 +161,7 @@ export default function ObjectExplorer() {
try {
await mtree.updateNode(path, data);
return true;
} catch (error) {
} catch {
return false; // or throw error as you see fit
}
};
+1 -1
View File
@@ -24,7 +24,7 @@ const pgWindow = function() {
} else {
localPgWindow = window;
}
} catch (error) {
} catch {
localPgWindow = window;
}
return localPgWindow;
@@ -367,7 +367,7 @@ export default class DebuggerModule {
let browser_preferences = usePreferences.getState().getPreferencesForModule('browser');
let open_new_tab = browser_preferences.new_browser_tab_open;
const db_label = self.checkDbNameChange(data, dbNode, newTreeInfo, db_label);
const db_label = self.checkDbNameChange(data, dbNode, newTreeInfo);
let label = getAppropriateLabel(newTreeInfo);
pgAdmin.Browser.Events.trigger(
'pgadmin:tool:show',
@@ -147,7 +147,7 @@ export default function DebuggerComponent({ pgAdmin, selectedNodeInfo, panelId,
}
});
}
} catch (e) {
} catch {
alert(xhr);
pgAdmin.Browser.notifier.alert(
gettext('Debugger Error'),
@@ -87,7 +87,7 @@ function parseEwkbData(rows, column) {
}
supportedGeometries.push(geometry);
geometryItemMap.set(geometry, item);
} catch (e) {
} catch {
unsupportedRows.push(item);
}
return true;
@@ -1075,7 +1075,7 @@ export function ResultSet() {
'info': gettext('This query was generated by pgAdmin as part of a "Save Data" operation'),
});
});
} catch (_e) {/* History errors should not bother others */}
} catch {/* History errors should not bother others */}
if(!respData.data.status) {
eventBus.fireEvent(QUERY_TOOL_EVENTS.SAVE_DATA_DONE, false);