From 5e8d2b12866049f413b8716ad031e0e549dc22f0 Mon Sep 17 00:00:00 2001 From: undefined Date: Sat, 3 Sep 2022 14:28:18 +0800 Subject: [PATCH] ui: update eslint rules --- .eslintrc.yaml | 2 +- package.json | 13 ++++++----- packages/elastic/package.json | 2 +- packages/hydrojudge/package.json | 2 +- packages/hydrooj/package.json | 6 ++--- packages/migrate/package.json | 2 +- packages/ui-default/.eslintrc.js | 12 ++++++++-- packages/ui-default/bus.ts | 7 +++--- .../components/DOMAttachedObject.ts | 9 +++----- .../autocomplete/components/AutoComplete.tsx | 9 +++++--- .../ui-default/components/calendar/index.js | 6 ++--- .../messagepad/reducers/activeId.js | 2 +- .../messagepad/reducers/dialogues.js | 2 +- .../components/messagepad/reducers/inputs.js | 2 +- .../messagepad/reducers/isPosting.js | 2 +- packages/ui-default/components/monaco/nls.js | 4 ++-- .../problemconfig/TestCasesTable.tsx | 2 +- .../problemconfig/reducer/config.ts | 2 +- .../problemconfig/reducer/testdata.ts | 2 +- .../components/scratchpad/reducers/editor.ts | 2 +- .../components/scratchpad/reducers/pretest.ts | 2 +- .../components/scratchpad/reducers/records.ts | 2 +- .../components/scratchpad/reducers/state.ts | 2 +- .../components/scratchpad/reducers/ui.ts | 2 +- packages/ui-default/components/upload.ts | 2 +- packages/ui-default/misc/Page.ts | 23 ++++++++----------- packages/ui-default/package.json | 6 ++--- packages/ui-default/types.ts | 2 +- packages/ui-default/utils/pjax.js | 12 ++++------ packages/utils/package.json | 2 +- 30 files changed, 73 insertions(+), 72 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index b6d29728..94305f58 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -1,6 +1,6 @@ root: true extends: - - airbnb + - airbnb-base - airbnb-typescript/base env: jquery: true diff --git a/package.json b/package.json index 76c6f15c..15f3837e 100644 --- a/package.json +++ b/package.json @@ -32,13 +32,13 @@ "@types/autocannon": "^7.6.1", "@types/cross-spawn": "^6.0.2", "@types/mocha": "^9.1.1", - "@types/node": "^18.7.13", + "@types/node": "^18.7.14", "@types/semver": "^7.3.12", "@types/supertest": "^2.0.12", - "@typescript-eslint/eslint-plugin": "^5.35.1", - "@typescript-eslint/parser": "^5.35.1", + "@typescript-eslint/eslint-plugin": "^5.36.1", + "@typescript-eslint/parser": "^5.36.1", "autocannon": "^7.9.0", - "cac": "^6.7.12", + "cac": "^6.7.14", "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", "esbuild": "0.15.2", @@ -49,14 +49,15 @@ "eslint-import-resolver-webpack": "^0.13.2", "eslint-plugin-import": "2.26.0", "eslint-plugin-jsx-a11y": "^6.6.1", - "eslint-plugin-react": "^7.31.1", + "eslint-plugin-react": "^7.31.2", + "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-simple-import-sort": "7.0.0", "fs-extra": "^10.1.0", "globby": "11.1.0", "latest-version": "7.0.0", "mocha": "^10.0.0", "mongodb": "^3.7.3", - "mongodb-memory-server": "^8.9.0", + "mongodb-memory-server": "^8.9.1", "nyc": "^15.1.0", "ora": "^6.1.2", "semver": "^7.3.7", diff --git a/packages/elastic/package.json b/packages/elastic/package.json index 1d0527a4..b924a60f 100644 --- a/packages/elastic/package.json +++ b/packages/elastic/package.json @@ -6,6 +6,6 @@ "author": "undefined ", "license": "AGPL-3.0-or-later", "dependencies": { - "@elastic/elasticsearch": "^8.2.1" + "@elastic/elasticsearch": "^8.4.0" } } diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 43ae6b15..ef907380 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -8,7 +8,7 @@ "dependencies": { "@hydrooj/utils": "workspace:*", "axios": "^0.27.2", - "cac": "^6.7.12", + "cac": "^6.7.14", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", "lodash": "^4.17.21", diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index a99d4929..919c2161 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -15,7 +15,7 @@ "@graphql-tools/schema": "^8.5.1", "@hydrooj/utils": "workspace:*", "adm-zip": "0.5.5", - "cac": "^6.7.12", + "cac": "^6.7.14", "cookies": "^0.8.0", "detect-browser": "^5.3.0", "emoji-regex": "^10.1.0", @@ -34,7 +34,7 @@ "lodash": "^4.17.21", "lru-cache": "7.12.0", "mime-types": "^2.1.35", - "minio": "7.0.25", + "minio": "7.0.32", "moment-timezone": "^0.5.37", "mongodb": "^3.7.3", "nanoid": "^4.0.0", @@ -43,7 +43,7 @@ "p-queue": "^7.3.0", "path-to-regexp": "^6.2.1", "require-resolve-hook": "^1.1.0", - "schemastery": "^3.5.3", + "schemastery": "^3.5.4", "semver": "^7.3.7", "serialize-javascript": "^6.0.0", "superagent": "^8.0.0", diff --git a/packages/migrate/package.json b/packages/migrate/package.json index a2ad2424..3cb0832a 100644 --- a/packages/migrate/package.json +++ b/packages/migrate/package.json @@ -13,7 +13,7 @@ "dependencies": { "@hydrooj/utils": "workspace:*", "js-yaml": "^4.1.0", - "mariadb": "^3.0.0", + "mariadb": "^3.0.1", "mongodb": "^3.7.3", "mysql": "^2.18.1", "turndown": "^7.1.1" diff --git a/packages/ui-default/.eslintrc.js b/packages/ui-default/.eslintrc.js index c792bbdd..09749154 100644 --- a/packages/ui-default/.eslintrc.js +++ b/packages/ui-default/.eslintrc.js @@ -10,7 +10,11 @@ module.exports = { jquery: true, commonjs: true, }, - extends: ['airbnb'], + extends: [ + 'airbnb', + 'airbnb/hooks', + 'airbnb-typescript', + ], parserOptions: { sourceType: 'module', ecmaVersion: 2020, @@ -49,15 +53,19 @@ module.exports = { JQuery: true, }, rules: { + 'react-hooks/exhaustive-deps': 'off', '@typescript-eslint/dot-notation': 'off', '@typescript-eslint/no-implied-eval': 'off', '@typescript-eslint/no-throw-literal': 'off', '@typescript-eslint/return-await': 'off', '@typescript-eslint/no-shadow': 'warn', 'no-shadow': 'off', + '@typescript-eslint/quotes': ['warn', 'single', { avoidEscape: true }], // FIXME A bug with eslint-parser 'template-curly-spacing': 'off', + // FIXME A bug with eslint-plugin-react + 'react/no-unknown-property': ['error', { ignore: ['key'] }], // Note: must disable the base rule as it can report incorrect errors 'no-use-before-define': 'off', @@ -86,7 +94,7 @@ module.exports = { { SwitchCase: 1 }, ], 'max-len': ['error', 150], - quotes: 'warn', + quotes: ['warn', 'single', { avoidEscape: true }], 'class-methods-use-this': 'off', 'consistent-return': 'warn', 'func-names': 'off', diff --git a/packages/ui-default/bus.ts b/packages/ui-default/bus.ts index a16b17e9..1a7348fe 100644 --- a/packages/ui-default/bus.ts +++ b/packages/ui-default/bus.ts @@ -1,5 +1,6 @@ /* eslint-disable no-await-in-loop */ +// eslint-disable-next-line @typescript-eslint/naming-convention const _hooks: Record any>> = {}; function isBailed(value: any) { @@ -45,12 +46,12 @@ export function prependListener(name: K, listener: Eve export function once(name: K, listener: EventMap[K]) { let dispose; - function _listener(...args: any[]) { + function l(...args: any[]) { dispose(); return listener.apply(this, args); } - _listener.toString = () => `// Once \n${listener.toString()}`; - dispose = addListener(name, _listener); + l.toString = () => `// Once \n${listener.toString()}`; + dispose = addListener(name, l); return dispose; } diff --git a/packages/ui-default/components/DOMAttachedObject.ts b/packages/ui-default/components/DOMAttachedObject.ts index 7c9f43a9..05707afa 100644 --- a/packages/ui-default/components/DOMAttachedObject.ts +++ b/packages/ui-default/components/DOMAttachedObject.ts @@ -56,8 +56,7 @@ export default class DOMAttachedObject { static attachAll(container: Document | HTMLElement = document.body, ...args) { if (process.env.NODE_ENV !== 'production') { if (!this.DOMAttachSelector) { - // eslint-disable-next-line quotes - throw new Error(`'DOMAttachSelector' should be specified`); + throw new Error("'DOMAttachSelector' should be specified"); } } if (process.env.NODE_ENV !== 'production') { @@ -77,8 +76,7 @@ export default class DOMAttachedObject { const selector = this.DOMDetachSelector || this.DOMAttachSelector; if (process.env.NODE_ENV !== 'production') { if (!selector) { - // eslint-disable-next-line quotes - throw new Error(`'DOMDetachSelector' or 'DOMAttachSelector' should be specified`); + throw new Error("'DOMDetachSelector' or 'DOMAttachSelector' should be specified"); } } if (process.env.NODE_ENV !== 'production') { @@ -102,8 +100,7 @@ export default class DOMAttachedObject { static registerLifeCycleHooks(attach = true) { if (process.env.NODE_ENV !== 'production') { if (!this.DOMAttachSelector) { - // eslint-disable-next-line quotes - throw new Error(`'DOMAttachSelector' should be specified`); + throw new Error("'DOMAttachSelector' should be specified"); } } $(document).on('vjContentNew', (e) => this.attachAll(e.target)); diff --git a/packages/ui-default/components/autocomplete/components/AutoComplete.tsx b/packages/ui-default/components/autocomplete/components/AutoComplete.tsx index 699020bb..949d0197 100644 --- a/packages/ui-default/components/autocomplete/components/AutoComplete.tsx +++ b/packages/ui-default/components/autocomplete/components/AutoComplete.tsx @@ -109,9 +109,12 @@ const AutoComplete = forwardRef(function Impl(props: AutoCompleteProps, re const inputRef = useRef(); const listRef = useRef(); - if (props.cacheKey) superCache[props.cacheKey] ||= { query: {}, value: {} }; - const queryCache = props.cacheKey ? superCache[props.cacheKey].query : useRef({}).current; - const valueCache = props.cacheKey ? superCache[props.cacheKey].value : useRef({}).current; + let [queryCache, valueCache] = [useRef({}).current, useRef({}).current]; + if (props.cacheKey) { + superCache[props.cacheKey] ||= { query: {}, value: {} }; + queryCache = superCache[props.cacheKey].query; + valueCache = superCache[props.cacheKey].value; + } const queryList = async (query) => { if (!query && !allowEmptyQuery) { diff --git a/packages/ui-default/components/calendar/index.js b/packages/ui-default/components/calendar/index.js index 4714de64..ad39257b 100644 --- a/packages/ui-default/components/calendar/index.js +++ b/packages/ui-default/components/calendar/index.js @@ -280,10 +280,8 @@ export default class Calendar { for (; vIndex < vIndexMax; ++vIndex) { if (_.every(_ .range(beginDay, endDay + 1) - .map((day) => !dayBitmap[day][vIndex]), // eslint-disable-line no-loop-func - )) { // eslint-disable-line function-paren-newline - break; - } + .map((day) => !dayBitmap[day][vIndex]), // eslint-disable-line + )) break; } // fill space for (let i = beginDay; i <= endDay; ++i) { diff --git a/packages/ui-default/components/messagepad/reducers/activeId.js b/packages/ui-default/components/messagepad/reducers/activeId.js index 406e9cd2..d4f112a8 100644 --- a/packages/ui-default/components/messagepad/reducers/activeId.js +++ b/packages/ui-default/components/messagepad/reducers/activeId.js @@ -21,7 +21,7 @@ function scrollToViewport() { } } -export default function reducer(state = null, action) { +export default function reducer(state = null, action: any = {}) { switch (action.type) { case 'DIALOGUES_SWITCH_TO': { scrollToViewport(); diff --git a/packages/ui-default/components/messagepad/reducers/dialogues.js b/packages/ui-default/components/messagepad/reducers/dialogues.js index d6e55d7b..190b1b12 100644 --- a/packages/ui-default/components/messagepad/reducers/dialogues.js +++ b/packages/ui-default/components/messagepad/reducers/dialogues.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -export default function reducer(state = {}, action) { +export default function reducer(state = {}, action = {}) { switch (action.type) { case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': { const { messages } = action.payload; diff --git a/packages/ui-default/components/messagepad/reducers/inputs.js b/packages/ui-default/components/messagepad/reducers/inputs.js index a188073e..547db8f8 100644 --- a/packages/ui-default/components/messagepad/reducers/inputs.js +++ b/packages/ui-default/components/messagepad/reducers/inputs.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -export default function reducer(state = {}, action) { +export default function reducer(state = {}, action = {}) { switch (action.type) { case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': { const dialogues = action.payload.messages; diff --git a/packages/ui-default/components/messagepad/reducers/isPosting.js b/packages/ui-default/components/messagepad/reducers/isPosting.js index ecd04cbf..cf4e67a7 100644 --- a/packages/ui-default/components/messagepad/reducers/isPosting.js +++ b/packages/ui-default/components/messagepad/reducers/isPosting.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import Notification from 'vj/components/notification'; -export default function reducer(state = {}, action) { +export default function reducer(state = {}, action: any = {}) { switch (action.type) { case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': { const dialogues = action.payload.messages; diff --git a/packages/ui-default/components/monaco/nls.js b/packages/ui-default/components/monaco/nls.js index 00648b1d..21e2a4a1 100644 --- a/packages/ui-default/components/monaco/nls.js +++ b/packages/ui-default/components/monaco/nls.js @@ -1,7 +1,7 @@ /* eslint-disable camelcase */ import en_GB from 'monaco-editor-nls/locale/en-gb.json'; -function _format(message, args) { +function format(message, args) { let result; if (args.length === 0) { result = message; @@ -33,7 +33,7 @@ function find(path, message) { } export function localize(path, message, ...args) { - return _format(find(path.key || path, message), args); + return format(find(path.key || path, message), args); } export function setLocaleData(data) { diff --git a/packages/ui-default/components/problemconfig/TestCasesTable.tsx b/packages/ui-default/components/problemconfig/TestCasesTable.tsx index 908480dd..ddd40797 100644 --- a/packages/ui-default/components/problemconfig/TestCasesTable.tsx +++ b/packages/ui-default/components/problemconfig/TestCasesTable.tsx @@ -59,7 +59,7 @@ export function TestCaseEntry({ index, subindex }) { output: useRef(), }; for (const type of ['input', 'output']) { - useEffect(() => { + useEffect(() => { // eslint-disable-line refs[type].current?.setSelectedItems(testcase[type] ? [testcase[type]] : []); }, [testcase[type]]); } diff --git a/packages/ui-default/components/problemconfig/reducer/config.ts b/packages/ui-default/components/problemconfig/reducer/config.ts index 522a1452..19093922 100644 --- a/packages/ui-default/components/problemconfig/reducer/config.ts +++ b/packages/ui-default/components/problemconfig/reducer/config.ts @@ -5,7 +5,7 @@ import { cloneDeep } from 'lodash'; type State = ProblemConfigFile & { __loaded: boolean }; -export default function reducer(state = { type: 'default', __loaded: false } as State, action): State { +export default function reducer(state = { type: 'default', __loaded: false } as State, action: any = {}): State { switch (action.type) { case 'CONFIG_LOAD_FULFILLED': { return { ...state, ...yaml.load(action.payload.config) as object, __loaded: true }; diff --git a/packages/ui-default/components/problemconfig/reducer/testdata.ts b/packages/ui-default/components/problemconfig/reducer/testdata.ts index 34fb0fb8..dd014b0c 100644 --- a/packages/ui-default/components/problemconfig/reducer/testdata.ts +++ b/packages/ui-default/components/problemconfig/reducer/testdata.ts @@ -1,4 +1,4 @@ -export default function reducer(state = [], action) { +export default function reducer(state = [], action: any = {}) { switch (action.type) { case 'CONFIG_LOAD_FULFILLED': { return state.concat(action.payload.testdata); diff --git a/packages/ui-default/components/scratchpad/reducers/editor.ts b/packages/ui-default/components/scratchpad/reducers/editor.ts index ef1c4b68..41736b67 100644 --- a/packages/ui-default/components/scratchpad/reducers/editor.ts +++ b/packages/ui-default/components/scratchpad/reducers/editor.ts @@ -4,7 +4,7 @@ if (UiContext.tdoc?._id && UiContext.tdoc.rule !== 'homework') cacheKey += `@${U export default function reducer(state = { lang: localStorage.getItem(`${cacheKey}#lang`) || UiContext.codeLang, code: localStorage.getItem(cacheKey) || UiContext.codeTemplate, -}, action) { +}, action: any = {}) { if (action.type === 'SCRATCHPAD_EDITOR_UPDATE_CODE') { localStorage.setItem(cacheKey, action.payload); return { diff --git a/packages/ui-default/components/scratchpad/reducers/pretest.ts b/packages/ui-default/components/scratchpad/reducers/pretest.ts index 71db3e6b..7b6eb7f1 100644 --- a/packages/ui-default/components/scratchpad/reducers/pretest.ts +++ b/packages/ui-default/components/scratchpad/reducers/pretest.ts @@ -4,7 +4,7 @@ export default function reducer(state = { input: '', output: '', rid: null, -}, action) { +}, action: any = {}) { if (action.type === 'SCRATCHPAD_PRETEST_DATA_CHANGE') { const { type, value } = action.payload; return { diff --git a/packages/ui-default/components/scratchpad/reducers/records.ts b/packages/ui-default/components/scratchpad/reducers/records.ts index 3b8b0d65..6171832d 100644 --- a/packages/ui-default/components/scratchpad/reducers/records.ts +++ b/packages/ui-default/components/scratchpad/reducers/records.ts @@ -3,7 +3,7 @@ import _ from 'lodash'; export default function reducer(state = { rows: [], items: {}, -}, action) { +}, action: any = {}) { switch (action.type) { case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_FULFILLED': { const { rdocs } = action.payload; diff --git a/packages/ui-default/components/scratchpad/reducers/state.ts b/packages/ui-default/components/scratchpad/reducers/state.ts index 5800457b..a1eddf7d 100644 --- a/packages/ui-default/components/scratchpad/reducers/state.ts +++ b/packages/ui-default/components/scratchpad/reducers/state.ts @@ -1,4 +1,4 @@ -export default function reducer(state = {}, action) { +export default function reducer(state = {}, action: any = {}) { if (action.type === 'SCRATCHPAD_STATE_UPDATE') { const { key, value } = action.payload; return { diff --git a/packages/ui-default/components/scratchpad/reducers/ui.ts b/packages/ui-default/components/scratchpad/reducers/ui.ts index 9b86c4bf..4e102252 100644 --- a/packages/ui-default/components/scratchpad/reducers/ui.ts +++ b/packages/ui-default/components/scratchpad/reducers/ui.ts @@ -21,7 +21,7 @@ export default function reducer(state = { waitSec: 0, isWaiting: false, activePage: 'problem', -}, action) { +}, action: any = {}) { switch (action.type) { case 'SCRATCHPAD_UI_CHANGE_SIZE': { const { uiElement, size } = action.payload; diff --git a/packages/ui-default/components/upload.ts b/packages/ui-default/components/upload.ts index f698d812..cbc4fc1a 100644 --- a/packages/ui-default/components/upload.ts +++ b/packages/ui-default/components/upload.ts @@ -14,7 +14,7 @@ interface UploadOptions { pjax?: boolean; singleFileUploadCallback?: (file: File) => any; } -export default async function uploadFiles(endpoint = '', files: File[] | FileList, options: UploadOptions = {}) { +export default async function uploadFiles(endpoint = '', files: File[] | FileList = [], options: UploadOptions = {}) { const dialog = new Dialog({ $body: `
diff --git a/packages/ui-default/misc/Page.ts b/packages/ui-default/misc/Page.ts index 5e6da1e8..12c5b78a 100644 --- a/packages/ui-default/misc/Page.ts +++ b/packages/ui-default/misc/Page.ts @@ -1,12 +1,12 @@ -type callback = (pagename: string, loadPage: (name: string) => Promise) => any; +type Callback = (pagename: string, loadPage: (name: string) => Promise) => any; export class Page { moduleName?: string; autoload = false; - afterLoading?: callback; - beforeLoading?: callback; - constructor(pagename: string | string[], afterLoading?: callback, beforeLoading?: callback); - constructor(pagename: string | string[], moduleName: string, afterLoading?: callback, beforeLoading?: callback); + afterLoading?: Callback; + beforeLoading?: Callback; + constructor(pagename: string | string[], afterLoading?: Callback, beforeLoading?: Callback); + constructor(pagename: string | string[], moduleName: string, afterLoading?: Callback, beforeLoading?: Callback); constructor(pagename: string | string[], ...args: any[]); constructor(public name: string | string[], ...args: any[]) { if (typeof args[0] === 'string') { @@ -16,16 +16,13 @@ export class Page { } if (process.env.NODE_ENV !== 'production') { if (typeof name !== 'string' && !(name instanceof Array)) { - // eslint-disable-next-line quotes - throw new Error(`'name' should be a string or string[]`); + throw new Error("'name' should be a string or string[]"); } if (typeof this.afterLoading !== 'function' && this.afterLoading != null) { - // eslint-disable-next-line quotes - throw new Error(`'afterLoading' should be a function`); + throw new Error("'afterLoading' should be a function"); } if (typeof this.beforeLoading !== 'function' && this.beforeLoading != null) { - // eslint-disable-next-line quotes - throw new Error(`'beforeLoading' should be a function`); + throw new Error("'beforeLoading' should be a function"); } } } @@ -40,8 +37,8 @@ export class Page { export class NamedPage extends Page { } export class AutoloadPage extends Page { - constructor(pagename: string | string[], afterLoading?: callback, beforeLoading?: callback); - constructor(pagename: string | string[], moduleName: string, afterLoading?: callback, beforeLoading?: callback); + constructor(pagename: string | string[], afterLoading?: Callback, beforeLoading?: Callback); + constructor(pagename: string | string[], moduleName: string, afterLoading?: Callback, beforeLoading?: Callback); constructor(pagename: string | string[], ...args: any[]) { super(pagename, ...args); this.autoload = true; diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index b7c4d76b..8348ee22 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -18,7 +18,7 @@ "@fontsource/jetbrains-mono": "^4.5.10", "@fontsource/pt-mono": "^4.5.10", "@fontsource/roboto-mono": "^4.5.8", - "@fontsource/source-code-pro": "^4.5.11", + "@fontsource/source-code-pro": "^4.5.12", "@fontsource/ubuntu-mono": "^4.5.11", "@hydrooj/utils": "workspace:*", "@svgr/webpack": "^6.3.1", @@ -112,7 +112,7 @@ "web-streams-polyfill": "^3.2.1", "webpack": "^5.74.0", "webpack-bundle-analyzer": "^4.6.1", - "webpack-dev-server": "^4.10.0", + "webpack-dev-server": "^4.10.1", "webpackbar": "^5.0.2" }, "dependencies": { @@ -121,7 +121,7 @@ "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", "jsesc": "^3.0.2", - "katex": "^0.16.0", + "katex": "^0.16.2", "lodash": "^4.17.21", "markdown-it": "^13.0.1", "markdown-it-anchor": "^8.6.4", diff --git a/packages/ui-default/types.ts b/packages/ui-default/types.ts index d414abba..207c28c1 100644 --- a/packages/ui-default/types.ts +++ b/packages/ui-default/types.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ declare let UserContext: any; declare let UiContext: any; -// eslint-disable-next-line camelcase +// eslint-disable-next-line declare let node_modules: any; declare let LANGS: Record; diff --git a/packages/ui-default/utils/pjax.js b/packages/ui-default/utils/pjax.js index 1e4ed20a..01a09444 100644 --- a/packages/ui-default/utils/pjax.js +++ b/packages/ui-default/utils/pjax.js @@ -93,29 +93,25 @@ pjax.request = async (opt) => { data.fragments.forEach((fragment) => { if (process.env.NODE_ENV !== 'production') { if (fragment.html === undefined) { - // eslint-disable-next-line quotes - throw new Error(`Fragement should contain 'html'`); + throw new Error("Fragement should contain 'html'"); } } const $el = $(fragment.html.trim()); if (process.env.NODE_ENV !== 'production') { if ($el.length === 0) { - // eslint-disable-next-line quotes - throw new Error(`Unable to build elements from fragment 'html'`); + throw new Error("Unable to build elements from fragment 'html'"); } } const fragmentId = $el.attr('data-fragment-id'); if (process.env.NODE_ENV !== 'production') { if (!fragmentId) { - // eslint-disable-next-line quotes - throw new Error(`Unable to extract fragment id from fragment 'html'`); + throw new Error("Unable to extract fragment id from fragment 'html'"); } } const $target = $(`[data-fragment-id="${fragmentId}"]`); if (process.env.NODE_ENV !== 'production') { if ($target.length === 0) { - // eslint-disable-next-line quotes - throw new Error(`Unable to get target fragment from fragment id`); + throw new Error('Unable to get target fragment from fragment id'); } } $target.trigger('vjContentRemove'); diff --git a/packages/utils/package.json b/packages/utils/package.json index 7727bf54..a944963f 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -8,7 +8,7 @@ "license": "AGPL-3.0-or-later", "preferUnplugged": true, "dependencies": { - "cac": "^6.7.12", + "cac": "^6.7.14", "esbuild": "0.15.2", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0",