Formate all files

This commit is contained in:
Jiean Yang 2024-08-27 19:56:32 +02:00
parent 2af50b85cf
commit eb6d87a4c8
9 changed files with 2313 additions and 2318 deletions

View File

@ -5,6 +5,8 @@ root = true
charset = utf-8 charset = utf-8
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
indent_style = tab # indent_style = tab
indent_size = 4 # indent_size = 4
tab_width = 4 # tab_width = 4
indent_style = space
indent_size = 2

View File

@ -1,23 +1,21 @@
{ {
"root": true, "root": true,
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"env": { "node": true }, "env": { "node": true },
"plugins": [ "plugins": ["@typescript-eslint"],
"@typescript-eslint" "extends": [
], "eslint:recommended",
"extends": [ "plugin:@typescript-eslint/eslint-recommended",
"eslint:recommended", "plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/eslint-recommended", ],
"plugin:@typescript-eslint/recommended" "parserOptions": {
], "sourceType": "module"
"parserOptions": { },
"sourceType": "module" "rules": {
}, "no-unused-vars": "off",
"rules": { "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"no-unused-vars": "off", "@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }], "no-prototype-builtins": "off",
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/no-empty-function": "off"
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
} }
}

View File

@ -8,6 +8,7 @@ The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definiti
**Note:** The Obsidian API is still in early alpha and is subject to change at any time! **Note:** The Obsidian API is still in early alpha and is subject to change at any time!
This sample plugin demonstrates some of the basic functionality the plugin API can do. This sample plugin demonstrates some of the basic functionality the plugin API can do.
- Adds a ribbon icon, which shows a Notice when clicked. - Adds a ribbon icon, which shows a Notice when clicked.
- Adds a command "Open Sample Modal" which opens a Modal. - Adds a command "Open Sample Modal" which opens a Modal.
- Adds a plugin setting tab to the settings page. - Adds a plugin setting tab to the settings page.
@ -58,6 +59,7 @@ Quick starting guide for new plugin devs:
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`. - Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
## Improve code quality with eslint (optional) ## Improve code quality with eslint (optional)
- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code. - [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code.
- To use eslint with this project, make sure to install eslint from terminal: - To use eslint with this project, make sure to install eslint from terminal:
- `npm install -g eslint` - `npm install -g eslint`
@ -75,7 +77,7 @@ The simple way is to set the `fundingUrl` field to your link in your `manifest.j
```json ```json
{ {
"fundingUrl": "https://buymeacoffee.com" "fundingUrl": "https://buymeacoffee.com"
} }
``` ```
@ -83,11 +85,11 @@ If you have multiple URLs, you can also do:
```json ```json
{ {
"fundingUrl": { "fundingUrl": {
"Buy Me a Coffee": "https://buymeacoffee.com", "Buy Me a Coffee": "https://buymeacoffee.com",
"GitHub Sponsor": "https://github.com/sponsors", "GitHub Sponsor": "https://github.com/sponsors",
"Patreon": "https://www.patreon.com/" "Patreon": "https://www.patreon.com/"
} }
} }
``` ```

View File

@ -2,48 +2,48 @@ import esbuild from "esbuild";
import process from "process"; import process from "process";
import builtins from "builtin-modules"; import builtins from "builtin-modules";
const banner = const banner = `/*
`/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin if you want to view the source, please visit the github repository of this plugin
*/ */
`; `;
const prod = (process.argv[2] === "production"); const prod = process.argv[2] === "production";
const context = await esbuild.context({ const context = await esbuild.context({
banner: { banner: {
js: banner, js: banner,
}, },
entryPoints: ["main.ts"], entryPoints: ["main.ts"],
bundle: true, bundle: true,
external: [ external: [
"obsidian", "obsidian",
"electron", "electron",
"@codemirror/autocomplete", "@codemirror/autocomplete",
"@codemirror/collab", "@codemirror/collab",
"@codemirror/commands", "@codemirror/commands",
"@codemirror/language", "@codemirror/language",
"@codemirror/lint", "@codemirror/lint",
"@codemirror/search", "@codemirror/search",
"@codemirror/state", "@codemirror/state",
"@codemirror/view", "@codemirror/view",
"@lezer/common", "@lezer/common",
"@lezer/highlight", "@lezer/highlight",
"@lezer/lr", "@lezer/lr",
...builtins], ...builtins,
format: "cjs", ],
target: "es2018", format: "cjs",
logLevel: "info", target: "es2018",
sourcemap: prod ? false : "inline", logLevel: "info",
treeShaking: true, sourcemap: prod ? false : "inline",
outfile: "main.js", treeShaking: true,
minify: prod, outfile: "main.js",
minify: prod,
}); });
if (prod) { if (prod) {
await context.rebuild(); await context.rebuild();
process.exit(0); process.exit(0);
} else { } else {
await context.watch(); await context.watch();
} }

View File

@ -1,11 +1,11 @@
{ {
"id": "my-obsidian-copilot", "id": "my-obsidian-copilot",
"name": "My Obsidian Copilot", "name": "My Obsidian Copilot",
"version": "1.0.0", "version": "1.0.0",
"minAppVersion": "0.15.0", "minAppVersion": "0.15.0",
"description": "Demonstrates some of the capabilities of the Obsidian API.", "description": "Demonstrates some of the capabilities of the Obsidian API.",
"author": "Obsidian", "author": "Obsidian",
"authorUrl": "https://obsidian.md", "authorUrl": "https://obsidian.md",
"fundingUrl": "https://obsidian.md/pricing", "fundingUrl": "https://obsidian.md/pricing",
"isDesktopOnly": false "isDesktopOnly": false
} }

4422
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,24 @@
{ {
"name": "my-obsidian-copilot", "name": "my-obsidian-copilot",
"version": "1.0.0", "version": "1.0.0",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)", "description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
"dev": "node esbuild.config.mjs", "dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json" "version": "node version-bump.mjs && git add manifest.json versions.json"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/node": "^16.11.6", "@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0", "@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0", "builtin-modules": "3.3.0",
"esbuild": "0.17.3", "esbuild": "0.17.3",
"obsidian": "latest", "obsidian": "latest",
"tslib": "2.4.0", "tslib": "2.4.0",
"typescript": "4.7.4" "typescript": "4.7.4"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", // "baseUrl": ".", // Use absolute paths
"inlineSourceMap": true, "inlineSourceMap": true,
"inlineSources": true, "inlineSources": true,
"module": "ESNext", "module": "ESNext",
@ -11,14 +11,7 @@
"importHelpers": true, "importHelpers": true,
"isolatedModules": true, "isolatedModules": true,
"strictNullChecks": true, "strictNullChecks": true,
"lib": [ "lib": ["DOM", "ES5", "ES6", "ES7"]
"DOM",
"ES5",
"ES6",
"ES7"
]
}, },
"include": [ "include": ["**/*.ts"]
"**/*.ts"
]
} }

View File

@ -1,3 +1,3 @@
{ {
"1.0.0": "0.15.0" "1.0.0": "0.15.0"
} }