Skip to content

Commit

Permalink
eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi1520 committed Dec 7, 2021
1 parent ec60040 commit caec181
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 62 deletions.
14 changes: 6 additions & 8 deletions server/middleware/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { Request, Response, NextFunction } from 'express'
import { Request, Response, NextFunction } from 'express';

export async function errorHandler(
err: {
statusCode: number
message: string
statusCode: number;
message: string;
},
req: Request,
res: Response,

// eslint-disable-next-line @typescript-eslint/no-unused-vars
next: NextFunction
): Promise<any> {
const defaultErr = {
message: 'Express error handler caught unknown middleware',
statusCode: 500,
}
const { statusCode, message } = { ...defaultErr, ...err }
};
const { statusCode, message } = { ...defaultErr, ...err };
res.status(statusCode).json({
message,
})
});
}
2 changes: 1 addition & 1 deletion src/components/Banner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function Banner({}: Props): ReactElement {
</div>
<div className="relative flex flex-col items-end justify-center w-full h-full lg:w-1/2 ms:pl-10">
<div className="container w-full max-w-4xl">
<Image src={mockup} className="w-full h-auto lg:mt-10" />
<Image src={mockup} alt="" className="w-full h-auto lg:mt-10" />
</div>
</div>
</div>
Expand Down
36 changes: 18 additions & 18 deletions src/components/Layout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react'
import React, { ReactElement } from 'react';
import Link from 'next/link';

interface Props {}

Expand All @@ -7,22 +8,21 @@ export default function Footer({}: Props): ReactElement {
<footer className="px-4 pt-12 pb-8 text-white bg-white border-t border-gray-200">
<div className="container flex flex-col justify-between max-w-6xl px-4 mx-auto overflow-hidden lg:flex-row">
<div className="w-full pl-12 mr-4 text-left lg:w-1/4 sm:text-center sm:pl-0 lg:text-left">
<a
href="/"
className="flex justify-start text-left sm:text-center lg:text-left sm:justify-center lg:justify-start"
>
<span className="flex items-start sm:items-center">
<svg
className="w-auto h-6 text-gray-800 fill-current"
viewBox="0 0 194 116"
>
<g fillRule="evenodd">
<path d="M96.869 0L30 116h104l-9.88-17.134H59.64l47.109-81.736zM0 116h19.831L77 17.135 67.088 0z"></path>
<path d="M87 68.732l9.926 17.143 29.893-51.59L174.15 116H194L126.817 0z"></path>
</g>
</svg>
</span>
</a>
<Link href="/">
<a className="flex justify-start text-left sm:text-center lg:text-left sm:justify-center lg:justify-start">
<span className="flex items-start sm:items-center">
<svg
className="w-auto h-6 text-gray-800 fill-current"
viewBox="0 0 194 116"
>
<g fillRule="evenodd">
<path d="M96.869 0L30 116h104l-9.88-17.134H59.64l47.109-81.736zM0 116h19.831L77 17.135 67.088 0z"></path>
<path d="M87 68.732l9.926 17.143 29.893-51.59L174.15 116H194L126.817 0z"></path>
</g>
</svg>
</span>
</a>
</Link>
<p className="mt-6 mr-4 text-base text-gray-500">触手可及 创建应用</p>
</div>
<div className="block w-full pl-10 mt-6 text-sm lg:w-3/4 sm:flex lg:mt-0">
Expand Down Expand Up @@ -148,5 +148,5 @@ export default function Footer({}: Props): ReactElement {
© 2020 Low Code Generator. All rights reserved.
</div>
</footer>
)
);
}
47 changes: 24 additions & 23 deletions src/components/editor/Right/fields/TableColumns.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import React from 'react'
import React from 'react';

interface Column {
dataIndex: string
title: string
dataIndex: string;
title: string;
}

interface Props {
value: Column[]
onChange: (v: Column[]) => void
value: Column[];
onChange: (v: Column[]) => void;
}

interface ItemProps {
index: number
option: Column
onChange: (v: Column, i: number) => void
onRemove: (i: number) => void
index: number;
option: Column;
onChange: (v: Column, i: number) => void;
onRemove: (i: number) => void;
}

function OptionItemEditor({ option, onChange, onRemove, index }: ItemProps) {
Expand All @@ -25,8 +25,8 @@ function OptionItemEditor({ option, onChange, onRemove, index }: ItemProps) {
[e.target.name]: e.target.value,
},
index
)
}
);
};
return (
<div className="space-y-1 flex items-center">
<div className="flex-1 flex items-center">
Expand Down Expand Up @@ -64,33 +64,34 @@ function OptionItemEditor({ option, onChange, onRemove, index }: ItemProps) {
</svg>
</div>
</div>
)
);
}

export default function OptionEditor({ value, onChange }: Props) {
const handleChange = (option: Column, index: number) => {
const newValue = [...value]
newValue[index] = option
onChange(newValue)
}
const newValue = [...value];
newValue[index] = option;
onChange(newValue);
};
const handleAdd = () => {
onChange([
...value,
{
dataIndex: '',
title: '',
},
])
}
]);
};
const handleRemove = (index: number) => {
const newValue = [...value]
newValue.splice(index, 1)
onChange(newValue)
}
const newValue = [...value];
newValue.splice(index, 1);
onChange(newValue);
};
return (
<div className="space-y-2">
{value.map((option, i) => (
<OptionItemEditor
key={i}
index={i}
onChange={handleChange}
onRemove={handleRemove}
Expand All @@ -101,5 +102,5 @@ export default function OptionEditor({ value, onChange }: Props) {
Add
</button>
</div>
)
);
}
4 changes: 2 additions & 2 deletions src/components/editor/Right/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactNode } from 'react';
import { traverse } from '../../../utils';
import { fields } from './fields';
import editFields from '../schema/edit';
Expand Down Expand Up @@ -50,7 +50,7 @@ export default function Right() {
/>
);
}
const Field = fields[type];
const Field = fields[type] as any;
return (
<Field
{...other}
Expand Down
12 changes: 7 additions & 5 deletions src/components/editor/schema/edit/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import basic from './basic'
import antd from './antd'
import components from './components'
import basic from './basic';
import antd from './antd';
import components from './components';

export default {
const data = {
...basic,
...antd,
...components,
}
};

export default data;
11 changes: 6 additions & 5 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import Image from 'next/image';
import Banner from '../components/Banner';
import { getLayout } from '../components/Layout';

Expand Down Expand Up @@ -382,7 +383,7 @@ function Home({}: Props): ReactElement {
<path d="M30.7 42c0 6.1 12.6 7 12.6 22 0 11-7.9 19.2-18.9 19.2C12.7 83.1 5 72.6 5 61.5c0-19.2 18-44.6 29.2-44.6 2.8 0 7.9 2 7.9 5.4S30.7 31.6 30.7 42zM82.4 42c0 6.1 12.6 7 12.6 22 0 11-7.9 19.2-18.9 19.2-11.8 0-19.5-10.5-19.5-21.6 0-19.2 18-44.6 29.2-44.6 2.8 0 7.9 2 7.9 5.4S82.4 31.6 82.4 42z"></path>
</svg>
<p className="mt-2 text-base text-gray-600">
I'm loving these function! Very nice features and
I am loving these function! Very nice features and
layouts.
</p>
</div>
Expand All @@ -395,7 +396,7 @@ function Home({}: Props): ReactElement {
</h3>
<p className="mt-1 text-sm leading-5 text-gray-500 truncate"></p>
</div>
<img
<Image
className="flex-shrink-0 object-cover w-24 h-24 mb-5 bg-gray-300 rounded-full md:mb-0"
src="https://images.unsplash.com/photo-1544725176-7c40e5a71c5e?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=2694&amp;q=80"
alt=""
Expand Down Expand Up @@ -423,7 +424,7 @@ function Home({}: Props): ReactElement {
</h3>
<p className="mt-1 text-sm leading-5 text-gray-500 truncate"></p>
</div>
<img
<Image
className="flex-shrink-0 object-cover w-24 h-24 mb-5 bg-gray-300 rounded-full md:mb-0"
src="https://images.unsplash.com/photo-1546820389-44d77e1f3b31?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=1400&amp;q=80"
alt=""
Expand Down Expand Up @@ -454,7 +455,7 @@ function Home({}: Props): ReactElement {
</h3>
<p className="mt-1 text-sm leading-5 text-gray-500 truncate"></p>
</div>
<img
<Image
className="flex-shrink-0 object-cover w-24 h-24 mb-5 bg-gray-300 rounded-full md:mb-0"
src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=1700&amp;q=80"
alt=""
Expand Down Expand Up @@ -483,7 +484,7 @@ function Home({}: Props): ReactElement {
</h3>
<p className="mt-1 text-sm leading-5 text-gray-500 truncate"></p>
</div>
<img
<Image
className="flex-shrink-0 object-cover w-24 h-24 mb-5 bg-gray-300 rounded-full md:mb-0"
src="https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=2700&amp;q=80"
alt=""
Expand Down

1 comment on commit caec181

@vercel
Copy link

@vercel vercel bot commented on caec181 Dec 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.