T2316 - Poprawione błędy lintera

Summary:
T2316

Test Plan: Wykonać komendę arc lint, powinno wyświetlić okey

Reviewers: #testers, kuba-orlik

Reviewed By: #testers, kuba-orlik

Subscribers: jenkins-user

Maniphest Tasks: T2316

Differential Revision: https://hub.sealcode.org/D1150
master
Bezula 3 years ago
parent 4235a11d44
commit 400705150e

@ -1,14 +1,14 @@
{ {
useTabs: true, "useTabs": true,
tabWidth: 4, "tabWidth": 4,
trailingComma: "es5", "trailingComma": "es5",
"overrides": [ "overrides": [
{ {
"files": "*.yml", "files": "*.yml",
"options": { "options": {
"tabWidth": 2, "tabWidth": 2,
"useTabs": false "useTabs": false
} }
} }
] ]
} }

@ -1,3 +1,3 @@
export default function frame(id: string, body: string) { export default function frame(id: string, body: string): string {
return /* HTML */ `<turbo-frame id="${id}"> ${body} </turbo-frame>`; return /* HTML */ `<turbo-frame id="${id}"> ${body} </turbo-frame>`;
} }

@ -1,7 +1,7 @@
import { Context } from "sealious"; import { Context } from "sealious";
export default async function html( export default async function html(
context: Context, _context: Context,
body: string body: string
): Promise<string> { ): Promise<string> {
return /* HTML */ `<!DOCTYPE html> return /* HTML */ `<!DOCTYPE html>

@ -5,7 +5,7 @@ import { NewTask, TaskList } from "../views/tasks";
const router = new Router(); const router = new Router();
export async function MainView(context: Context) { export async function MainView(context: Context): Promise<string> {
return await html( return await html(
context, context,
/* HTML */ `<title>My ToDo App</title> /* HTML */ `<title>My ToDo App</title>

@ -1,7 +1,8 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import { CollectionItem, Context } from "sealious"; import { CollectionItem, Context } from "sealious";
import frame from "../frame"; import frame from "../frame";
export function Task(task: CollectionItem<any>) { export function Task(task: CollectionItem<never>): string {
return frame( return frame(
`task-${task.id}`, `task-${task.id}`,
/* HTML */ `<li class="task"> /* HTML */ `<li class="task">
@ -24,7 +25,7 @@ export function Task(task: CollectionItem<any>) {
); );
} }
export async function TaskList(context: Context) { export async function TaskList(context: Context): Promise<string> {
const { items: tasks } = await context.app.collections.tasks const { items: tasks } = await context.app.collections.tasks
.list(context) .list(context)
.fetch(); .fetch();
@ -38,7 +39,7 @@ export async function TaskList(context: Context) {
); );
} }
export function NewTask() { export function NewTask(): string {
return frame( return frame(
"new-task", "new-task",
/* HTML */ `<form /* HTML */ `<form

@ -1,13 +1,15 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { Controller } from "stimulus"; import { Controller } from "stimulus";
export default class TaskController extends Controller { export default class TaskController extends Controller {
id: string; id: string;
connect() { connect(): void {
this.id = this.element.attributes["data-id"].value; this.id = this.element.attributes["data-id"].value;
} }
async toggle(event: Event) { async toggle(event: Event): Promise<void> {
await fetch(`/api/v1/collections/tasks/${this.id}`, { await fetch(`/api/v1/collections/tasks/${this.id}`, {
method: "PATCH", method: "PATCH",
headers: { headers: {

Loading…
Cancel
Save