Skip to content

Commit 7c7d219

Browse files
Josmithranthony-murphy-agent
authored andcommitted
refactor: Promote "no-empty" eslint rule from "recommended" to "minimal" and fix violations (microsoft#26163)
Part of an ongoing effort to collapse the "recommended" and "minimal-deprecated" configurations together so we can remove the latter.
1 parent 3e66018 commit 7c7d219

File tree

16 files changed

+55
-23
lines changed

16 files changed

+55
-23
lines changed

common/build/eslint-config-fluid/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Packages can now use `eslint.config.mjs` instead of `.eslintrc.cjs`, but the leg
9090

9191
- `@typescript-eslint/explicit-function-return-type`
9292
- `@typescript-eslint/no-import-type-side-effects`
93+
- `no-empty`
9394

9495
#### Rule modifications
9596

common/build/eslint-config-fluid/minimal-deprecated.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ module.exports = {
196196

197197
"eqeqeq": ["error", "smart"],
198198
"import-x/no-deprecated": "error",
199+
"no-empty": "error",
199200
"no-multi-spaces": [
200201
"error",
201202
{
@@ -274,7 +275,6 @@ module.exports = {
274275
"@typescript-eslint/consistent-type-imports": "off",
275276

276277
"func-call-spacing": "off", // Off because it conflicts with typescript-formatter
277-
"no-empty": "off",
278278
"no-void": "off",
279279
"require-atomic-updates": "off",
280280

common/build/eslint-config-fluid/printed-configs/minimal.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@
14191419
}
14201420
],
14211421
"no-empty": [
1422-
"off",
1422+
"error",
14231423
{
14241424
"allowEmptyCatch": false
14251425
}

common/build/eslint-config-fluid/recommended.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@ module.exports = {
2323
rules: {
2424
// RECOMMENDED RULES
2525
"@rushstack/no-new-null": "error",
26-
"no-empty": "error",
2726
"no-void": "error",
2827
"require-atomic-updates": "error",
2928

30-
// This rule ensures that our Intellisense looks good by verifying the TSDoc syntax.
31-
"tsdoc/syntax": "error",
32-
3329
// #region `unicorn` rule overrides
3430

3531
// TODO: Enable this rule and fix violations once eslint9 upgrade is done

examples/utils/webpack-fluid-loader/src/odspUrlResolver.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export class OdspUrlResolver implements IUrlResolver {
2727
try {
2828
const resolvedUrl = await this.driverUrlResolver.resolve(request);
2929
return resolvedUrl;
30-
} catch (error) {}
30+
} catch (error) {
31+
// TODO: document why we are ignoring the error here
32+
}
3133

3234
const url = new URL(request.url);
3335

examples/utils/webpack-fluid-loader/src/routes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ const makeAfterMiddlewares = (
209209
let toLog = error;
210210
try {
211211
toLog = JSON.stringify(error);
212-
} catch {}
212+
} catch {
213+
// TODO: document why we are ignoring the error here
214+
}
213215
console.log(toLog);
214216
}
215217
if (!canContinue) {

packages/drivers/driver-base/src/documentDeltaConnection.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,9 @@ export class DocumentDeltaConnection
557557
// That's a WebSocket. Clear it as we can't log it.
558558
description.target = undefined;
559559
}
560-
} catch (_e) {}
560+
} catch (_e) {
561+
// TODO: document why we are ignoring the error here
562+
}
561563

562564
// Handle socket transport downgrading when not offline.
563565
if (

packages/loader/driver-utils/src/test/runWithRetry.spec.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ describe("runWithRetry Tests", () => {
108108
};
109109
try {
110110
success = await runWithFastSetTimeout(async () => runWithRetry(api, "test", logger, {}));
111-
} catch (error) {}
111+
} catch (error) {
112+
// Ignore the error
113+
}
112114
assert.strictEqual(retryTimes, 0, "Should retry");
113115
assert.strictEqual(success, true, "Should succeed as retry should be successful");
114116
});
@@ -128,7 +130,9 @@ describe("runWithRetry Tests", () => {
128130
try {
129131
success = await runWithFastSetTimeout(async () => runWithRetry(api, "test", logger, {}));
130132
assert.fail("Should not succeed");
131-
} catch (error) {}
133+
} catch (error) {
134+
// Ignore the error
135+
}
132136
assert.strictEqual(retryTimes, 0, "Should not retry");
133137
assert.strictEqual(success, false, "Should not succeed as canRetry was not set");
134138
});
@@ -147,7 +151,9 @@ describe("runWithRetry Tests", () => {
147151
try {
148152
success = await runWithFastSetTimeout(async () => runWithRetry(api, "test", logger, {}));
149153
assert.fail("Should not succeed");
150-
} catch (error) {}
154+
} catch (error) {
155+
// Ignore the error
156+
}
151157
assert.strictEqual(retryTimes, 0, "Should not retry");
152158
assert.strictEqual(success, false, "Should not succeed as canRetry was not set");
153159
});
@@ -173,7 +179,9 @@ describe("runWithRetry Tests", () => {
173179
}),
174180
);
175181
assert.fail("Should not succeed");
176-
} catch (error) {}
182+
} catch (error) {
183+
// Ignore the error
184+
}
177185
assert.strictEqual(retryTimes, 0, "Should not retry");
178186
assert.strictEqual(success, false, "Should not succeed as retrying was disabled");
179187
});

packages/test/snapshots/src/replayMultipleFiles.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ async function processNode(
390390
try {
391391
threads = await import("worker_threads");
392392
threads.Worker.EventEmitter.defaultMaxListeners = 20;
393-
} catch (err) {}
393+
} catch (err) {
394+
// TODO: document why we are ignoring the error here
395+
}
394396

395397
if (!concurrently || !threads) {
396398
await processOneNode(workerData);

packages/test/test-end-to-end-tests/src/test/detachedContainerTests.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,9 @@ describeCompat("Detached Container", "NoCompat", (getTestObjectProvider, apis) =
10661066
try {
10671067
await container.attach(request);
10681068
assert.fail("expected attach to fail!");
1069-
} catch (e) {}
1069+
} catch (e) {
1070+
// Ignore the error
1071+
}
10701072
assert.strictEqual(container.closed, true, "Container should be closed");
10711073
},
10721074
);
@@ -1117,7 +1119,9 @@ describeCompat("Detached Container", "NoCompat", (getTestObjectProvider, apis) =
11171119
try {
11181120
await container.attach(request);
11191121
assert.fail("expected attach to fail!");
1120-
} catch (e) {}
1122+
} catch (e) {
1123+
// Ignore the error
1124+
}
11211125
assert.strictEqual(container.closed, true, "Container should be closed");
11221126
},
11231127
);

0 commit comments

Comments
 (0)