Skip to content

Commit cc7ffb4

Browse files
committed
Fix lint issues
1 parent 93e31b1 commit cc7ffb4

File tree

16 files changed

+75
-98
lines changed

16 files changed

+75
-98
lines changed

apps/test-app/App.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ function loadTests({
4141
it(exampleName, async () => {
4242
const test = requireExample();
4343
if (test instanceof Function) {
44-
await test();
44+
const result = test();
45+
if (result instanceof Promise) {
46+
await result;
47+
}
4548
}
4649
});
4750
}
@@ -67,8 +70,9 @@ function loadTests({
6770

6871
describeIf(ferricExample, "ferric-example", () => {
6972
it("exports a callable sum function", () => {
70-
/* eslint-disable-next-line @typescript-eslint/no-require-imports -- TODO: Determine why a dynamic import doesn't work on Android */
71-
const exampleAddon = require("ferric-example");
73+
const exampleAddon =
74+
/* eslint-disable-next-line @typescript-eslint/no-require-imports -- TODO: Determine why a dynamic import doesn't work on Android */
75+
require("ferric-example") as typeof import("ferric-example");
7276
const result = exampleAddon.sum(1, 3);
7377
if (result !== 4) {
7478
throw new Error(`Expected 1 + 3 to equal 4, but got ${result}`);

packages/cmake-rn/src/platforms.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ export function findPlatformForTarget(target: unknown) {
1818
const platform = Object.values(platforms).find((platform) =>
1919
platformHasTarget(platform, target),
2020
);
21-
assert(platform, `Unable to determine platform from target: ${target}`);
21+
assert(
22+
platform,
23+
`Unable to determine platform from target: ${
24+
typeof target === "string" ? target : JSON.stringify(target)
25+
}`,
26+
);
2227
return platform;
2328
}

packages/cmake-rn/src/weak-node-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function getWeakNodeApiPath(triplet: SupportedTriplet): string {
3737
assert(fs.existsSync(libraryPath), `Expected library at ${libraryPath}`);
3838
return libraryPath;
3939
} else {
40-
throw new Error(`Unexpected triplet: ${triplet}`);
40+
throw new Error(`Unexpected triplet: ${triplet as string}`);
4141
}
4242
}
4343

packages/ferric/src/cargo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,6 @@ export function getTargetEnvironmentVariables({
223223
].join(String.fromCharCode(0x1f)),
224224
};
225225
} else {
226-
throw new Error(`Unexpected target: ${target}`);
226+
throw new Error(`Unexpected target: ${target as string}`);
227227
}
228228
}

packages/ferric/src/targets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ export function filterTargetsByPlatform(
9999
} else if (platform === "apple") {
100100
return [...targets].filter(isAppleTarget);
101101
} else {
102-
throw new Error(`Unexpected platform ${platform}`);
102+
throw new Error(`Unexpected platform ${platform as string}`);
103103
}
104104
}

packages/gyp-to-cmake/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ export const program = new Command("gyp-to-cmake")
7878
} else if (stat.isDirectory()) {
7979
transformBindingGypsRecursively(targetPath, options);
8080
} else {
81-
throw new Error(`Expected either a file or a directory: ${path}`);
81+
throw new Error(`Expected either a file or a directory: ${targetPath}`);
8282
}
8383
});

packages/host/scripts/node-api-functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function getNodeApiHeaderAST(version: NodeApiVersion) {
5151
maxBuffer: 1024 * 1024 * 10,
5252
},
5353
);
54-
const parsed = JSON.parse(output);
54+
const parsed = JSON.parse(output) as unknown;
5555
return clangAstDump.parse(parsed);
5656
}
5757

packages/host/src/node/babel-plugin/plugin.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { setupTempDirectory } from "../test-utils.js";
1010
type TestTransformationOptions = {
1111
files: Record<string, string>;
1212
inputFilePath: string;
13-
assertion(code: string): void;
13+
assertion: (code: string) => void;
1414
options?: PluginOptions;
1515
};
1616

packages/host/src/node/cli/link-modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,6 @@ export function getLinkedModuleOutputPath(
152152
} else if (platform === "apple") {
153153
return path.join(getAutolinkPath(platform), libraryName + ".xcframework");
154154
} else {
155-
throw new Error(`Unsupported platform: ${platform}`);
155+
throw new Error(`Unsupported platform: ${platform as string}`);
156156
}
157157
}

packages/host/src/node/cli/program.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getLinker(platform: PlatformName): ModuleLinker {
3838
} else if (platform === "apple") {
3939
return linkXcframework;
4040
} else {
41-
throw new Error(`Unknown platform: ${platform}`);
41+
throw new Error(`Unknown platform: ${platform as string}`);
4242
}
4343
}
4444

@@ -48,7 +48,7 @@ function getPlatformDisplayName(platform: PlatformName) {
4848
} else if (platform === "apple") {
4949
return "Apple";
5050
} else {
51-
throw new Error(`Unknown platform: ${platform}`);
51+
throw new Error(`Unknown platform: ${platform as string}`);
5252
}
5353
}
5454

0 commit comments

Comments
 (0)