Skip to content

Commit 858eb7f

Browse files
committed
fix(eslint): rename and re-enable no-require-imports rule; fix some missed cases
1 parent 4a4f0a7 commit 858eb7f

File tree

22 files changed

+26
-41
lines changed

22 files changed

+26
-41
lines changed

configs/eslint-config-compass/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const extraTsRules = {
2020
'@typescript-eslint/prefer-promise-reject-errors': 'off',
2121
'@typescript-eslint/no-explicit-any': 'off',
2222
'@typescript-eslint/no-base-to-string': 'off',
23-
'@typescript-eslint/no-require-imports': 'off',
2423
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
2524
'@typescript-eslint/unbound-method': 'off',
2625
'@typescript-eslint/no-redundant-type-constituents': 'off',

configs/webpack-config-compass/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export function createElectronRendererConfig(
301301
export function createWebConfig(args: Partial<ConfigArgs>): WebpackConfig {
302302
const opts = webpackArgsWithDefaults(args, { target: 'web' });
303303

304-
// eslint-disable-next-line @typescript-eslint/no-var-requires
304+
// eslint-disable-next-line @typescript-eslint/no-require-imports
305305
const { peerDependencies } = require(path.join(opts.cwd, 'package.json')) as {
306306
peerDependencies: Record<string, string>;
307307
};

configs/webpack-config-compass/src/loaders.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { isServe } from './args';
77
import chalk from 'chalk';
88

99
function isLatestBrowserslist() {
10-
// eslint-disable-next-line @typescript-eslint/no-var-requires
10+
// eslint-disable-next-line @typescript-eslint/no-require-imports
1111
const browserslistVersion = require('browserslist/package.json').version;
1212
const command = `npm view browserslist version --json`;
1313
const latestBrowserslistVersion = JSON.parse(
@@ -18,7 +18,7 @@ function isLatestBrowserslist() {
1818
}
1919

2020
const electronVersion = (() => {
21-
// eslint-disable-next-line @typescript-eslint/no-var-requires
21+
// eslint-disable-next-line @typescript-eslint/no-require-imports
2222
const [maj, min] = require('electron/package.json').version.split(
2323
'.'
2424
) as string[];

configs/webpack-config-compass/src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function camelCase(str: string): string {
6262
}
6363

6464
export function getLibraryNameFromCwd(cwd: string): string {
65-
// eslint-disable-next-line @typescript-eslint/no-var-requires
65+
// eslint-disable-next-line @typescript-eslint/no-require-imports
6666
const { name, productName } = require(path.join(cwd, 'package.json')) as {
6767
name: string;
6868
productName: string;

packages/compass-e2e-tests/helpers/commands/get-feature.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function getFeature<K extends keyof UserPreferences>(
77
): Promise<UserPreferences[K]> {
88
return await browser.execute(async (_name) => {
99
return (
10-
// eslint-disable-next-line @typescript-eslint/no-var-requires
10+
// eslint-disable-next-line @typescript-eslint/no-require-imports
1111
(await require('electron').ipcRenderer.invoke('compass:get-preferences'))[
1212
_name
1313
]

packages/compass-e2e-tests/helpers/commands/open-settings-modal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export async function openSettingsModal(
66
tab?: string
77
): Promise<void> {
88
await browser.execute(() => {
9-
// eslint-disable-next-line @typescript-eslint/no-var-requires
9+
// eslint-disable-next-line @typescript-eslint/no-require-imports
1010
require('electron').ipcRenderer.emit('window:show-settings');
1111
});
1212

packages/compass-e2e-tests/helpers/commands/set-feature.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function setFeature<K extends keyof UserPreferences>(
3131

3232
await browser.execute(
3333
async (_name, _value) => {
34-
// eslint-disable-next-line @typescript-eslint/no-var-requires
34+
// eslint-disable-next-line @typescript-eslint/no-require-imports
3535
await require('electron').ipcRenderer.invoke('compass:save-preferences', {
3636
[_name]: _value === null ? undefined : _value,
3737
});

packages/compass-e2e-tests/helpers/compass.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class Compass {
220220
// close it and load the logs
221221
[this.logPath, this.userDataPath, this.appName, this.mainProcessPid] =
222222
await this.browser.execute(() => {
223-
// eslint-disable-next-line @typescript-eslint/no-var-requires
223+
// eslint-disable-next-line @typescript-eslint/no-require-imports
224224
const { ipcRenderer } = require('electron');
225225
return Promise.all([
226226
ipcRenderer.invoke('compass:logPath'),
@@ -350,7 +350,7 @@ export class Compass {
350350
debug('Writing coverage');
351351
const coverage: Coverage = await this.browser.executeAsync((done) => {
352352
void (async () => {
353-
// eslint-disable-next-line @typescript-eslint/no-var-requires
353+
// eslint-disable-next-line @typescript-eslint/no-require-imports
354354
const mainCoverage = await require('electron').ipcRenderer.invoke(
355355
'coverage'
356356
);
@@ -963,6 +963,7 @@ async function getCompassBuildMetadata(): Promise<BinPathOptions> {
963963
packagerOptions: { name: process.env.COMPASS_APP_NAME },
964964
};
965965
} else {
966+
// eslint-disable-next-line @typescript-eslint/no-require-imports
966967
metadata = require('mongodb-compass/dist/target.json');
967968
}
968969
// Double-checking that Compass app path exists, not only the metadata
@@ -1097,7 +1098,7 @@ export async function init(
10971098
}
10981099
} else {
10991100
await browser.execute(() => {
1100-
// eslint-disable-next-line @typescript-eslint/no-var-requires
1101+
// eslint-disable-next-line @typescript-eslint/no-require-imports
11011102
const { ipcRenderer } = require('electron');
11021103
void ipcRenderer.invoke('compass:maximize');
11031104
});

packages/compass-e2e-tests/tests/auto-connect.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ describe('Automatically connecting from the command line', function () {
307307
await browser.closeWorkspaceTabs();
308308

309309
await browser.execute(() => {
310-
// eslint-disable-next-line @typescript-eslint/no-var-requires
310+
// eslint-disable-next-line @typescript-eslint/no-require-imports
311311
require('electron').ipcRenderer.call('test:show-connect-window');
312312
});
313313

packages/compass-import-export/src/components/export-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ function ExportModal({
191191
);
192192

193193
const onClickExport = useCallback(() => {
194-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports, @typescript-eslint/no-var-requires
194+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports, @typescript-eslint/no-require-imports
195195
const electron: typeof import('@electron/remote') = require('@electron/remote');
196196
const fileBackend = createElectronFileInputBackend(electron, null)();
197197

0 commit comments

Comments
 (0)