Eslint fix
Summary: Try to fix eslint issues Reviewers: #reviewers Subscribers: jenkins-user Differential Revision: https://hub.sealcode.org/D1426
This commit is contained in:
parent
2df0203148
commit
15c6edf0a7
@ -4,10 +4,8 @@ module.exports = {
|
|||||||
plugins: ["@typescript-eslint", "prettier"],
|
plugins: ["@typescript-eslint", "prettier"],
|
||||||
extends: [
|
extends: [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
// disabled due to https://github.com/typescript-eslint/typescript-eslint/issues/8804
|
"plugin:@typescript-eslint/recommended",
|
||||||
// "plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||||
// disabled due to https://github.com/typescript-eslint/typescript-eslint/issues/8804
|
|
||||||
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
||||||
"plugin:prettier/recommended",
|
"plugin:prettier/recommended",
|
||||||
],
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
@ -15,17 +13,20 @@ module.exports = {
|
|||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
modules: true,
|
modules: true,
|
||||||
},
|
},
|
||||||
// disabled due to https://github.com/typescript-eslint/typescript-eslint/issues/8804
|
project: "./tsconfig-back.json",
|
||||||
//project: ["./tsconfig.json", "./tsconfig-back.json"],
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"@typescript-eslint/no-unused-vars": [2, { varsIgnorePattern: "TempstreamJSX" }],
|
"@typescript-eslint/no-unused-vars": [2, { varsIgnorePattern: "TempstreamJSX" }],
|
||||||
"no-unused-vars": [2, { varsIgnorePattern: "TempstreamJSX" }],
|
"no-unused-vars": 0,
|
||||||
"@typescript-eslint/require-await": 0,
|
"@typescript-eslint/require-await": 0,
|
||||||
/* "jsdoc/require-description": 2, */
|
/* "jsdoc/require-description": 2, */
|
||||||
"no-await-in-loop": 2,
|
"no-await-in-loop": 2,
|
||||||
"@typescript-eslint/consistent-type-assertions": [1, { assertionStyle: "never" }],
|
"@typescript-eslint/consistent-type-assertions": [1, { assertionStyle: "never" }],
|
||||||
"no-console": [1, { allow: ["error"] }],
|
"no-console": [1, { allow: ["error"] }],
|
||||||
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
|
2,
|
||||||
|
{ disallowTypeAnnotations: false },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
ignorePatterns: ["dist/*", "public/dist/*", "coverage/*", "webhint/*"],
|
ignorePatterns: ["dist/*", "public/dist/*", "coverage/*", "webhint/*"],
|
||||||
settings: { jsdoc: { mode: "typescript" } },
|
settings: { jsdoc: { mode: "typescript" } },
|
||||||
@ -42,8 +43,11 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["*.stimulus.ts", "src/front/*.ts"],
|
files: ["*.stimulus.ts", "src/front/*.ts", "src/front/**/*.ts"],
|
||||||
env: { browser: true },
|
env: { browser: true },
|
||||||
|
parserOptions: {
|
||||||
|
project: "./tsconfig-front.json",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -21,7 +21,7 @@
|
|||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
"get-port": "^7.0.0",
|
"get-port": "^7.0.0",
|
||||||
"js-convert-case": "^4.2.0",
|
"js-convert-case": "^4.2.0",
|
||||||
"koa-responsive-image-router": "^0.2.23",
|
"koa-responsive-image-router": "^0.2.24",
|
||||||
"locreq": "^3.0.0",
|
"locreq": "^3.0.0",
|
||||||
"multiple-scripts-tmux": "^1.0.4",
|
"multiple-scripts-tmux": "^1.0.4",
|
||||||
"nodemon": "^3.0.1",
|
"nodemon": "^3.0.1",
|
||||||
@ -5592,9 +5592,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/koa-responsive-image-router": {
|
"node_modules/koa-responsive-image-router": {
|
||||||
"version": "0.2.23",
|
"version": "0.2.24",
|
||||||
"resolved": "https://registry.npmjs.org/koa-responsive-image-router/-/koa-responsive-image-router-0.2.23.tgz",
|
"resolved": "https://registry.npmjs.org/koa-responsive-image-router/-/koa-responsive-image-router-0.2.24.tgz",
|
||||||
"integrity": "sha512-Zf7tBKx6c4BMcCE9/ubk5c+zzHB3hvrVFafH3F75Arfu2VjAvFcuwfSjWOWbfgkD5Fu69og603sxTUeJ2Jfbvw==",
|
"integrity": "sha512-dHKBCu+hQ+v/60iyxy0qBJ4GlbF0h0RDj+qwiGSPxnexMDtGVidgOMp+pPAryeJ4A6vUJwzSm0DhExrqWFe3hw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@koa/router": "^10.0.0",
|
"@koa/router": "^10.0.0",
|
||||||
"@sealcode/ts-predicates": "^0.5.3",
|
"@sealcode/ts-predicates": "^0.5.3",
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
"get-port": "^7.0.0",
|
"get-port": "^7.0.0",
|
||||||
"js-convert-case": "^4.2.0",
|
"js-convert-case": "^4.2.0",
|
||||||
"koa-responsive-image-router": "^0.2.23",
|
"koa-responsive-image-router": "^0.2.24",
|
||||||
"locreq": "^3.0.0",
|
"locreq": "^3.0.0",
|
||||||
"multiple-scripts-tmux": "^1.0.4",
|
"multiple-scripts-tmux": "^1.0.4",
|
||||||
"nodemon": "^3.0.1",
|
"nodemon": "^3.0.1",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import _locreq from "locreq";
|
import _locreq from "locreq";
|
||||||
import { App, LoggerMailer, SMTPMailer, Context as SealiousContext } from "sealious";
|
import type { Context as SealiousContext } from "sealious";
|
||||||
|
import { App, LoggerMailer, SMTPMailer } from "sealious";
|
||||||
import type { LoggerLevel } from "sealious/@types/src/app/logger.js";
|
import type { LoggerLevel } from "sealious/@types/src/app/logger.js";
|
||||||
import { collections } from "./collections/collections.js";
|
import { collections } from "./collections/collections.js";
|
||||||
import {
|
import {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import TheApp from "../app.js";
|
import type TheApp from "../app.js";
|
||||||
import { withProdApp } from "../test_utils/with-prod-app.js";
|
import { withProdApp } from "../test_utils/with-prod-app.js";
|
||||||
import { LONG_TEST_TIMEOUT } from "../test_utils/webhint.js";
|
import { LONG_TEST_TIMEOUT } from "../test_utils/webhint.js";
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { App, Collection, CollectionItem, Context, FieldTypes, Policies } from "sealious";
|
import type { App, CollectionItem, Context } from "sealious";
|
||||||
|
import { Collection, FieldTypes, Policies } from "sealious";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import PasswordResetTemplate from "../email-templates/password-reset.js";
|
import PasswordResetTemplate from "../email-templates/password-reset.js";
|
||||||
import TheApp from "../app.js";
|
import TheApp from "../app.js";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { App, Collection, FieldTypes, Policies, Policy } from "sealious";
|
import type { App, Policy } from "sealious";
|
||||||
|
import { Collection, FieldTypes, Policies } from "sealious";
|
||||||
import { Roles } from "../policy-types/roles.js";
|
import { Roles } from "../policy-types/roles.js";
|
||||||
|
|
||||||
export default class UserRoles extends Collection {
|
export default class UserRoles extends Collection {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { App, Collections, Context, FieldTypes, Policies } from "sealious";
|
import type { Context } from "sealious";
|
||||||
|
import { App, Collections, FieldTypes, Policies } from "sealious";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import TheApp from "../app.js";
|
import TheApp from "../app.js";
|
||||||
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { EmailTemplates, Errors } from "sealious";
|
import { EmailTemplates, Errors } from "sealious";
|
||||||
import TheApp from "../app.js";
|
import type TheApp from "../app.js";
|
||||||
|
|
||||||
export default async function PasswordResetTemplate(
|
export default async function PasswordResetTemplate(
|
||||||
app: TheApp,
|
app: TheApp,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { App, EmailTemplates } from "sealious";
|
import type { App } from "sealious";
|
||||||
|
import { EmailTemplates } from "sealious";
|
||||||
|
|
||||||
export default async function RegistrationIntentTemplate(
|
export default async function RegistrationIntentTemplate(
|
||||||
app: App,
|
app: App,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { FlatTemplatable, Templatable, tempstream } from "tempstream";
|
import type { FlatTemplatable, Templatable } from "tempstream";
|
||||||
import { Readable } from "stream";
|
import { tempstream } from "tempstream";
|
||||||
import { BaseContext } from "koa";
|
import type { Readable } from "stream";
|
||||||
|
import type { BaseContext } from "koa";
|
||||||
import { toKebabCase } from "js-convert-case";
|
import { toKebabCase } from "js-convert-case";
|
||||||
import { DEFAULT_HTML_LANG } from "./config.js";
|
import { DEFAULT_HTML_LANG } from "./config.js";
|
||||||
import { default_navbar } from "./routes/common/navbar.js";
|
import { default_navbar } from "./routes/common/navbar.js";
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import arrow from "./autoscrolling-images-arrow.svg";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
|
import { TempstreamJSX } from "tempstream";
|
||||||
import { FlatTemplatable, TempstreamJSX } from "tempstream";
|
import type {
|
||||||
import {
|
|
||||||
Component,
|
|
||||||
ComponentArguments,
|
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsValues,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
|
|
||||||
|
import arrow from "./autoscrolling-images-arrow.svg";
|
||||||
|
|
||||||
const component_arguments = {
|
const component_arguments = {
|
||||||
title: new ComponentArguments.ShortText(),
|
title: new ComponentArguments.ShortText(),
|
||||||
@ -35,7 +35,7 @@ export class AutoscrollingImages extends Component<typeof component_arguments> {
|
|||||||
{ render_image }: JDDContext
|
{ render_image }: JDDContext
|
||||||
): FlatTemplatable {
|
): FlatTemplatable {
|
||||||
const imageNumberPerPage = parseInt(imagesPerPage);
|
const imageNumberPerPage = parseInt(imagesPerPage);
|
||||||
let parsedImagesArray = [];
|
const parsedImagesArray = [];
|
||||||
|
|
||||||
for (let i = 0; i < images.length; i += imageNumberPerPage) {
|
for (let i = 0; i < images.length; i += imageNumberPerPage) {
|
||||||
parsedImagesArray.push(images.slice(i, i + imageNumberPerPage));
|
parsedImagesArray.push(images.slice(i, i + imageNumberPerPage));
|
||||||
@ -149,7 +149,7 @@ export class AutoscrollingImages extends Component<typeof component_arguments> {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="autoscrolling-images__dots-container">
|
<div class="autoscrolling-images__dots-container">
|
||||||
{parsedImagesArray.map((pageIndex) => (
|
{parsedImagesArray.map((_, pageIndex) => (
|
||||||
<label
|
<label
|
||||||
for={`${radioButtonIdPrefix}-autoscrolling-images__radio-${pageIndex}`}
|
for={`${radioButtonIdPrefix}-autoscrolling-images__radio-${pageIndex}`}
|
||||||
class="autoscrolling-images__dots"
|
class="autoscrolling-images__dots"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { FlatTemplatable, TempstreamJSX } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import {
|
import { TempstreamJSX } from "tempstream";
|
||||||
Component,
|
import type {
|
||||||
ComponentArguments,
|
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsValues,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
|
|
||||||
const component_arguments = {
|
const component_arguments = {
|
||||||
title: new ComponentArguments.ShortText(),
|
title: new ComponentArguments.ShortText(),
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { FlatTemplatable, TempstreamJSX } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import {
|
import { TempstreamJSX } from "tempstream";
|
||||||
Component,
|
import type {
|
||||||
ComponentArguments,
|
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsValues,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
|
|
||||||
const component_arguments = {
|
const component_arguments = {
|
||||||
image_with_alt: new ComponentArguments.Structured({
|
image_with_alt: new ComponentArguments.Structured({
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { FlatTemplatable, TempstreamJSX } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import {
|
import { TempstreamJSX } from "tempstream";
|
||||||
Component,
|
import type { ExtractStructuredComponentArgumentsValues } from "@sealcode/jdd";
|
||||||
ComponentArguments,
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
ExtractStructuredComponentArgumentsValues,
|
|
||||||
} from "@sealcode/jdd";
|
|
||||||
|
|
||||||
const coordinates = new ComponentArguments.ShortText();
|
const coordinates = new ComponentArguments.ShortText();
|
||||||
coordinates.setExampleValues([
|
coordinates.setExampleValues([
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import {
|
import type {
|
||||||
Component,
|
|
||||||
ComponentArguments,
|
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsValues,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
import { Readable } from "stream";
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
|
import type { Readable } from "stream";
|
||||||
|
|
||||||
const component_arguments = {
|
const component_arguments = {
|
||||||
title: new ComponentArguments.ShortText(),
|
title: new ComponentArguments.ShortText(),
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { FlatTemplatable, TempstreamJSX } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import {
|
import { TempstreamJSX } from "tempstream";
|
||||||
Component,
|
import type { ExtractStructuredComponentArgumentsValues } from "@sealcode/jdd";
|
||||||
ComponentArguments,
|
import { Component, ComponentArguments, isTableHeader } from "@sealcode/jdd";
|
||||||
ExtractStructuredComponentArgumentsValues,
|
|
||||||
isTableHeader,
|
|
||||||
JDDContext,
|
|
||||||
} from "@sealcode/jdd";
|
|
||||||
|
|
||||||
const component_arguments = {
|
const component_arguments = {
|
||||||
table: new ComponentArguments.Table(
|
table: new ComponentArguments.Table(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Context, Policy, QueryTypes } from "sealious";
|
import type { Context } from "sealious";
|
||||||
|
import { Policy, QueryTypes } from "sealious";
|
||||||
|
|
||||||
export class Roles extends Policy {
|
export class Roles extends Policy {
|
||||||
static type_name = "roles";
|
static type_name = "roles";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import html from "../../html.js";
|
import html from "../../html.js";
|
||||||
import { BaseContext } from "koa";
|
import type { BaseContext } from "koa";
|
||||||
import { Readable } from "stream";
|
import type { Readable } from "stream";
|
||||||
import { tempstream } from "tempstream";
|
import { tempstream } from "tempstream";
|
||||||
|
|
||||||
export function MainView(ctx: BaseContext): Readable {
|
export function MainView(ctx: BaseContext): Readable {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { BaseContext } from "koa";
|
import type { BaseContext } from "koa";
|
||||||
import { FlatTemplatable } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import { SignUpURL, SignInURL, TodoURL, LogoutURL } from "../urls.js";
|
import { SignUpURL, SignInURL, TodoURL, LogoutURL } from "../urls.js";
|
||||||
|
|
||||||
export async function default_navbar(ctx: BaseContext): Promise<FlatTemplatable> {
|
export async function default_navbar(ctx: BaseContext): Promise<FlatTemplatable> {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { BaseContext } from "koa";
|
import type { BaseContext } from "koa";
|
||||||
import { CollectionItem } from "sealious";
|
import type { CollectionItem } from "sealious";
|
||||||
import frame from "../../frame.js";
|
import frame from "../../frame.js";
|
||||||
import { Tasks } from "../../collections/collections.js";
|
import type { Tasks } from "../../collections/collections.js";
|
||||||
|
|
||||||
export function Task(task: CollectionItem<typeof Tasks>) {
|
export function Task(task: CollectionItem<typeof Tasks>) {
|
||||||
const title = task.get("title");
|
const title = task.get("title");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Enum } from "@sealcode/jdd";
|
import type { Enum } from "@sealcode/jdd";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import { printArgPath } from "./print-arg-path.js";
|
import { printArgPath } from "./print-arg-path.js";
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { Image } from "@sealcode/jdd";
|
import type { Image } from "@sealcode/jdd";
|
||||||
import { StatefulPage } from "@sealcode/sealgen";
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { jdd_context } from "../jdd-context.js";
|
import { jdd_context } from "../jdd-context.js";
|
||||||
import { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
import { printArgPath } from "./print-arg-path.js";
|
import { printArgPath } from "./print-arg-path.js";
|
||||||
|
|
||||||
export function ComponentInputImage<State extends ComponentPreviewState>({
|
export function ComponentInputImage<State extends ComponentPreviewState>({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ComponentArgument, List } from "@sealcode/jdd";
|
import type { List } from "@sealcode/jdd";
|
||||||
import { StatefulPage } from "@sealcode/sealgen";
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { jdd_context } from "../jdd-context.js";
|
import { jdd_context } from "../jdd-context.js";
|
||||||
import { ComponentInput } from "./component-input.js";
|
import { ComponentInput } from "./component-input.js";
|
||||||
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { ComponentArgument, Structured } from "@sealcode/jdd";
|
import type { ComponentArgument, Structured } from "@sealcode/jdd";
|
||||||
import { StatefulPage } from "@sealcode/sealgen";
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { ComponentInput } from "./component-input.js";
|
import { ComponentInput } from "./component-input.js";
|
||||||
import { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
|
|
||||||
export function ComponentInputStructured<
|
export function ComponentInputStructured<
|
||||||
T extends Structured<Record<string, ComponentArgument<unknown>>>
|
T extends Structured<Record<string, ComponentArgument<unknown>>>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { ComponentArgument, isTableHeader, List, Table, TableData } from "@sealcode/jdd";
|
import type { Table, TableData } from "@sealcode/jdd";
|
||||||
import { StatefulPage } from "@sealcode/sealgen";
|
import { isTableHeader } from "@sealcode/jdd";
|
||||||
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { jdd_context } from "../jdd-context.js";
|
import { jdd_context } from "../jdd-context.js";
|
||||||
import { ComponentInput } from "./component-input.js";
|
import { ComponentInput } from "./component-input.js";
|
||||||
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
import { ComponentArguments, Enum, Image, List, Structured, Table, TableData } from "@sealcode/jdd";
|
import type { TableData } from "@sealcode/jdd";
|
||||||
import { ComponentArgument } from "@sealcode/jdd";
|
import { ComponentArguments, Enum, Image, List, Structured, Table } from "@sealcode/jdd";
|
||||||
import { StatefulPage } from "@sealcode/sealgen";
|
import type { ComponentArgument } from "@sealcode/jdd";
|
||||||
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { ComponentInputEnum } from "./component-input-enum.js";
|
import { ComponentInputEnum } from "./component-input-enum.js";
|
||||||
import { ComponentInputImage } from "./component-input-image.js";
|
import { ComponentInputImage } from "./component-input-image.js";
|
||||||
import { ComponentInputList } from "./component-input-list.js";
|
import { ComponentInputList } from "./component-input-list.js";
|
||||||
import { ComponentInputStructured } from "./component-input-structured.js";
|
import { ComponentInputStructured } from "./component-input-structured.js";
|
||||||
import { ComponentInputTable } from "./component-input-table.js";
|
import { ComponentInputTable } from "./component-input-table.js";
|
||||||
import { printArgPath } from "./print-arg-path.js";
|
import { printArgPath } from "./print-arg-path.js";
|
||||||
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
|
import { is, predicates } from "@sealcode/ts-predicates";
|
||||||
|
|
||||||
export const actionName = "Components";
|
export const actionName = "Components";
|
||||||
const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
|
const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
|
||||||
@ -24,19 +27,19 @@ export function ComponentInput<State extends ComponentPreviewState, T>({
|
|||||||
arg_path: string[];
|
arg_path: string[];
|
||||||
arg: ComponentArgument<T>;
|
arg: ComponentArgument<T>;
|
||||||
value: T;
|
value: T;
|
||||||
page: StatefulPage<any, any>;
|
page: StatefulPage<ComponentPreviewState, typeof ComponentPreviewActions>;
|
||||||
}) {
|
}) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
value = arg.getEmptyValue();
|
value = arg.getEmptyValue();
|
||||||
}
|
}
|
||||||
if (arg instanceof List) {
|
if (arg instanceof List) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
return ComponentInputList({ state, arg_path, arg, value: value as T[], page });
|
return ComponentInputList({ state, arg_path, arg, value: value as T[], page });
|
||||||
}
|
}
|
||||||
|
|
||||||
const argType = arg.getTypeName();
|
const argType = arg.getTypeName();
|
||||||
const isUrlAbsolute =
|
const isUrlAbsolute =
|
||||||
arg instanceof ComponentArguments.URL &&
|
arg instanceof ComponentArguments.URL && arg.urlType === "absolute";
|
||||||
arg.urlType === "absolute";
|
|
||||||
const inputType = isUrlAbsolute ? "url" : "text";
|
const inputType = isUrlAbsolute ? "url" : "text";
|
||||||
|
|
||||||
if (arg instanceof Structured) {
|
if (arg instanceof Structured) {
|
||||||
@ -44,6 +47,7 @@ export function ComponentInput<State extends ComponentPreviewState, T>({
|
|||||||
state,
|
state,
|
||||||
arg_path,
|
arg_path,
|
||||||
arg,
|
arg,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
value: value as Record<string, unknown>,
|
value: value as Record<string, unknown>,
|
||||||
page,
|
page,
|
||||||
});
|
});
|
||||||
@ -54,6 +58,7 @@ export function ComponentInput<State extends ComponentPreviewState, T>({
|
|||||||
state,
|
state,
|
||||||
arg_path,
|
arg_path,
|
||||||
arg,
|
arg,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
value: value as string,
|
value: value as string,
|
||||||
onchange: page.rerender(),
|
onchange: page.rerender(),
|
||||||
});
|
});
|
||||||
@ -64,6 +69,7 @@ export function ComponentInput<State extends ComponentPreviewState, T>({
|
|||||||
state,
|
state,
|
||||||
arg_path,
|
arg_path,
|
||||||
arg,
|
arg,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
value: value as string,
|
value: value as string,
|
||||||
page,
|
page,
|
||||||
});
|
});
|
||||||
@ -74,6 +80,7 @@ export function ComponentInput<State extends ComponentPreviewState, T>({
|
|||||||
state,
|
state,
|
||||||
arg_path,
|
arg_path,
|
||||||
arg,
|
arg,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
value: value as TableData<unknown, unknown>,
|
value: value as TableData<unknown, unknown>,
|
||||||
page,
|
page,
|
||||||
});
|
});
|
||||||
@ -89,13 +96,13 @@ export function ComponentInput<State extends ComponentPreviewState, T>({
|
|||||||
onblur={page.rerender()}
|
onblur={page.rerender()}
|
||||||
cols="40"
|
cols="40"
|
||||||
>
|
>
|
||||||
{value as string}
|
{is(value, predicates.string) ? value : ""}
|
||||||
</textarea>
|
</textarea>
|
||||||
) : (
|
) : (
|
||||||
<input
|
<input
|
||||||
type={inputType}
|
type={inputType}
|
||||||
name={`$.component_args${printArgPath(arg_path)}`}
|
name={`$.component_args${printArgPath(arg_path)}`}
|
||||||
value={value as string}
|
value={is(value, predicates.string) ? value : ""}
|
||||||
size="40"
|
size="40"
|
||||||
pattern={isUrlAbsolute ? absoluteUrlPattern : undefined}
|
pattern={isUrlAbsolute ? absoluteUrlPattern : undefined}
|
||||||
/>
|
/>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { isTableData, isTableRegularRow, TableData } from "@sealcode/jdd";
|
import type { TableData } from "@sealcode/jdd";
|
||||||
|
import { isTableData, isTableRegularRow } from "@sealcode/jdd";
|
||||||
import objectPath from "object-path";
|
import objectPath from "object-path";
|
||||||
import { registry } from "../../jdd-components/components.js";
|
import { registry } from "../../jdd-components/components.js";
|
||||||
import type { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
@ -22,6 +23,7 @@ export const ComponentPreviewActions = <const>{
|
|||||||
component_args,
|
component_args,
|
||||||
arg_path,
|
arg_path,
|
||||||
empty_value,
|
empty_value,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
((objectPath.get(component_args, arg_path) as unknown[]) || []).length
|
((objectPath.get(component_args, arg_path) as unknown[]) || []).length
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
@ -88,6 +90,7 @@ export const ComponentPreviewActions = <const>{
|
|||||||
component_args,
|
component_args,
|
||||||
[...arg_path, "rows"],
|
[...arg_path, "rows"],
|
||||||
row,
|
row,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
((objectPath.get(component_args, [...arg_path, "rows"]) as unknown[]) || [])
|
((objectPath.get(component_args, [...arg_path, "rows"]) as unknown[]) || [])
|
||||||
.length
|
.length
|
||||||
);
|
);
|
||||||
@ -175,6 +178,7 @@ export const ComponentPreviewActions = <const>{
|
|||||||
column_index: number
|
column_index: number
|
||||||
) => {
|
) => {
|
||||||
const component_args = state.component_args;
|
const component_args = state.component_args;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
const data = objectPath.get(component_args, arg_path) as TableData<
|
const data = objectPath.get(component_args, arg_path) as TableData<
|
||||||
unknown,
|
unknown,
|
||||||
unknown
|
unknown
|
||||||
@ -199,6 +203,7 @@ export const ComponentPreviewActions = <const>{
|
|||||||
row_index: number
|
row_index: number
|
||||||
) => {
|
) => {
|
||||||
const component_args = state.component_args;
|
const component_args = state.component_args;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
const data = objectPath.get(component_args, arg_path) as TableData<
|
const data = objectPath.get(component_args, arg_path) as TableData<
|
||||||
unknown,
|
unknown,
|
||||||
unknown
|
unknown
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { render, renderEarlyAssets } from "@sealcode/jdd";
|
import { render, renderEarlyAssets } from "@sealcode/jdd";
|
||||||
import { StatefulPage, to_base64 } from "@sealcode/sealgen";
|
import { StatefulPage, to_base64 } from "@sealcode/sealgen";
|
||||||
import { hasShape, predicates } from "@sealcode/ts-predicates";
|
import { hasShape, predicates } from "@sealcode/ts-predicates";
|
||||||
import { BaseContext } from "koa";
|
import type { BaseContext } from "koa";
|
||||||
import { Templatable, tempstream, TempstreamJSX } from "tempstream";
|
import type { Templatable } from "tempstream";
|
||||||
|
import { tempstream, TempstreamJSX } from "tempstream";
|
||||||
import html, { defaultHead } from "../html.js";
|
import html, { defaultHead } from "../html.js";
|
||||||
import { registry } from "../jdd-components/components.js";
|
import { registry } from "../jdd-components/components.js";
|
||||||
import { ComponentInput } from "./component-preview/component-input.js";
|
import { ComponentInput } from "./component-preview/component-input.js";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Context } from "koa";
|
import type { Context } from "koa";
|
||||||
import { tempstream } from "tempstream";
|
import { tempstream } from "tempstream";
|
||||||
import { Page } from "@sealcode/sealgen";
|
import { Page } from "@sealcode/sealgen";
|
||||||
import html from "../html.js";
|
import html from "../html.js";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Router from "@koa/router";
|
import type Router from "@koa/router";
|
||||||
import { Middlewares } from "sealious";
|
import { Middlewares } from "sealious";
|
||||||
import { imageRouter, RESPONSIVE_IMAGES_URL_PATH } from "../image-router.js";
|
import { imageRouter, RESPONSIVE_IMAGES_URL_PATH } from "../image-router.js";
|
||||||
import { MainView } from "./common/main-view.js";
|
import { MainView } from "./common/main-view.js";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { simpleJDDContext, JDDContext } from "@sealcode/jdd";
|
import type { JDDContext } from "@sealcode/jdd";
|
||||||
|
import { simpleJDDContext } from "@sealcode/jdd";
|
||||||
import { imageRouter } from "../image-router.js";
|
import { imageRouter } from "../image-router.js";
|
||||||
|
|
||||||
export const jdd_context: JDDContext = {
|
export const jdd_context: JDDContext = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Context } from "koa";
|
import type { Context } from "koa";
|
||||||
import { Mountable } from "@sealcode/sealgen";
|
import { Mountable } from "@sealcode/sealgen";
|
||||||
import Router from "@koa/router";
|
import type Router from "@koa/router";
|
||||||
|
|
||||||
export const actionName = "Logout";
|
export const actionName = "Logout";
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import assert from "assert";
|
import type { Browser, BrowserContext, Page } from "@playwright/test";
|
||||||
import { Browser, BrowserContext, Page } from "@playwright/test";
|
|
||||||
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
||||||
import { getBrowser } from "../test_utils/browser-creator.js";
|
import { getBrowser } from "../test_utils/browser-creator.js";
|
||||||
import { LONG_TEST_TIMEOUT, VERY_LONG_TEST_TIMEOUT } from "../test_utils/webhint.js";
|
import { LONG_TEST_TIMEOUT } from "../test_utils/webhint.js";
|
||||||
import { withProdApp } from "../test_utils/with-prod-app.js";
|
import { withProdApp } from "../test_utils/with-prod-app.js";
|
||||||
import { LogoutURL, SignInURL } from "./urls.js";
|
import { LogoutURL, SignInURL } from "./urls.js";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// DO NOT EDIT! This file is generated automaticaly with npm run generate-routes
|
// DO NOT EDIT! This file is generated automaticaly with npm run generate-routes
|
||||||
|
|
||||||
import Router from "@koa/router";
|
import type Router from "@koa/router";
|
||||||
import { mount } from "@sealcode/sealgen";
|
import { mount } from "@sealcode/sealgen";
|
||||||
import * as URLs from "./urls.js";
|
import * as URLs from "./urls.js";
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Context } from "koa";
|
import type { Context } from "koa";
|
||||||
import { Form, Fields, Controls, fieldsToShape } from "@sealcode/sealgen";
|
import { Form, Fields, Controls, fieldsToShape } from "@sealcode/sealgen";
|
||||||
import { FlatTemplatable, tempstream } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
|
import { tempstream } from "tempstream";
|
||||||
import { Users } from "../collections/collections.js";
|
import { Users } from "../collections/collections.js";
|
||||||
import html from "../html.js";
|
import html from "../html.js";
|
||||||
import type {
|
import type {
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
import { Context } from "koa";
|
import type { Context } from "koa";
|
||||||
import {
|
import type { FormData, FormDataValue, FormReaction } from "@sealcode/sealgen";
|
||||||
Form,
|
import { Form, Fields, Controls, fieldsToShape } from "@sealcode/sealgen";
|
||||||
FormData,
|
|
||||||
FormDataValue,
|
|
||||||
Fields,
|
|
||||||
Controls,
|
|
||||||
FormReaction,
|
|
||||||
fieldsToShape,
|
|
||||||
} from "@sealcode/sealgen";
|
|
||||||
import { Users } from "../collections/collections.js";
|
import { Users } from "../collections/collections.js";
|
||||||
import html from "../html.js";
|
import html from "../html.js";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Browser, BrowserContext, Page } from "@playwright/test";
|
import type { Browser, BrowserContext, Page } from "@playwright/test";
|
||||||
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
||||||
import { getBrowser } from "../test_utils/browser-creator.js";
|
import { getBrowser } from "../test_utils/browser-creator.js";
|
||||||
import { VERY_LONG_TEST_TIMEOUT, webhintURL } from "../test_utils/webhint.js";
|
import { VERY_LONG_TEST_TIMEOUT, webhintURL } from "../test_utils/webhint.js";
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
import { tempstream } from "tempstream";
|
import { tempstream } from "tempstream";
|
||||||
import { Context } from "koa";
|
import type { Context } from "koa";
|
||||||
import {
|
import type { FormData, FormDataValue } from "@sealcode/sealgen";
|
||||||
Form,
|
import { Form, Fields, Controls, fieldsToShape } from "@sealcode/sealgen";
|
||||||
FormData,
|
|
||||||
FormDataValue,
|
|
||||||
Fields,
|
|
||||||
Controls,
|
|
||||||
fieldsToShape,
|
|
||||||
} from "@sealcode/sealgen";
|
|
||||||
import { Tasks } from "../collections/collections.js";
|
import { Tasks } from "../collections/collections.js";
|
||||||
import html from "../html.js";
|
import html from "../html.js";
|
||||||
import { TaskList } from "./common/tasks-view.js";
|
import { TaskList } from "./common/tasks-view.js";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import { Browser, BrowserContext, Page } from "@playwright/test";
|
import type { Browser, BrowserContext, Page } from "@playwright/test";
|
||||||
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
import ADMIN_CREDENTIALS from "../default-admin-credentials.js";
|
||||||
import { getBrowser } from "../test_utils/browser-creator.js";
|
import { getBrowser } from "../test_utils/browser-creator.js";
|
||||||
import { LONG_TEST_TIMEOUT, VERY_LONG_TEST_TIMEOUT } from "../test_utils/webhint.js";
|
import { LONG_TEST_TIMEOUT, VERY_LONG_TEST_TIMEOUT } from "../test_utils/webhint.js";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Browser, BrowserContext, firefox, Page } from "@playwright/test";
|
import type { Browser, BrowserContext, Page } from "@playwright/test";
|
||||||
|
import { firefox } from "@playwright/test";
|
||||||
|
|
||||||
let browser: Browser;
|
let browser: Browser;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { CollectionItem, TestUtils } from "sealious";
|
import type { CollectionItem, TestUtils } from "sealious";
|
||||||
import TheApp from "../app.js";
|
import type TheApp from "../app.js";
|
||||||
import Users from "../collections/users.js";
|
import type Users from "../collections/users.js";
|
||||||
|
|
||||||
type Unpromisify<T> = T extends Promise<infer R> ? R : T;
|
type Unpromisify<T> = T extends Promise<infer R> ? R : T;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { BaseContext } from "koa";
|
import type { BaseContext } from "koa";
|
||||||
import qs from "qs";
|
import qs from "qs";
|
||||||
import { dirname } from "node:path";
|
import { dirname } from "node:path";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user