mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
⬆️ eslint
This commit is contained in:
parent
1087fe8d52
commit
ad10151684
8 changed files with 435 additions and 333 deletions
|
|
@ -1,6 +0,0 @@
|
||||||
build
|
|
||||||
node_modules
|
|
||||||
src/asset/pdf
|
|
||||||
src/types/dist
|
|
||||||
stage
|
|
||||||
appearance
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
env: {node: true, browser: true, es6: true},
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
plugins: [
|
|
||||||
"@typescript-eslint",
|
|
||||||
],
|
|
||||||
extends: [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
semi: [2, "always"],
|
|
||||||
quotes: [2, "double", {"avoidEscape": true}],
|
|
||||||
"no-async-promise-executor": "off",
|
|
||||||
"no-prototype-builtins": "off",
|
|
||||||
"no-useless-escape": "off",
|
|
||||||
"no-irregular-whitespace": "off",
|
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
|
||||||
"@typescript-eslint/no-var-requires": "off",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": "off",
|
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -320,7 +320,11 @@ const initMainWindow = () => {
|
||||||
});
|
});
|
||||||
remote.enable(currentWindow.webContents);
|
remote.enable(currentWindow.webContents);
|
||||||
|
|
||||||
resetToCenter ? currentWindow.center() : currentWindow.setPosition(x, y);
|
if (resetToCenter) {
|
||||||
|
currentWindow.center();
|
||||||
|
} else {
|
||||||
|
currentWindow.setPosition(x, y);
|
||||||
|
}
|
||||||
currentWindow.webContents.userAgent = "SiYuan/" + appVer + " https://b3log.org/siyuan Electron " + currentWindow.webContents.userAgent;
|
currentWindow.webContents.userAgent = "SiYuan/" + appVer + " https://b3log.org/siyuan Electron " + currentWindow.webContents.userAgent;
|
||||||
|
|
||||||
// set proxy
|
// set proxy
|
||||||
|
|
|
||||||
59
app/eslint.config.mjs
Normal file
59
app/eslint.config.mjs
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
||||||
|
import globals from "globals";
|
||||||
|
import tsParser from "@typescript-eslint/parser";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import js from "@eslint/js";
|
||||||
|
import { FlatCompat } from "@eslint/eslintrc";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all
|
||||||
|
});
|
||||||
|
|
||||||
|
export default [{
|
||||||
|
ignores: [
|
||||||
|
"build",
|
||||||
|
"node_modules",
|
||||||
|
"src/asset/pdf",
|
||||||
|
"src/types/dist",
|
||||||
|
"stage",
|
||||||
|
"appearance",
|
||||||
|
],
|
||||||
|
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
|
||||||
|
plugins: {
|
||||||
|
"@typescript-eslint": typescriptEslint,
|
||||||
|
},
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...globals.browser,
|
||||||
|
},
|
||||||
|
|
||||||
|
parser: tsParser,
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
semi: [2, "always"],
|
||||||
|
|
||||||
|
quotes: [2, "double", {
|
||||||
|
avoidEscape: true,
|
||||||
|
}],
|
||||||
|
|
||||||
|
"no-async-promise-executor": "off",
|
||||||
|
"no-prototype-builtins": "off",
|
||||||
|
"no-useless-escape": "off",
|
||||||
|
"no-irregular-whitespace": "off",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "off",
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
|
},
|
||||||
|
}];
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.13.0",
|
"@types/node": "^18.13.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
||||||
"@typescript-eslint/parser": "^5.30.6",
|
"@typescript-eslint/parser": "^8.15.0",
|
||||||
"blueimp-md5": "^2.19.0",
|
"blueimp-md5": "^2.19.0",
|
||||||
"clean-webpack-plugin": "^4.0.0",
|
"clean-webpack-plugin": "^4.0.0",
|
||||||
"css-loader": "^6.7.1",
|
"css-loader": "^6.7.1",
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
"electron-builder": "24.13.3",
|
"electron-builder": "24.13.3",
|
||||||
"encoding": "^0.1.13",
|
"encoding": "^0.1.13",
|
||||||
"esbuild-loader": "^3.0.1",
|
"esbuild-loader": "^3.0.1",
|
||||||
"eslint": "^8.19.0",
|
"eslint": "^9.15.0",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"html-loader": "^2.1.2",
|
"html-loader": "^2.1.2",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"html-webpack-plugin": "^5.5.0",
|
||||||
|
|
@ -74,7 +74,8 @@
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
"webpack": "^5.94.0",
|
"webpack": "^5.94.0",
|
||||||
"webpack-bundle-analyzer": "^4.5.0",
|
"webpack-bundle-analyzer": "^4.5.0",
|
||||||
"webpack-cli": "^4.10.0"
|
"webpack-cli": "^4.10.0",
|
||||||
|
"globals": "^15.12.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/remote": "^2.1.2"
|
"@electron/remote": "^2.1.2"
|
||||||
|
|
|
||||||
640
app/pnpm-lock.yaml
generated
640
app/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -19,7 +19,9 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
|
||||||
document.querySelector("#dockMoveItem")?.remove();
|
document.querySelector("#dockMoveItem")?.remove();
|
||||||
} else {
|
} else {
|
||||||
const startElement = ghostElement.parentElement.querySelector(`[data-node-id="${ghostElement.getAttribute("data-node-id")}"]`) as HTMLElement;
|
const startElement = ghostElement.parentElement.querySelector(`[data-node-id="${ghostElement.getAttribute("data-node-id")}"]`) as HTMLElement;
|
||||||
startElement ? startElement.style.opacity = "" : "";
|
if (startElement) {
|
||||||
|
startElement.style.opacity = "";
|
||||||
|
}
|
||||||
ghostElement.parentElement.querySelectorAll(".dragover__top, .dragover__bottom, .dragover").forEach((item: HTMLElement) => {
|
ghostElement.parentElement.querySelectorAll(".dragover__top, .dragover__bottom, .dragover").forEach((item: HTMLElement) => {
|
||||||
item.classList.remove("dragover__top", "dragover__bottom", "dragover");
|
item.classList.remove("dragover__top", "dragover__bottom", "dragover");
|
||||||
item.style.opacity = "";
|
item.style.opacity = "";
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,9 @@ export const publish = {
|
||||||
) => {
|
) => {
|
||||||
if (response.code === 0) {
|
if (response.code === 0) {
|
||||||
window.siyuan.config.publish = response.data.publish;
|
window.siyuan.config.publish = response.data.publish;
|
||||||
|
if (reloadAccounts) {
|
||||||
reloadAccounts && publish._renderPublishAuthAccounts(publish.element);
|
publish._renderPublishAuthAccounts(publish.element);
|
||||||
|
}
|
||||||
publish._renderPublishAddressList(publish.element, response.data.port);
|
publish._renderPublishAddressList(publish.element, response.data.port);
|
||||||
} else {
|
} else {
|
||||||
publish._renderPublishAddressList(publish.element, 0);
|
publish._renderPublishAddressList(publish.element, 0);
|
||||||
|
|
@ -127,8 +128,8 @@ export const publish = {
|
||||||
) => {
|
) => {
|
||||||
const publishAuthAccounts = element.querySelector<HTMLDivElement>("#publishAuthAccounts");
|
const publishAuthAccounts = element.querySelector<HTMLDivElement>("#publishAuthAccounts");
|
||||||
publishAuthAccounts.innerHTML = `<ul class="fn__flex-1" style="margin-top: 16px">${
|
publishAuthAccounts.innerHTML = `<ul class="fn__flex-1" style="margin-top: 16px">${
|
||||||
accounts
|
accounts
|
||||||
.map((account, index) => `
|
.map((account, index) => `
|
||||||
<li class="b3-label--inner fn__flex" data-index="${index}">
|
<li class="b3-label--inner fn__flex" data-index="${index}">
|
||||||
<input class="b3-text-field fn__block" data-name="username" value="${account.username}" placeholder="${window.siyuan.languages.userName}">
|
<input class="b3-text-field fn__block" data-name="username" value="${account.username}" placeholder="${window.siyuan.languages.userName}">
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
|
|
@ -143,9 +144,9 @@ export const publish = {
|
||||||
<svg><use xlink:href="#iconTrashcan"></use></svg>
|
<svg><use xlink:href="#iconTrashcan"></use></svg>
|
||||||
</span>
|
</span>
|
||||||
</li>`
|
</li>`
|
||||||
)
|
)
|
||||||
.join("")
|
.join("")
|
||||||
}</ul>`;
|
}</ul>`;
|
||||||
|
|
||||||
/* account field changed */
|
/* account field changed */
|
||||||
publishAuthAccounts
|
publishAuthAccounts
|
||||||
|
|
@ -202,8 +203,8 @@ export const publish = {
|
||||||
.filter(ip => !(ip.startsWith("[") && ip.endsWith("]")))
|
.filter(ip => !(ip.startsWith("[") && ip.endsWith("]")))
|
||||||
.map(ip => `<li><code class="fn__code">${ip}:${port}</code></li>`)
|
.map(ip => `<li><code class="fn__code">${ip}:${port}</code></li>`)
|
||||||
.join("")
|
.join("")
|
||||||
}${
|
}${
|
||||||
window.siyuan.config.localIPs
|
window.siyuan.config.localIPs
|
||||||
.filter(ip => (ip.startsWith("[") && ip.endsWith("]")))
|
.filter(ip => (ip.startsWith("[") && ip.endsWith("]")))
|
||||||
.map(ip => `<li><code class="fn__code">${ip}:${port}</code></li>`)
|
.map(ip => `<li><code class="fn__code">${ip}:${port}</code></li>`)
|
||||||
.join("")
|
.join("")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue