diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 0b50615..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "prettier"], - "plugins": ["simple-import-sort"], - "rules": { - "react/jsx-no-target-blank": "warn", - "@next/next/no-sync-scripts": "warn", - "simple-import-sort/exports": "error", - "simple-import-sort/imports": "error" - } -} diff --git a/README.md b/README.md index 9d6f2b9..4269b93 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ## Technology stack - Language: [TypeScript v5][10] + [MDX v3][11] -- Component engine: [Next.js v14][12] +- Component engine: [Next.js v15][12] - Component suite: [Bootstrap v5][13] - PWA framework: [Workbox v6][14] - State management: [MobX v6][15] diff --git a/components/Form/JSONEditor/index.tsx b/components/Form/JSONEditor/index.tsx index 99cb83e..050bdae 100644 --- a/components/Form/JSONEditor/index.tsx +++ b/components/Form/JSONEditor/index.tsx @@ -60,8 +60,8 @@ export class ListField extends Component { } addItem = (type: string) => { - var item: DataMeta = { type, value: [] }, - { innerValue } = this; + let item: DataMeta = { type, value: [] }; + const { innerValue } = this; switch (type) { case 'string': @@ -104,7 +104,7 @@ export class ListField extends Component { item.key = newKey; - for (let oldKey in value) + for (const oldKey in value) if (!children.some(({ key }) => key === oldKey)) { value[newKey] = value[oldKey]; @@ -168,7 +168,7 @@ export class ListField extends Component { {children.map(({ type, key, value }, index) => ( -
  • +
  • {field_type === 'object' && ( { constructor(props: EditorProps) { super(props); - for (let key in props.rules) this.convertor.addRule(key, props.rules[key]); + for (const key in props.rules) + this.convertor.addRule(key, props.rules[key]); } async componentDidMount() { const MarkdownIME = await import('markdown-ime'); - // @ts-ignore + // @ts-expect-error official type error MarkdownIME.Enhance(this.root); } - countText = debounce(() => { - var count = 0; - - if (this.root) count = (this.root.textContent || '').trim().length; - - this.count = count; - }); + countText = debounce( + () => (this.count = this.root?.textContent?.trim().length || 0), + ); private manualChange() { this.countText(); @@ -86,7 +83,7 @@ export class MarkdownEditor extends Component { event.preventDefault(); - var list: DataTransferItem[] = Array.from(items); + let list: DataTransferItem[] = Array.from(items); if (list.find(({ type }) => /xml|html/.test(type))) list = list.filter(({ type }) => type !== 'text/plain'); @@ -128,8 +125,8 @@ export class MarkdownEditor extends Component { render() { return (
    ('[href], [src]')) { + for (const element of root.querySelectorAll('[href], [src]')) { let URI = element instanceof HTMLAnchorElement ? element.href : element.src; @@ -163,7 +163,7 @@ export class ArticleEditor extends Component { if (fileType.MarkDown.includes(type) && editorContent) { if (!meta) return editorContent; - // @ts-ignore + meta.updated = formatDate(); return `--- @@ -178,7 +178,7 @@ export class ArticleEditor extends Component { event.preventDefault(); const { currentRepository, repositoryStore, editorContent } = this, - // @ts-ignore + // @ts-expect-error DOM API shortcut { message } = event.currentTarget.elements; if (!editorContent) return; @@ -189,7 +189,7 @@ export class ArticleEditor extends Component { ({ src }) => new URL(src).protocol === 'blob:', ); - for (let file of media) { + for (const file of media) { const blob = await blobOf(file.src); const filePath = this.path.replace( diff --git a/components/Git/Card.tsx b/components/Git/Card.tsx index dfc74c7..e5f7fa3 100644 --- a/components/Git/Card.tsx +++ b/components/Git/Card.tsx @@ -47,7 +47,7 @@ export const GitCard: FC = observer( {languages.map(language => ( - + ))} diff --git a/components/NotFoundCard.tsx b/components/NotFoundCard.tsx index 3cf6891..3b3ed41 100644 --- a/components/NotFoundCard.tsx +++ b/components/NotFoundCard.tsx @@ -7,7 +7,7 @@ export const NotFoundCard: FC = ({ title }) => i18n.currentLanguage.startsWith('zh') ? (