Skip to content

Commit

Permalink
Make linter great again
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth committed Feb 4, 2024
1 parent 791fafb commit 0118d1d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 6 deletions.
14 changes: 12 additions & 2 deletions packages/realm/bindgen/src/js-passes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ function addSharedPtrMethods(spec: BoundSpec) {
}

class CustomProperty extends Property {
constructor(on: Class, public readonly name: string, type: Type, public call: MethodCallSig) {
constructor(
on: Class,
public readonly name: string,
type: Type,
public call: MethodCallSig,
) {
assert(name.startsWith("$"));
super(on, "DOLLAR_" + name.slice(1), type);
}
Expand All @@ -82,7 +87,12 @@ class CustomProperty extends Property {
}

class CustomInstanceMethod extends InstanceMethod {
constructor(on: Class, public name: string, sig: Func, public call: MethodCallSig) {
constructor(
on: Class,
public name: string,
sig: Func,
public call: MethodCallSig,
) {
assert(name.startsWith("$"));
const unique_name = "DOLLAR_" + name.slice(1);
super(on, name, unique_name, unique_name, sig);
Expand Down
6 changes: 5 additions & 1 deletion packages/realm/bindgen/src/templates/jsi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ function tryWrap(body: string) {
}

class CppJsiFunc extends CppFunc {
constructor(private addon: JsiAddon, name: string, props?: CppFuncProps) {
constructor(
private addon: JsiAddon,
name: string,
props?: CppFuncProps,
) {
super(name, "jsi::Value", jsi_callback_args, props);
}

Expand Down
1 change: 1 addition & 0 deletions packages/realm/bindgen/src/templates/node-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { TemplateContext } from "@realm/bindgen/context";
import { doJsPasses } from "../js-passes";
import { eslint } from "../eslint-formatter";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function generate({ rawSpec, spec: boundSpec, file }: TemplateContext): void {
const spec = doJsPasses(boundSpec);
const reactLines = [];
Expand Down
6 changes: 5 additions & 1 deletion packages/realm/bindgen/src/templates/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ function tryWrap(body: string) {
}

class CppNodeFunc extends CppFunc {
constructor(private addon: NodeAddon, name: string, props?: CppFuncProps) {
constructor(
private addon: NodeAddon,
name: string,
props?: CppFuncProps,
) {
super(name, "Napi::Value", [node_callback_info], props);
}

Expand Down
8 changes: 7 additions & 1 deletion packages/realm/src/Realm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ export class Realm {
* @example
* Realm.setLogLevel({ category: LogCategory.Realm, level: "all" });
*/
static setLogLevel(_arg: LogLevel | LogArgs) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
static setLogLevel(_: LogLevel | LogArgs) {
// It is not possible to overload a static function: https://github.com/microsoft/TypeScript/issues/18945
// FIXME: don't use `arguments` but find a proper type
if (arguments.length === 1) {
Expand Down Expand Up @@ -955,6 +956,7 @@ export class Realm {
* Deletes the provided Realm object, or each one inside the provided collection.
* @param subject - The Realm object to delete, or a collection containing multiple Realm objects to delete.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
delete(subject: AnyRealmObject | AnyRealmObject[] | AnyList | AnyResults | any): void {
assert.inTransaction(this, "Can only delete objects within a transaction.");
assert.object(subject, "subject");
Expand Down Expand Up @@ -1653,6 +1655,7 @@ export declare namespace Realm {
export type CountOptions = CountOptionsType;
export type DeleteEvent<T extends Document> = DeleteEventType<T>;
export type DeleteResult = DeleteResultType;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Document<IdType = any> = DocumentType<IdType>;
export type DocumentKey<IdType> = DocumentKeyType<IdType>;
export type DocumentNamespace = DocumentNamespaceType;
Expand Down Expand Up @@ -1695,6 +1698,7 @@ export declare namespace Realm {
export type Set<T> = Realm.Set<T>;
export type Dictionary<T> = Realm.Dictionary<T>;
export type Mixed = unknown;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type LinkingObjects<ObjectTypeT, LinkingPropertyName> = Realm.Results<ObjectTypeT>;
}
}
Expand Down Expand Up @@ -1875,6 +1879,7 @@ declare global {
export type CountOptions = CountOptionsType;
export type DeleteEvent<T extends Document> = DeleteEventType<T>;
export type DeleteResult = DeleteResultType;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Document<IdType = any> = DocumentType<IdType>;
export type DocumentKey<IdType> = DocumentKeyType<IdType>;
export type DocumentNamespace = DocumentNamespaceType;
Expand Down Expand Up @@ -1917,6 +1922,7 @@ declare global {
export type Set<T> = Realm.Set<T>;
export type Dictionary<T> = Realm.Dictionary<T>;
export type Mixed = unknown;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type LinkingObjects<ObjectTypeT, LinkingPropertyName> = Realm.Results<ObjectTypeT>;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/realm/src/Unmanaged.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Collection, Dictionary, List, RealmObject } from "./internal";
import { AnyRealmObject } from "./Object";

Expand Down
2 changes: 1 addition & 1 deletion packages/realm/src/app-services/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class App<
constructor(configOrId: AppConfiguration | string) {
const config: AppConfiguration = typeof configOrId === "string" ? { id: configOrId } : configOrId;
assert.object(config, "config");
const { id, baseUrl, app, timeout, multiplexSessions = true, baseFilePath, metadata, fetch } = config;
const { id, baseUrl, timeout, multiplexSessions = true, baseFilePath, metadata, fetch } = config;
assert.string(id, "id");
if (timeout !== undefined) {
assert.number(timeout, "timeout");
Expand Down
1 change: 1 addition & 0 deletions packages/realm/src/tests/schema-transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe("schema transform", () => {
linkOriginPropertyName: "",
isPrimary: false,
isIndexed: false,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
columnKey: { value: 0n } as any,
...bindingSchema,
});
Expand Down

0 comments on commit 0118d1d

Please sign in to comment.