chore: update lit & format

pull/6917/head
tangjinzhou 2023-08-30 22:48:17 +08:00
parent deada0aeb8
commit 31d00bf7d1
53 changed files with 81 additions and 65 deletions

View File

@ -8,5 +8,6 @@ lib/
_site/ _site/
dist/ dist/
site/dist/ site/dist/
components/version/version.tsx components/version/version.ts
site/src/router/demoRoutes.js site/src/router/demoRoutes.js
locale/

View File

@ -185,7 +185,7 @@ All rights reserved.
}; };
if (process.env.RUN_ENV === 'PRODUCTION') { if (process.env.RUN_ENV === 'PRODUCTION') {
let entry = ['./index']; const entry = ['./index'];
config.externals = [ config.externals = [
{ {
vue: { vue: {

View File

@ -368,7 +368,7 @@ function pub(done) {
} }
} }
let startTime = new Date(); const startTime = new Date();
gulp.task('compile-with-es', done => { gulp.task('compile-with-es', done => {
console.log('start compile at ', startTime); console.log('start compile at ', startTime);
console.log('[Parallel] Compile to es...'); console.log('[Parallel] Compile to es...');
@ -452,7 +452,7 @@ gulp.task(
newVersion.trim() === version newVersion.trim() === version
) { ) {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
runCmd('npm', ['run', 'pub'], code => { runCmd('npm', ['run', 'pub'], _code => {
done(); done();
}); });
} else { } else {

View File

@ -1,7 +1,7 @@
// Test via a getter in the options object to see if the passive property is accessed // Test via a getter in the options object to see if the passive property is accessed
let supportsPassive = false; let supportsPassive = false;
try { try {
let opts = Object.defineProperty({}, 'passive', { const opts = Object.defineProperty({}, 'passive', {
get() { get() {
supportsPassive = true; supportsPassive = true;
}, },

View File

@ -31,6 +31,8 @@ export interface PropOptions<T = any, D = T> {
} }
declare type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void; declare type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
// eslint-disable-next-line no-undef
export type VueNode = VNodeChildAtom | VNodeChildAtom[] | JSX.Element; export type VueNode = VNodeChildAtom | VNodeChildAtom[] | JSX.Element;
export const withInstall = <T>(comp: T) => { export const withInstall = <T>(comp: T) => {

View File

@ -8,7 +8,7 @@ import DownOutlined from '@ant-design/icons-vue/DownOutlined';
import useConfigInject from '../config-provider/hooks/useConfigInject'; import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { MouseEventHandler } from '../_util/EventInterface'; import type { MouseEventHandler } from '../_util/EventInterface';
import { eventType, objectType } from '../_util/type'; import { eventType, objectType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type'; import type { CustomSlotsType, VueNode } from '../_util/type';
export const breadcrumbItemProps = () => ({ export const breadcrumbItemProps = () => ({
prefixCls: String, prefixCls: String,
@ -38,7 +38,7 @@ export default defineComponent({
* if overlay is have * if overlay is have
* Wrap a Dropdown * Wrap a Dropdown
*/ */
const renderBreadcrumbNode = (breadcrumbItem: JSX.Element, prefixCls: string) => { const renderBreadcrumbNode = (breadcrumbItem: VueNode, prefixCls: string) => {
const overlay = getPropsSlot(slots, props, 'overlay'); const overlay = getPropsSlot(slots, props, 'overlay');
if (overlay) { if (overlay) {
return ( return (
@ -59,7 +59,7 @@ export default defineComponent({
const separator = getPropsSlot(slots, props, 'separator') ?? '/'; const separator = getPropsSlot(slots, props, 'separator') ?? '/';
const children = getPropsSlot(slots, props); const children = getPropsSlot(slots, props);
const { class: cls, style, ...restAttrs } = attrs; const { class: cls, style, ...restAttrs } = attrs;
let link: JSX.Element; let link: VueNode;
if (props.href !== undefined) { if (props.href !== undefined) {
link = ( link = (
<a class={`${prefixCls.value}-link`} onClick={handleClick} {...restAttrs}> <a class={`${prefixCls.value}-link`} onClick={handleClick} {...restAttrs}>

View File

@ -206,7 +206,7 @@ describe('Locale Provider', () => {
return null; return null;
}, },
}; };
for (let locale of locales) { for (const locale of locales) {
document.body.innerHTML = ''; document.body.innerHTML = '';
mount( mount(
{ {

View File

@ -107,7 +107,7 @@ describe('message', () => {
// https:// github.com/ant-design/ant-design/issues/8201 // https:// github.com/ant-design/ant-design/issues/8201
it('should hide message correctly', async () => { it('should hide message correctly', async () => {
let hide = message.loading('Action in progress..', 0); const hide = message.loading('Action in progress..', 0);
await Promise.resolve(); await Promise.resolve();
expect(document.querySelectorAll('.ant-message-notice').length).toBe(1); expect(document.querySelectorAll('.ant-message-notice').length).toBe(1);
hide(); hide();

View File

@ -12,15 +12,15 @@ import destroyFns from '../destroyFns';
let uuid = 0; let uuid = 0;
interface ElementsHolderRef { interface ElementsHolderRef {
addModal: (modal: () => JSX.Element) => () => void; addModal: (modal: () => VueNode) => () => void;
} }
const ElementsHolder = defineComponent({ const ElementsHolder = defineComponent({
name: 'ElementsHolder', name: 'ElementsHolder',
inheritAttrs: false, inheritAttrs: false,
setup(_, { expose }) { setup(_, { expose }) {
const modals = shallowRef<(() => JSX.Element)[]>([]); const modals = shallowRef<(() => VueNode)[]>([]);
const addModal = (modal: () => JSX.Element) => { const addModal = (modal: () => VueNode) => {
modals.value.push(modal); modals.value.push(modal);
modals.value = modals.value.slice(); modals.value = modals.value.slice();
return () => { return () => {

View File

@ -23,7 +23,7 @@ const getMinPercent = (width: number): number => (CIRCLE_MIN_STROKE_WIDTH / widt
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Circle', name: 'ProgressCircle',
inheritAttrs: false, inheritAttrs: false,
props: initDefaultProps(circleProps(), { props: initDefaultProps(circleProps(), {
trailColor: null as unknown as string, trailColor: null as unknown as string,

View File

@ -72,7 +72,7 @@ export const handleGradient = (
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Line', name: 'ProgressLine',
inheritAttrs: false, inheritAttrs: false,
props: lineProps(), props: lineProps(),
setup(props, { slots, attrs }) { setup(props, { slots, attrs }) {

View File

@ -1,4 +1,4 @@
import type { CSSProperties, ExtractPropTypes, PropType, VNode } from 'vue'; import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import initDefaultProps from '../_util/props-util/initDefaultProps'; import initDefaultProps from '../_util/props-util/initDefaultProps';
import StatisticNumber from './Number'; import StatisticNumber from './Number';
@ -9,7 +9,7 @@ import useConfigInject from '../config-provider/hooks/useConfigInject';
// CSSINJS // CSSINJS
import useStyle from './style'; import useStyle from './style';
import { anyType, booleanType, functionType, someType, vNodeType } from '../_util/type'; import { anyType, booleanType, functionType, someType, vNodeType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type'; import type { CustomSlotsType, VueNode } from '../_util/type';
export const statisticProps = () => ({ export const statisticProps = () => ({
prefixCls: String, prefixCls: String,
@ -18,7 +18,7 @@ export const statisticProps = () => ({
format: String, format: String,
value: someType<valueType>([Number, String, Object]), value: someType<valueType>([Number, String, Object]),
valueStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties }, valueStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties },
valueRender: functionType<(node: VNode | JSX.Element) => VNode | JSX.Element>(), valueRender: functionType<(node: VueNode) => VueNode>(),
formatter: anyType<Formatter>(), formatter: anyType<Formatter>(),
precision: Number, precision: Number,
prefix: vNodeType(), prefix: vNodeType(),
@ -60,7 +60,7 @@ export default defineComponent({
const formatter = props.formatter ?? (slots.formatter as unknown as Formatter); const formatter = props.formatter ?? (slots.formatter as unknown as Formatter);
// data-for-update just for update component // data-for-update just for update component
// https://github.com/vueComponent/ant-design-vue/pull/3170 // https://github.com/vueComponent/ant-design-vue/pull/3170
let valueNode = ( let valueNode: VueNode = (
<StatisticNumber <StatisticNumber
data-for-update={Date.now()} data-for-update={Date.now()}
{...{ ...props, prefixCls: pre, value, formatter }} {...{ ...props, prefixCls: pre, value, formatter }}

View File

@ -125,7 +125,7 @@ export const baseProps = () => ({
const Base = defineComponent({ const Base = defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Base', name: 'TypographyBase',
inheritAttrs: false, inheritAttrs: false,
props: baseProps(), props: baseProps(),
// emits: ['update:content'], // emits: ['update:content'],

View File

@ -214,7 +214,7 @@ describe('Typography', () => {
}); });
describe('copyable', () => { describe('copyable', () => {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
function copyTest(name, text, target, icon) { function copyTest(name, text, target, icon) {
it(name, async () => { it(name, async () => {
jest.useFakeTimers(); jest.useFakeTimers();

View File

@ -12,7 +12,7 @@ export type ContentRef = {
}; };
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Content', name: 'DialogContent',
inheritAttrs: false, inheritAttrs: false,
props: { props: {
...dialogPropTypes(), ...dialogPropTypes(),

View File

@ -16,7 +16,7 @@ import { getMotionName, getUUID } from './util';
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Dialog', name: 'VcDialog',
inheritAttrs: false, inheritAttrs: false,
props: initDefaultProps( props: initDefaultProps(
{ {

View File

@ -3,7 +3,7 @@ import Transition, { getTransitionProps } from '../_util/transition';
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Mask', name: 'DialogMask',
props: { props: {
prefixCls: String, prefixCls: String,
visible: Boolean, visible: Boolean,

View File

@ -64,7 +64,7 @@ export const mergeDefaultValue = <T extends object>(obj: T, defaultValues: objec
let uuid = 0; let uuid = 0;
const ImageInternal = defineComponent({ const ImageInternal = defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Image', name: 'VcImage',
inheritAttrs: false, inheritAttrs: false,
props: imageProps(), props: imageProps(),
emits: ['click', 'error'], emits: ['click', 'error'],

View File

@ -616,5 +616,5 @@ function PickerPanel<DateType>() {
}); });
} }
const InterPickerPanel = PickerPanel<any>(); const InterPickerPanel = PickerPanel<any>();
export default <DateType,>(props: MergedPickerPanelProps<DateType>): JSX.Element => export default <DateType,>(props: MergedPickerPanelProps<DateType>) =>
createVNode(InterPickerPanel, props); createVNode(InterPickerPanel, props);

View File

@ -6,7 +6,7 @@ import { propTypes } from './types';
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Line', name: 'ProgressLine',
props: initDefaultProps(propTypes, defaultProps), props: initDefaultProps(propTypes, defaultProps),
setup(props) { setup(props) {
const percentList = computed(() => { const percentList = computed(() => {

View File

@ -28,7 +28,7 @@ import {
watch, watch,
watchEffect, watchEffect,
} from 'vue'; } from 'vue';
import type { CSSProperties, ExtractPropTypes, PropType, VNode } from 'vue'; import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { initDefaultProps, isValidElement } from '../_util/props-util'; import { initDefaultProps, isValidElement } from '../_util/props-util';
import isMobile from '../vc-util/isMobile'; import isMobile from '../vc-util/isMobile';
@ -721,7 +721,7 @@ export default defineComponent({
// ============================= Arrow ============================== // ============================= Arrow ==============================
const mergedShowArrow = const mergedShowArrow =
showArrow !== undefined ? showArrow : loading || (!multiple.value && mode !== 'combobox'); showArrow !== undefined ? showArrow : loading || (!multiple.value && mode !== 'combobox');
let arrowNode: VNode | JSX.Element; let arrowNode: VueNode;
if (mergedShowArrow) { if (mergedShowArrow) {
arrowNode = ( arrowNode = (
@ -742,7 +742,7 @@ export default defineComponent({
} }
// ============================= Clear ============================== // ============================= Clear ==============================
let clearNode: VNode | JSX.Element; let clearNode: VueNode;
const onClearMouseDown: MouseEventHandler = () => { const onClearMouseDown: MouseEventHandler = () => {
onClear?.(); onClear?.();
@ -851,7 +851,7 @@ export default defineComponent({
></SelectTrigger> ></SelectTrigger>
); );
// >>> Render // >>> Render
let renderNode: VNode | JSX.Element; let renderNode: VueNode;
// Render raw // Render raw
if (customizeRawInputElement) { if (customizeRawInputElement) {

View File

@ -164,7 +164,7 @@ function isRawValue(value: DraftValueType): value is RawValueType {
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Select', name: 'VcSelect',
inheritAttrs: false, inheritAttrs: false,
props: initDefaultProps(selectProps(), { props: initDefaultProps(selectProps(), {
prefixCls: 'vc-select', prefixCls: 'vc-select',

View File

@ -42,7 +42,7 @@ export type InputProps = Partial<ExtractPropTypes<typeof inputProps>>;
const Input = defineComponent({ const Input = defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Input', name: 'SelectInput',
inheritAttrs: false, inheritAttrs: false,
props: inputProps, props: inputProps,
setup(props) { setup(props) {

View File

@ -32,7 +32,7 @@ const getSlideClasses = spec => {
} else { } else {
focusedSlide = spec.targetSlide; focusedSlide = spec.targetSlide;
} }
let slickCurrent = index === focusedSlide; const slickCurrent = index === focusedSlide;
return { return {
'slick-slide': true, 'slick-slide': true,
'slick-active': slickActive, 'slick-active': slickActive,

View File

@ -461,7 +461,7 @@ export const swipeEnd = (e, spec) => {
onSwipe(swipeDirection); onSwipe(swipeDirection);
} }
let slideCount, newSlide; let slideCount, newSlide;
let activeSlide = infinite ? currentSlide : targetSlide; const activeSlide = infinite ? currentSlide : targetSlide;
switch (swipeDirection) { switch (swipeDirection) {
case 'left': case 'left':
case 'up': case 'up':

View File

@ -22,7 +22,7 @@ export interface BodyProps<RecordType> {
} }
export default defineComponent<BodyProps<any>>({ export default defineComponent<BodyProps<any>>({
name: 'Body', name: 'TableBody',
props: [ props: [
'data', 'data',
'getRowKey', 'getRowKey',

View File

@ -7,7 +7,7 @@ export interface SummaryProps {
let indexGuid = 0; let indexGuid = 0;
const Summary = defineComponent<SummaryProps>({ const Summary = defineComponent<SummaryProps>({
name: 'Summary', name: 'TableSummary',
props: ['fixed'] as any, props: ['fixed'] as any,
setup(props, { slots }) { setup(props, { slots }) {
const tableContext = useInjectTable(); const tableContext = useInjectTable();

View File

@ -13,7 +13,7 @@ export interface FooterProps<RecordType = DefaultRecordType> {
} }
export default defineComponent<FooterProps>({ export default defineComponent<FooterProps>({
name: 'Footer', name: 'TableFooter',
inheritAttrs: false, inheritAttrs: false,
props: ['stickyOffsets', 'flattenColumns'] as any, props: ['stickyOffsets', 'flattenColumns'] as any,
setup(props, { slots }) { setup(props, { slots }) {

View File

@ -91,7 +91,7 @@ export interface HeaderProps<RecordType = DefaultRecordType> {
} }
export default defineComponent<HeaderProps>({ export default defineComponent<HeaderProps>({
name: 'Header', name: 'TableHeader',
inheritAttrs: false, inheritAttrs: false,
props: ['columns', 'flattenColumns', 'stickyOffsets', 'customHeaderRow'] as any, props: ['columns', 'flattenColumns', 'stickyOffsets', 'customHeaderRow'] as any,
setup(props) { setup(props) {

View File

@ -150,7 +150,7 @@ export interface TableProps<RecordType = DefaultRecordType> {
} }
export default defineComponent<TableProps<DefaultRecordType>>({ export default defineComponent<TableProps<DefaultRecordType>>({
name: 'Table', name: 'VcTable',
inheritAttrs: false, inheritAttrs: false,
props: [ props: [
'prefixCls', 'prefixCls',

View File

@ -12,7 +12,7 @@ export type TooltipContentProps = Partial<ExtractPropTypes<typeof tooltipContent
export default defineComponent({ export default defineComponent({
compatConfig: { MODE: 3 }, compatConfig: { MODE: 3 },
name: 'Content', name: 'TooltipContent',
props: tooltipContentProps, props: tooltipContentProps,
setup(props: TooltipContentProps, { slots }) { setup(props: TooltipContentProps, { slots }) {
return () => ( return () => (

View File

@ -23,7 +23,7 @@ export interface MaskProps {
zIndex?: number; zIndex?: number;
} }
const Mask = defineComponent({ const Mask = defineComponent({
name: 'Mask', name: 'TourMask',
props: { props: {
prefixCls: { type: String }, prefixCls: { type: String },
pos: objectType<PosInfo>(), // pos: objectType<PosInfo>(), //

View File

@ -54,7 +54,7 @@
"lint:demo": "eslint --fix components/*/demo/*.vue", "lint:demo": "eslint --fix components/*/demo/*.vue",
"lint:md": "eslint --fix *.md", "lint:md": "eslint --fix *.md",
"lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'", "lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
"lint:site": "eslint -c ./.eslintrc.js --fix --ext .jsx,.js,.ts,.tsx,vue ./site", "lint:site": "eslint --fix -c ./.eslintrc.js --ext .jsx,.js,.ts,.tsx,vue ./site",
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less", "lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"codecov": "codecov", "codecov": "codecov",
"routes": "node site/scripts/genrateRoutes.js", "routes": "node site/scripts/genrateRoutes.js",

View File

@ -182,7 +182,7 @@ export default defineComponent({
type.value = type.value === 'TS' ? 'JS' : 'TS'; type.value = type.value === 'TS' ? 'JS' : 'TS';
}; };
const handleCodeSandbox = () => { const handleCodeSandbox = () => {
const code = codeRef.value!.innerText; const code = codeRef.value.innerText;
const params = getCodeSandboxParams(code, { const params = getCodeSandboxParams(code, {
title: `${title.value} - ant-design-vue@${packageInfo.version}`, title: `${title.value} - ant-design-vue@${packageInfo.version}`,
}); });

View File

@ -10,6 +10,7 @@ const Demo = defineComponent({
setup() { setup() {
return () => { return () => {
const onClick: MenuProps['onClick'] = e => { const onClick: MenuProps['onClick'] = e => {
// eslint-disable-next-line no-console
console.log('click ', e); console.log('click ', e);
}; };

View File

@ -24,6 +24,7 @@ const items: MenuProps['items'] = [
const Demo = () => { const Demo = () => {
const onClick: MenuProps['onClick'] = e => { const onClick: MenuProps['onClick'] = e => {
// eslint-disable-next-line no-console
console.log('click ', e); console.log('click ', e);
}; };

View File

@ -15,6 +15,7 @@ const Demo = defineComponent({
</div> </div>
), ),
onOk() { onOk() {
// eslint-disable-next-line no-console
console.log('i am ok'); console.log('i am ok');
}, },
}); });

View File

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data'; import options from './data';
const handleChange = (value: any) => { const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`); console.log(`selected ${value}`);
}; };

View File

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data'; import options from './data';
const handleChange = (value: any) => { const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`); console.log(`selected ${value}`);
}; };

View File

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data'; import options from './data';
const handleChange = (value: any) => { const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`); console.log(`selected ${value}`);
}; };

View File

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data'; import options from './data';
const handleChange = (value: any) => { const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`); console.log(`selected ${value}`);
}; };

View File

@ -90,6 +90,7 @@ const data = [
]; ];
const onChange: TableProps<TableData>['onChange'] = (pagination, filters, sorter, extra) => { const onChange: TableProps<TableData>['onChange'] = (pagination, filters, sorter, extra) => {
// eslint-disable-next-line no-console
console.log('params', pagination, filters, sorter, extra); console.log('params', pagination, filters, sorter, extra);
}; };

View File

@ -19,7 +19,7 @@ export default {
}, },
watch: { watch: {
$route(e, t) { $route(e, t) {
let adId = '#carbonads'; const adId = '#carbonads';
// if(isGitee) { // if(isGitee) {
// adId = '#cf'; // adId = '#cf';
// } // }

View File

@ -63,7 +63,7 @@ class ClipboardAction {
this.fakeElem.style.position = 'absolute'; this.fakeElem.style.position = 'absolute';
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
// Move element to the same position vertically // Move element to the same position vertically
let yPosition = window.pageYOffset || document.documentElement.scrollTop; const yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.style.top = `${yPosition}px`; this.fakeElem.style.top = `${yPosition}px`;
this.fakeElem.setAttribute('readonly', ''); this.fakeElem.setAttribute('readonly', '');

View File

@ -1,10 +1,10 @@
let DOCUMENT_NODE_TYPE = 9; const DOCUMENT_NODE_TYPE = 9;
/** /**
* A polyfill for Element.matches() * A polyfill for Element.matches()
*/ */
if (typeof Element !== 'undefined' && !Element.prototype.matches) { if (typeof Element !== 'undefined' && !Element.prototype.matches) {
let proto = Element.prototype; const proto = Element.prototype;
proto.matches = proto.matches =
proto.matchesSelector || proto.matchesSelector ||

View File

@ -1,3 +1,5 @@
/* eslint-disable prefer-spread */
/* eslint-disable prefer-rest-params */
import closest from './closest'; import closest from './closest';
/** /**
@ -11,7 +13,7 @@ import closest from './closest';
* @return {Object} * @return {Object}
*/ */
function _delegate(element, selector, type, callback, useCapture) { function _delegate(element, selector, type, callback, useCapture) {
let listenerFn = listener.apply(this, arguments); const listenerFn = listener.apply(this, arguments);
element.addEventListener(type, listenerFn, useCapture); element.addEventListener(type, listenerFn, useCapture);

View File

@ -15,7 +15,7 @@ export const node = function (value) {
* @return {Boolean} * @return {Boolean}
*/ */
export const nodeList = function (value) { export const nodeList = function (value) {
let type = Object.prototype.toString.call(value); const type = Object.prototype.toString.call(value);
return ( return (
value !== undefined && value !== undefined &&
@ -42,7 +42,7 @@ export const string = function (value) {
* @return {Boolean} * @return {Boolean}
*/ */
export const fn = function (value) { export const fn = function (value) {
let type = Object.prototype.toString.call(value); const type = Object.prototype.toString.call(value);
return type === '[object Function]'; return type === '[object Function]';
}; };

View File

@ -6,7 +6,7 @@ function select(element) {
selectedText = element.value; selectedText = element.value;
} else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { } else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
let isReadOnly = element.hasAttribute('readonly'); const isReadOnly = element.hasAttribute('readonly');
if (!isReadOnly) { if (!isReadOnly) {
element.setAttribute('readonly', ''); element.setAttribute('readonly', '');
@ -25,8 +25,8 @@ function select(element) {
element.focus(); element.focus();
} }
let selection = window.getSelection(); const selection = window.getSelection();
let range = document.createRange(); const range = document.createRange();
range.selectNodeContents(element); range.selectNodeContents(element);
selection.removeAllRanges(); selection.removeAllRanges();

View File

@ -1,3 +1,4 @@
/* eslint-disable prefer-rest-params */
function E() { function E() {
// Keep this empty so it's easier to inherit from // Keep this empty so it's easier to inherit from
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
@ -5,7 +6,7 @@ function E() {
E.prototype = { E.prototype = {
on(name, callback, ctx) { on(name, callback, ctx) {
let e = this.e || (this.e = {}); const e = this.e || (this.e = {});
(e[name] || (e[name] = [])).push({ (e[name] || (e[name] = [])).push({
fn: callback, fn: callback,
@ -16,7 +17,8 @@ E.prototype = {
}, },
once(name, callback, ctx) { once(name, callback, ctx) {
let self = this; // eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
function listener() { function listener() {
self.off(name, listener); self.off(name, listener);
callback.apply(ctx, arguments); callback.apply(ctx, arguments);
@ -27,10 +29,10 @@ E.prototype = {
}, },
emit(name) { emit(name) {
let data = [].slice.call(arguments, 1); const data = [].slice.call(arguments, 1);
let evtArr = ((this.e || (this.e = {}))[name] || []).slice(); const evtArr = ((this.e || (this.e = {}))[name] || []).slice();
let i = 0; let i = 0;
let len = evtArr.length; const len = evtArr.length;
for (i; i < len; i++) { for (i; i < len; i++) {
evtArr[i].fn.apply(evtArr[i].ctx, data); evtArr[i].fn.apply(evtArr[i].ctx, data);
@ -40,9 +42,9 @@ E.prototype = {
}, },
off(name, callback) { off(name, callback) {
let e = this.e || (this.e = {}); const e = this.e || (this.e = {});
let evts = e[name]; const evts = e[name];
let liveEvents = []; const liveEvents = [];
if (evts && callback) { if (evts && callback) {
for (let i = 0, len = evts.length; i < len; i++) { for (let i = 0, len = evts.length; i < len; i++) {

View File

@ -13,7 +13,7 @@
<slot /> <slot />
<!-- <GoogleAds v-if="showAd" :key="`goo-${route.path}`" /> --> <!-- <GoogleAds v-if="showAd" :key="`goo-${route.path}`" /> -->
<section class="markdown api-container" v-html="api"></section> <section class="markdown api-container" v-html="api"></section>
<Contributor :isZn="isZhCN" /> <Contributor :is-zn="isZhCN" />
</article> </article>
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@ -40,7 +40,7 @@ const IconDisplay = defineComponent({
return Object.keys(categories) return Object.keys(categories)
.map(key => { .map(key => {
let iconList = categories[key]; const iconList = categories[key];
return { return {
category: key, category: key,

2
site/typings.d.ts vendored
View File

@ -1,7 +1,7 @@
declare module '*.vue' { declare module '*.vue' {
import type { DefineComponent } from 'vue'; import type { DefineComponent } from 'vue';
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/ban-types
const component: DefineComponent<any, any, any> & { readonly pageDate?: PageData }; const component: DefineComponent<any, any, any>;
export default component; export default component;
} }

View File

@ -13,6 +13,7 @@
"esModuleInterop": true, "esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"jsx": "preserve", "jsx": "preserve",
"jsxImportSource": "vue",
"noUnusedParameters": true, "noUnusedParameters": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noImplicitAny": false, "noImplicitAny": false,