Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix some eslint hints #480

Merged
merged 6 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const checker: StaticHas = {
}' not '${cmd}')`,
);
}
const set = cmd.indexOf("@") === -1 ? noAtCommands : atCommands;
const set = cmd.includes("@") ? atCommands : noAtCommands;
set.add(cmd);
});
return <C extends Context>(ctx: C): ctx is CommandContext<C> => {
Expand Down
2 changes: 1 addition & 1 deletion src/convenience/frameworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
const chunks: Chunk[] = [];
req.on("data", (chunk: Chunk) => chunks.push(chunk))
.once("end", () => {
// @ts-ignore `Buffer` is Node-only
// @ts-expect-error `Buffer` is Node-only

Check warning on line 163 in src/convenience/frameworks.ts

View check run for this annotation

Codecov / codecov/patch

src/convenience/frameworks.ts#L163

Added line #L163 was not covered by tests
KnorpelSenf marked this conversation as resolved.
Show resolved Hide resolved
const raw = Buffer.concat(chunks).toString("utf-8");
resolve(JSON.parse(raw));
})
Expand Down
4 changes: 2 additions & 2 deletions src/convenience/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function strictMultiSession<S, C extends Context>(
const propSessions = await Promise.all(props.map(async (prop) => {
const { initial, storage, getSessionKey, custom } = defaults[prop];
const s = new PropertySession(
// @ts-ignore cannot express that the storage works for a concrete prop
// @ts-expect-error cannot express that the storage works for a concrete prop
storage,
ctx.session,
prop,
Expand Down Expand Up @@ -305,7 +305,7 @@ export function lazySession<S, C extends Context>(
const { initial, storage, getSessionKey, custom } = fillDefaults(options);
return async (ctx, next) => {
const propSession = new PropertySession(
// @ts-ignore suppress promise nature of values
// @ts-expect-error suppress promise nature of values
storage,
ctx,
"session",
Expand Down
2 changes: 1 addition & 1 deletion src/core/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { type ApiError, type ResponseParameters } from "../types.ts";
*/
export class GrammyError extends Error implements ApiError {
/** Flag that this request was unsuccessful. Always `false`. */
public readonly ok: false = false;
public readonly ok = false;
KnorpelSenf marked this conversation as resolved.
Show resolved Hide resolved
/** An integer holding Telegram's error code. Subject to change. */
public readonly error_code: number;
/** A human-readable description of the error. */
Expand Down
2 changes: 1 addition & 1 deletion test/composer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "./deps.test.ts";

describe("BotError", () => {
// @ts-ignore-error this message is missing many properties
// @ts-expect-error this message is missing many properties
const ctx = new Context({ message: { text: "test" } }, 0, 0);
it("should copy stack and message", () => {
const e = new Error("nope");
Expand Down
4 changes: 2 additions & 2 deletions test/convenience/session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ describe("enhanceStorage", () => {
assertEquals(await store.read("k"), 42);
await tick(2);
assertEquals(await store.read("k"), undefined);
store.write("k", 42);
await store.write("k", 42);
assertEquals(await store.read("k"), 42);
});

Expand Down Expand Up @@ -884,7 +884,7 @@ describe("enhanceStorage", () => {
assertEquals(await enhanced.read("k"), 400);
await tick(2);
assertEquals(await enhanced.read("k"), undefined);
enhanced.write("k", 42);
await enhanced.write("k", 42);
assertEquals(await enhanced.read("k"), 42);
});
});
Expand Down
Loading