chore: upgrade eslint (#58575)

This commit is contained in:
Oliver Eyton-Williams
2025-02-07 21:48:43 +01:00
committed by GitHub
parent 54b028b10d
commit 6e9513a933
75 changed files with 2272 additions and 885 deletions
@@ -41,8 +41,7 @@ async function initTestFrame(e: InitTestFrameArg = { code: {} }) {
JSON.stringify(a) === JSON.stringify(b);
// Hardcode Deep Freeze dependency
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const DeepFreeze = (o: Record<string, any>) => {
const DeepFreeze = (o: Record<string, unknown>) => {
Object.freeze(o);
Object.getOwnPropertyNames(o).forEach(function (prop) {
if (
@@ -51,8 +50,7 @@ async function initTestFrame(e: InitTestFrameArg = { code: {} }) {
(typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
!Object.isFrozen(o[prop])
) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
DeepFreeze(o[prop]);
DeepFreeze(o[prop] as Record<string, unknown>);
}
});
return o;
@@ -73,7 +71,6 @@ async function initTestFrame(e: InitTestFrameArg = { code: {} }) {
import(/* webpackChunkName: "enzyme" */ 'enzyme'),
import(/* webpackChunkName: "enzyme-adapter" */ 'enzyme-adapter-react-16')
]);
/* eslint-enable no-inline-comments */
Enzyme.configure({ adapter: new Adapter16() });
/* eslint-enable prefer-const */
@@ -96,12 +93,13 @@ async function initTestFrame(e: InitTestFrameArg = { code: {} }) {
const test: unknown = eval(testString);
resolve(test);
} catch (err) {
reject(err);
reject(err as Error);
}
})
);
const test = await testPromise;
if (typeof test === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await test(e.getUserInput);
}
return { pass: true };
@@ -90,7 +90,7 @@ ctx.onmessage = async (e: PythonRunEvent) => {
eval(testString);
resolve(test);
} catch (err) {
reject(err);
reject(err as Error);
}
}
);
@@ -125,7 +125,6 @@ ctx.onmessage = async (e: TestEvaluatorEvent) => {
// This can be reassigned by the eval inside the try block, so it should be declared as a let
// eslint-disable-next-line prefer-const
let __userCodeWasExecuted = false;
/* eslint-disable no-eval */
try {
// Logging is proxyed after the build to catch console.log messages
// generated during testing.
@@ -152,8 +151,8 @@ ${e.data.testString}`)) as unknown;
// the user code does not get executed.
testResult = eval(e.data.testString) as unknown;
}
/* eslint-enable no-eval */
if (typeof testResult === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await testResult((fileName: string) =>
__toString(e.data.sources[fileName])
);