Skip to content

Commit

Permalink
feat: Improved code with Biome.js lint result
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Apr 3, 2024
1 parent ddccb19 commit fbcb4e8
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 83 deletions.
7 changes: 7 additions & 0 deletions .changeset/dirty-toys-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@kitajs/fastify-html-plugin': patch
'@kitajs/ts-html-plugin': patch
'@kitajs/html': patch
---

Improved code with Biome.js lint result
8 changes: 4 additions & 4 deletions benchmarks/runner/assertions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import KitaHtmlJSXRuntimeRenderers from '@kitajs/bench-html-kitajs';
import PreactRuntimeRenderers from '@kitajs/bench-html-preact';
//import ReactRuntimeRenderers from '@kitajs/bench-html-react'; same as reactjsx
import JSXTERuntimeRenderers from '@kitajs/bench-html-jsxte';
import KitaHtmlJSXRuntimeRenderers from '@kitajs/bench-html-kitajs';
import PreactRuntimeRenderers from '@kitajs/bench-html-preact';
import ReactJSXRuntimeRenderers from '@kitajs/bench-html-reactjsx';
import StringTemplateRenderers from '@kitajs/bench-html-templates';
import TypedHtmlRenderers from '@kitajs/bench-html-typed-html';
Expand Down Expand Up @@ -52,8 +52,8 @@ function saveHtml(name, code) {
vueIndentScriptAndStyle: false,
tsdoc: true
})
.then((code) => writeFileSync('./samples/' + name + '.html', code))
.then(() => console.log('Saved ' + name + '.html sample file.'))
.then((code) => writeFileSync(`./samples/${name}.html`, code))
.then(() => console.log(`Saved ${name}.html sample file.`))
);
}

Expand Down
6 changes: 3 additions & 3 deletions examples/suspense-server.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import http from 'http';
import { setTimeout } from 'timers/promises';
import Html, { PropsWithChildren } from '../index';
import http from 'node:http';
import { setTimeout } from 'node:timers/promises';
import Html, { type PropsWithChildren } from '../packages/html';
import { Suspense, renderToStream } from '../packages/html/suspense';

async function SleepForMs({ ms, children }: PropsWithChildren<{ ms: number }>) {
Expand Down
2 changes: 1 addition & 1 deletion packages/fastify-html-plugin/test/stream-html.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// This was adapted to work inside a fastify route handler.

import Html, { PropsWithChildren } from '@kitajs/html';
import Html, { type PropsWithChildren } from '@kitajs/html';
import { Suspense, SuspenseScript } from '@kitajs/html/suspense';
import fastify from 'fastify';
import { JSDOM } from 'jsdom';
Expand Down
2 changes: 1 addition & 1 deletion packages/fastify-html-plugin/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FastifyPluginCallback } from 'fastify';
import type { FastifyPluginCallback } from 'fastify';

declare module 'fastify' {
interface FastifyReply {
Expand Down
30 changes: 15 additions & 15 deletions packages/html/hotwire-turbo.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ declare namespace HotwireTurbo {
* @default { end }
* @link {https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView#parameters}
*/
['data-autoscroll-block']?: 'end' | 'start' | 'center' | 'nearest';
'data-autoscroll-block'?: 'end' | 'start' | 'center' | 'nearest';
/**
* Controls the autoscroll behavior
*
* @default { end }
* @link {https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView#parameters}
*/
['data-autoscroll-behavior']?: 'auto' | 'smooth';
'data-autoscroll-behavior'?: 'auto' | 'smooth';
}

interface TurboStreamTag extends JSX.HtmlTag {
Expand All @@ -49,8 +49,8 @@ declare namespace HotwireTurbo {
}

interface Elements {
['turbo-frame']: TurboFrameTag;
['turbo-stream']: TurboStreamTag;
'turbo-frame': TurboFrameTag;
'turbo-stream': TurboStreamTag;
}

/**
Expand All @@ -62,40 +62,40 @@ declare namespace HotwireTurbo {
* False: disables Turbo Drive on links and forms including descendants. Use "true" to
* renable when an ancestor has opted out
*/
['data-turbo']?: 'true' | 'false';
'data-turbo'?: 'true' | 'false';

/** Tracks the element’s HTML and performs a full page reload when it changes */
['data-turbo-track']?: 'reload';
'data-turbo-track'?: 'reload';

/** Identifies the Turbo Frame to navigate. */
['data-turbo-frame']?: string;
'data-turbo-frame'?: string;
/**
* Customizes the Turbo.visit action.
*
* "Replace" will visit a link without pushing a new history entry onto the stack. It
* will discard your current location in the history stack.
*/
['data-turbo-action']?: 'replace' | 'advance';
'data-turbo-action'?: 'replace' | 'advance';
/**
* Persists element between page loads
*
* The element **must** have an id
*
* @link {https://turbo.hotwired.dev/handbook/building#persisting-elements-across-page-loads}
*/
['data-turbo-permanent']?: boolean;
'data-turbo-permanent'?: boolean;
/**
* Removes the element before the document is cached, preventing it from reappearing
* when restored.
*/
['data-turbo-temporary']?: boolean;
'data-turbo-temporary'?: boolean;
/** Prevents inline scripts from being re-evaluated on Visits. */
['data-turbo-eval']?: 'false';
'data-turbo-eval'?: 'false';
/**
* Changes the request link method from the default "GET" request You should prefer a
* form in most cases
*/
['data-turbo-method']?: string;
'data-turbo-method'?: string;

/**
* Specifies that a link/form can accept a turbo stream response
Expand All @@ -104,12 +104,12 @@ declare namespace HotwireTurbo {
*
* This is useful when trying to request turbo streams on GET requests
*/
['data-turbo-stream']?: boolean;
'data-turbo-stream'?: boolean;
/**
* Presents a confirm dialog with the given value. This can be used on form elements
* or links with the data-turbo-method attribute.
*/
['data-turbo-confirm']?: string;
'data-turbo-confirm'?: string;
/**
* Specifies text to display when submitting a form. Can be used on input or button
* elements. While the form is submitting, the text of the element will show with this
Expand All @@ -119,6 +119,6 @@ declare namespace HotwireTurbo {
*
* Useful for feedback like "Saving..." while an operation is in progress
*/
['data-turbo-submits-with']?: string;
'data-turbo-submits-with'?: string;
}
}
Loading

0 comments on commit fbcb4e8

Please sign in to comment.