Skip to content

Commit

Permalink
feat: update linter and tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 15, 2024
1 parent 57c33eb commit 4a30d7c
Show file tree
Hide file tree
Showing 27 changed files with 1,378 additions and 1,294 deletions.
18 changes: 9 additions & 9 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
},
"devDependencies": {
"@fancyapps/ui": "5.0.36",
"@vuepress/bundler-vite": "2.0.0-rc.18",
"@vuepress/helper": "2.0.0-rc.63",
"@vuepress/plugin-comment": "2.0.0-rc.63",
"@vuepress/plugin-docsearch": "2.0.0-rc.64",
"@vuepress/plugin-redirect": "2.0.0-rc.63",
"@vuepress/bundler-vite": "2.0.0-rc.19",
"@vuepress/helper": "2.0.0-rc.66",
"@vuepress/plugin-comment": "2.0.0-rc.66",
"@vuepress/plugin-docsearch": "2.0.0-rc.66",
"@vuepress/plugin-redirect": "2.0.0-rc.66",
"@waline/client": "workspace:*",
"marked": "15.0.3",
"mathjax-full": "3.2.2",
"sass-embedded": "1.82.0",
"sass-embedded": "1.83.0",
"vidstack": "1.12.12",
"vue": "3.5.13",
"vuepress": "2.0.0-rc.18",
"vuepress-shared": "2.0.0-rc.60",
"vuepress-theme-hope": "2.0.0-rc.61"
"vuepress": "2.0.0-rc.19",
"vuepress-shared": "2.0.0-rc.64",
"vuepress-theme-hope": "2.0.0-rc.64"
}
}
33 changes: 6 additions & 27 deletions docs/src/.vuepress/utils/exportRaw.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
const fakeClick = (element: HTMLElement): void => {
const ev = document.createEvent('MouseEvents');

ev.initMouseEvent(
'click',
true,
false,
window,
0,
0,
0,
0,
0,
false,
false,
false,
false,
0,
null,
);

element.dispatchEvent(ev);
};

export const exportRaw = (name: string, data: BlobPart): void => {
const urlObject = window.URL || window.webkitURL || window;
const saveAnchor = document.createElementNS(
'http://www.w3.org/1999/xhtml',
'a',
) as HTMLAnchorElement;

saveAnchor.href = urlObject.createObjectURL(new Blob([data]));
saveAnchor.href = window.URL.createObjectURL(new Blob([data]));
saveAnchor.download = name;

fakeClick(saveAnchor);
const event = new MouseEvent('click', {
relatedTarget: window,
});

saveAnchor.dispatchEvent(event);
};
23 changes: 13 additions & 10 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import hopeConfig, {
import {
config,
globals,
js,
jsImport,
prettier,
ts,
tsImport,
tsParser,
vitest,
} from 'eslint-config-mister-hope';
import { vue, vueParser } from 'eslint-config-mister-hope/vue';
import reactRecommended from 'eslint-plugin-react/configs/recommended.js';

export default config(
...js,
...jsImport,
...ts,
...tsImport,
vitest,
...vue,
...hopeConfig,
{
ignores: [
'**/.vuepress/.cache/**',
Expand Down Expand Up @@ -87,14 +97,6 @@ export default config(
},
},

{
files: ['**/*.vue'],
rules: {
// FIXME: Issues with vue files
'import-x/no-unresolved': 'off',
},
},

// @ts-expect-error: react plugin types
{
files: ['packages/admin/src/**/*.{js,jsx}'],
Expand Down Expand Up @@ -169,4 +171,5 @@ export default config(
globals: globals.node,
},
},
prettier,
);
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@
"@rollup/plugin-commonjs": "28.0.1",
"@rollup/plugin-node-resolve": "15.3.0",
"@rollup/plugin-replace": "6.0.1",
"@types/node": "22.10.1",
"@types/node": "22.10.2",
"@vitejs/plugin-react": "4.3.4",
"apidoc": "1.2.0",
"commitizen": "4.3.1",
"cross-env": "7.0.3",
"cz-conventional-changelog": "3.3.0",
"eslint": "9.16.0",
"eslint-config-mister-hope": "0.3.0",
"eslint": "9.17.0",
"eslint-config-mister-hope": "0.4.0",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-vue": "9.32.0",
"husky": "9.1.7",
"markdownlint-cli2": "0.15.0",
"markdownlint-cli2": "0.16.0",
"nano-staged": "0.8.0",
"postcss": "8.4.49",
"prettier": "3.4.2",
Expand All @@ -70,13 +70,13 @@
"rollup-plugin-dts": "6.1.1",
"rollup-plugin-esbuild": "6.1.1",
"rollup-plugin-ts": "3.4.5",
"sass-embedded": "1.82.0",
"sass-embedded": "1.83.0",
"sort-package-json": "2.12.0",
"stylelint": "16.11.0",
"stylelint-config-hope": "7.0.4",
"tslib": "2.8.1",
"typescript": "5.7.2",
"vercel": "39.1.3",
"vercel": "39.2.2",
"vite-plugin-css-injected-by-js": "3.5.2",
"vite-plugin-svgr": "4.3.0",
"vitest": "2.1.8"
Expand Down
10 changes: 5 additions & 5 deletions packages/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
"@rematch/core": "2.2.0",
"base-icon": "2.3.2",
"classnames": "2.5.1",
"i18next": "24.0.5",
"i18next-browser-languagedetector": "8.0.1",
"i18next": "24.1.0",
"i18next-browser-languagedetector": "8.0.2",
"md5": "2.3.0",
"qrcode.react": "4.1.0",
"qrcode.react": "4.2.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "15.1.3",
"react-redux": "9.1.2",
"react-i18next": "15.2.0",
"react-redux": "9.2.0",
"react-router": "7.0.2",
"redux": "5.0.1",
"typescript": "5.7.2",
Expand Down
7 changes: 4 additions & 3 deletions packages/admin/src/pages/migration/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ export default function () {
})
: data;

for (const k in body) {
if (body[k] === null || body[k] === undefined) {
delete body[k];
for (const key in body) {
if (body[key] === null || body[key] === undefined) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete body[key];
}
}

Expand Down
10 changes: 6 additions & 4 deletions packages/client/src/components/ArticleReaction.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<script setup lang="ts">
import { getArticleCounter, updateArticleCounter } from '@waline/api';
import type { ComputedRef } from 'vue';
import { computed, inject, onMounted, onUnmounted, ref, watch } from 'vue';
import { LoadingIcon } from './Icons.js';
import { useReactionStorage } from '../composables/index.js';
import type { WalineReactionLocale } from '../typings/index.js';
import type { WalineConfig } from '../utils/index.js';
import { configKey } from '../config/index.js';
defineExpose();
Expand All @@ -17,7 +16,8 @@ interface ReactionItem {
}
const reactionStorage = useReactionStorage();
const config = inject<ComputedRef<WalineConfig>>('config')!;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const config = inject(configKey)!;
const votingIndex = ref(-1);
const voteNumbers = ref<number[]>([]);
Expand Down Expand Up @@ -114,7 +114,9 @@ onMounted(() => {
{ immediate: true },
);
});
onUnmounted(() => abort?.());
onUnmounted(() => {
abort();
});
</script>

<template>
Expand Down
Loading

0 comments on commit 4a30d7c

Please sign in to comment.