update sample plugin with eslint instructions
This commit is contained in:
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
@@ -2,9 +2,9 @@ name: Node.js build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["master"]
|
branches: ["**"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["master"]
|
branches: ["**"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -7,7 +7,7 @@ The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definiti
|
|||||||
|
|
||||||
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 modal (simple)" which opens a Modal.
|
||||||
- Adds a plugin setting tab to the settings page.
|
- Adds a plugin setting tab to the settings page.
|
||||||
- Registers a global click event and output 'click' to the console.
|
- Registers a global click event and output 'click' to the console.
|
||||||
- Registers a global interval which logs 'setInterval' to the console.
|
- Registers a global interval which logs 'setInterval' to the console.
|
||||||
@@ -55,15 +55,11 @@ 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
|
||||||
- [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:
|
- This project already has eslint preconfigured, you can invoke a check by running`npm run lint`
|
||||||
- `npm install -g eslint`
|
- Together with a custom eslint [plugin](https://github.com/eslint-plugin) for Obsidan specific code guidelines.
|
||||||
- To use eslint to analyze this project use this command:
|
- A GitHub action is preconfigured to automatically lint every commit on all branches.
|
||||||
- `eslint main.ts`
|
|
||||||
- eslint will then create a report with suggestions for code improvement by file and line number.
|
|
||||||
- If your source code is in a folder, such as `src`, you can use eslint with this command to analyze all files in that folder:
|
|
||||||
- `eslint .\src\`
|
|
||||||
|
|
||||||
## Funding URL
|
## Funding URL
|
||||||
|
|
||||||
@@ -91,4 +87,4 @@ If you have multiple URLs, you can also do:
|
|||||||
|
|
||||||
## API Documentation
|
## API Documentation
|
||||||
|
|
||||||
See https://github.com/obsidianmd/obsidian-api
|
See https://docs.obsidian.md
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ export default tseslint.config(
|
|||||||
"node_modules",
|
"node_modules",
|
||||||
"dist",
|
"dist",
|
||||||
"esbuild.config.mjs",
|
"esbuild.config.mjs",
|
||||||
|
"eslint.config.js",
|
||||||
"version-bump.mjs",
|
"version-bump.mjs",
|
||||||
"versions.json",
|
"versions.json",
|
||||||
"main.js",
|
"main.js",
|
||||||
]),
|
]),
|
||||||
|
|
||||||
);
|
);
|
||||||
3141
package-lock.json
generated
3141
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
|||||||
"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",
|
||||||
|
"type": "module",
|
||||||
"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",
|
||||||
@@ -15,10 +16,13 @@
|
|||||||
"@types/node": "^16.11.6",
|
"@types/node": "^16.11.6",
|
||||||
"builtin-modules": "3.3.0",
|
"builtin-modules": "3.3.0",
|
||||||
"esbuild": "0.25.5",
|
"esbuild": "0.25.5",
|
||||||
"eslint-plugin-obsidianmd": "0.1.5",
|
"eslint-plugin-obsidianmd": "file:../eslint-plugin",
|
||||||
"globals": "14.0.0",
|
"globals": "14.0.0",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.4.0",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3",
|
||||||
|
"typescript-eslint": "8.35.1",
|
||||||
|
"@eslint/js": "9.30.1",
|
||||||
|
"jiti": "2.6.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"obsidian": "latest"
|
"obsidian": "latest"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {App, Editor, MarkdownView, Modal, moment, Notice, Plugin} from 'obsidian';
|
import {App, Editor, MarkdownView, Modal, Notice, Plugin} from 'obsidian';
|
||||||
import {DEFAULT_SETTINGS, MyPluginSettings, SampleSettingTab} from "./settings";
|
import {DEFAULT_SETTINGS, MyPluginSettings, SampleSettingTab} from "./settings";
|
||||||
|
|
||||||
// Remember to rename these classes and interfaces!
|
// Remember to rename these classes and interfaces!
|
||||||
@@ -71,7 +71,6 @@ export default class MyPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onunload() {
|
onunload() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadSettings() {
|
async loadSettings() {
|
||||||
|
|||||||
Reference in New Issue
Block a user