Skip to content

Commit b56225b

Browse files
committed
O_O checklist - sentance case UI
1 parent 46993a4 commit b56225b

26 files changed

+153
-85
lines changed

exampleVault/O_O 2024 Checklist.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## Releasing & naming
2+
3+
- [x] Remove placeholder names such as `MyPlugin` and `SampleSettingTab`.
4+
- [x] Don't include the word "Obsidian" in your name unless it absolutely makes sense. Most of the time it's redundant.
5+
- [x] Don't include your plugin name in command names. Obsidian adds this for you.
6+
- [x] Don't prefix commands with your plugin ID. Obsidian adds this for you.
7+
- [ ] Don't include `main.js` in your repo. Only include it in your releases.
8+
- [x] If you haven't, consider add a `fundingUrl` so that users of your plugin can show some support. [Learn more](https://docs.obsidian.md/Reference/Manifest#fundingUrl).
9+
10+
## Compatibility
11+
12+
- [x] Don't provide default hotkeys when possible. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Avoid+setting+a+default+hotkey+for+commands).
13+
- [x] Don't override core styling. If needed, add your own class and make the styling only apply to your class.
14+
- [x] Do scan your code for deprecated methods (they usually show up as strikeout text in IDEs).
15+
- [ ] Don't assign styles via JavaScript or in HTML. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#No+hardcoded+styling).
16+
- [x] Don't access the hardcoded `.obsidian` folder if you need to access the configuration directory. The location could be customized, so please use `Vault.configDir` instead.
17+
18+
## Mobile support
19+
20+
Please only complete this section if you have `isDesktopOnly` set to false in your manifest.
21+
22+
- [x] Don't use node.js modules such as `fs`, `path`, and `electron`.
23+
- [x] Don't use regex lookbehinds if you want to support iOS versions lower than 16.4 (ignore this if you don't use regex in your plugin). [Learn more](https://docs.obsidian.md/Plugins/Getting+started/Mobile+development#Lookbehind+in+regular+expressions).
24+
- [x] Don't use the `FileSystemAdapter` class.
25+
- [x] Don't use `process.platform`, use Obsidian's `Platform` instead. [Link to API](https://docs.obsidian.md/Reference/TypeScript+API/Platform).
26+
- [x] Don't use `fetch` or `axios.get`, use Obsidian's `requestUrl` instead. [Link to API](https://docs.obsidian.md/Reference/TypeScript+API/requestUrl).
27+
28+
## Coding style
29+
30+
- [x] Don't use `var`. Use `let` or `const` instead. [Learn more](https://javascript.plainenglish.io/4-reasons-why-var-is-considered-obsolete-in-modern-javascript-a30296b5f08f).
31+
- [x] Don't use the global `app` instance. Use `this.app` provided to your plugin instance instead. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Avoid%20using%20global%20app%20instance).
32+
- [x] Do break up your `main.ts` into smaller files or even folders if it gets big to make code easier to find.
33+
- [ ] Don't use `Promise`. Use `async` and `await` instead. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Prefer+async%2Fawait+over+Promise).
34+
- [ ] Don't use global variables. Try to keep variables either in the scope of classes or functions. [Learn more](http://wiki.c2.com/?GlobalVariablesAreBad).
35+
- [x] Do test with `instanceof` before casting into other types such as `TFile`, `TFolder`, or `FileSystemAdapter`,
36+
- [ ] Don't use use `as any` and use proper typing instead.
37+
38+
39+
## API usage
40+
41+
- [ ] Don't use `Vault.modify`. If you want to edit the active file, prefer using the `Editor` interface. If you want to edit it in the background, use `Vault.process`.
42+
- [x] Don't manually read and write frontmatter. Instead, use `FileManager.processFrontMatter`. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Prefer+%60FileManager.processFrontMatter%60+to+modify+frontmatter+of+a+note).
43+
- [x] Don't use `vault.delete` to delete files. Use `trashFile` instead to make sure the file is deleted according to the users preferences. [Learn more](https://docs.obsidian.md/Reference/TypeScript+API/FileManager/trashFile).
44+
- [ ] Don't use the `Adapter` API whenever possible. Use `Vault` API instead. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Prefer+the+Vault+API+over+the+Adapter+API).
45+
- [x] Don't manage reading and write plugin data yourself. Use `Plugin.loadData()` and `Plugin.saveData()` instead.
46+
- [ ] Do use `normalizePath()` if you take user defined paths. [Learn more](https://docs.obsidian.md/Reference/TypeScript+API/normalizePath).
47+
48+
49+
## Performance
50+
51+
- [x] Do optimize your plugin's load time. [Detailed guide](https://docs.obsidian.md/Plugins/Guides/Optimizing+plugin+load+time).
52+
- [x] Don't iterate all files to find a file or folder by its path. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Avoid+iterating+all+files+to+find+a+file+by+its+path).
53+
- [x] If you want your plugins to be compatible with Obsidian 1.7.2+ (currently in early access), update your plugin to work with `DeferredViews`. [Detailed guide](https://docs.obsidian.md/Plugins/Guides/Understanding+deferred+views).
54+
- [ ] If you're using `moment`, make sure you're doing `import { moment} from 'obsidian'` so that you don't import another copy.
55+
- [x] Do minimize your `main.js` for releasing.
56+
57+
## User interface
58+
59+
- [x] Don't use setting headings unless you have more than one section. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Only+use+headings+under+settings+if+you+have+more+than+one+section).
60+
- [x] Don't include the word "setting" or "option" in setting headings. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Avoid+%22settings%22+in+settings+headings).
61+
- [ ] Do use sentence case in all text in UI elements to be consistent with rest of Obsidian UI. [Learn more](https://en.wiktionary.org/wiki/sentence_case).
62+
- [x] Don't use `<h1>` or `<h2>` for setting header. Use Obsidian API instead. [Learn more](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Use+%60setHeading%60+instead+of+a+%60%3Ch1%3E%60%2C+%60%3Ch2%3E%60).
63+
- [x] Don't do `console.log` unless they are absolutely necessarily. Remove testing console logs that are not needed for production.

packages/core/src/api/InternalAPI.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export abstract class InternalAPI<Plugin extends IPlugin> {
299299
});
300300
}),
301301
{
302-
title: 'Meta Bind Image Suggester',
302+
title: 'Meta Bind image suggester',
303303
classes: ['mb-image-suggester-modal'],
304304
},
305305
).open();
@@ -320,7 +320,7 @@ export abstract class InternalAPI<Plugin extends IPlugin> {
320320
});
321321
}),
322322
{
323-
title: 'Meta Bind Date Picker',
323+
title: 'Meta Bind date picker',
324324
},
325325
).open();
326326
}
@@ -360,7 +360,7 @@ export abstract class InternalAPI<Plugin extends IPlugin> {
360360
});
361361
}),
362362
{
363-
title: 'Meta Bind Error Overview',
363+
title: 'Meta Bind error overview',
364364
classes: ['mb-error-collection-modal', 'markdown-rendered'],
365365
},
366366
).open();

packages/core/src/metadata/InternalMetadataSources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class GlobalMetadataSource implements IMetadataSource<GlobalMetadataCache
6666
if (hadStoragePath) {
6767
throw new ParsingValidationError(
6868
ErrorLevel.ERROR,
69-
'Bind Target Validator',
69+
'Bind target validator',
7070
`Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.`,
7171
bindTargetDeclaration,
7272
storagePath.position,

packages/core/src/modals/ModalContent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export abstract class ModalContent extends Mountable {
2323
} else {
2424
throw new MetaBindInternalError({
2525
errorLevel: ErrorLevel.CRITICAL,
26-
effect: 'Failed to close modal.',
27-
cause: 'Modal reference in ModalContent is undefined.',
26+
effect: 'Failed to close modal',
27+
cause: 'Modal reference in ModalContent is undefined',
2828
});
2929
}
3030
}

packages/core/src/modals/modalContents/ImageSuggesterModalComponent.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</script>
2929

3030
<div class="mb-image-search-container">
31-
<input type="text" bind:value={search} placeholder="Search Images..." />
31+
<input type="text" bind:value={search} placeholder="Search images..." />
3232
</div>
3333
<div class="mb-image-card-grid">
3434
{#each filteredOptions as option}

packages/core/src/modals/modalContents/buttonBuilder/ButtonBuilderModalComponent.svelte

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,31 @@
6767
6868
function getActionLabel(actionType: ButtonActionType): string {
6969
if (actionType === ButtonActionType.COMMAND) {
70-
return 'Run a Command';
70+
return 'Run a command';
7171
} else if (actionType === ButtonActionType.OPEN) {
72-
return 'Open a Link';
72+
return 'Open a link';
7373
} else if (actionType === ButtonActionType.JS) {
74-
return 'Run a JavaScript File';
74+
return 'Run a JavaScript file';
7575
} else if (actionType === ButtonActionType.INPUT) {
76-
return 'Insert Text at Cursor';
76+
return 'Insert text at cursor';
7777
} else if (actionType === ButtonActionType.SLEEP) {
78-
return 'Sleep for Some Time';
78+
return 'Sleep for some time';
7979
} else if (actionType === ButtonActionType.TEMPLATER_CREATE_NOTE) {
80-
return 'Create a New Note Using Templater';
80+
return 'Create a new note using Templater';
8181
} else if (actionType === ButtonActionType.UPDATE_METADATA) {
82-
return 'Update Metadata';
82+
return 'Update metadata';
8383
} else if (actionType === ButtonActionType.CREATE_NOTE) {
84-
return 'Create a New Note';
84+
return 'Create a new note';
8585
} else if (actionType === ButtonActionType.REPLACE_IN_NOTE) {
86-
return 'Replace Text in Note';
86+
return 'Replace text in note';
8787
} else if (actionType === ButtonActionType.REGEXP_REPLACE_IN_NOTE) {
88-
return 'Replace Text in Note using Regexp';
88+
return 'Replace text in note using regexp';
8989
} else if (actionType === ButtonActionType.REPLACE_SELF) {
90-
return 'Replace Button with Text';
90+
return 'Replace button with text';
9191
} else if (actionType === ButtonActionType.INSERT_INTO_NOTE) {
92-
return 'Insert Text into the Note';
92+
return 'Insert text into the note';
9393
} else if (actionType === ButtonActionType.INLINE_JS) {
94-
return 'Run JavaScript Code';
94+
return 'Run JavaScript code';
9595
}
9696
9797
expectType<never>(actionType);
@@ -166,7 +166,7 @@
166166
</SettingComponent>
167167

168168
<SettingComponent
169-
name="CSS Classes"
169+
name="CSS classes"
170170
description="A list of CSS classes to add to the button. Multiple classes should be separated by a space."
171171
>
172172
<input type="text" bind:value={buttonConfig.class} />

packages/core/src/modals/modalContents/buttonBuilder/CreateNoteActionSettings.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
<Button variant={ButtonStyleType.PRIMARY} onclick={() => createNoteActionChangeFolderPath(action)}>Change</Button>
3030
</SettingComponent>
3131

32-
<SettingComponent name="File Name: {action.fileName || 'default'}" description="The file name of the new note.">
32+
<SettingComponent name="File name: {action.fileName || 'default'}" description="The file name of the new note.">
3333
<input type="text" bind:value={action.fileName} placeholder="some name" />
3434
</SettingComponent>
3535

36-
<SettingComponent name="Open Note" description="Whether to open the new note after this action ran.">
36+
<SettingComponent name="Open note" description="Whether to open the new note after this action ran.">
3737
<Toggle bind:checked={action.openNote}></Toggle>
3838
</SettingComponent>
3939

4040
<SettingComponent
41-
name="Open If Note Already Exists"
41+
name="Open if note already xxists"
4242
description="Whether to open the note instead of creating a new one if the note already exists."
4343
>
4444
<Toggle bind:checked={action.openIfAlreadyExists}></Toggle>

packages/core/src/modals/modalContents/buttonBuilder/InlineJsActionSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
} = $props();
1313
</script>
1414

15-
<SettingComponent name="JS Code" description="The JavaScript code to run."></SettingComponent>
15+
<SettingComponent name="JS code" description="The JavaScript code to run."></SettingComponent>
1616

1717
<div class="meta-bind-full-width meta-bind-high">
1818
<textarea bind:value={action.code}></textarea>

packages/core/src/modals/modalContents/buttonBuilder/InsertIntoNoteActionSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<input type="number" bind:value={action.line} placeholder="0" />
1717
</SettingComponent>
1818

19-
<SettingComponent name="Text to Insert" description="The text to insert into the note."></SettingComponent>
19+
<SettingComponent name="Text to insert" description="The text to insert into the note."></SettingComponent>
2020
<div class="meta-bind-full-width meta-bind-high">
2121
<textarea bind:value={action.value}></textarea>
2222
</div>

packages/core/src/modals/modalContents/buttonBuilder/JSActionSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
} = $props();
1313
</script>
1414

15-
<SettingComponent name="JS File" description="The JavaScript file to run.">
15+
<SettingComponent name="JS file" description="The JavaScript file to run.">
1616
<input type="text" bind:value={action.file} placeholder="someJsFile.js" />
1717
</SettingComponent>

packages/core/src/modals/modalContents/buttonBuilder/OpenActionSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
<input type="text" bind:value={action.link} placeholder="[[Some Note]] or https://www.example.com" />
1818
</SettingComponent>
1919

20-
<SettingComponent name="New Tab" description="Whether to open the link in a new tab.">
20+
<SettingComponent name="New tab" description="Whether to open the link in a new tab.">
2121
<Toggle bind:checked={action.newTab}></Toggle>
2222
</SettingComponent>

packages/core/src/modals/modalContents/buttonBuilder/RegexpReplaceInNoteActionSettings.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<input type="text" bind:value={action.regexp} />
1717
</SettingComponent>
1818

19-
<SettingComponent name="Regexp Flags" description="The regexp flags for this regexp.">
19+
<SettingComponent name="Regexp flags" description="The regexp flags for this regexp.">
2020
<input type="text" bind:value={action.regexpFlags} placeholder="g" />
2121
</SettingComponent>
2222

23-
<SettingComponent name="Replacement Text" description="The text to replace the button with."></SettingComponent>
23+
<SettingComponent name="Replacement text" description="The text to replace the button with."></SettingComponent>
2424
<div class="meta-bind-full-width meta-bind-high">
2525
<textarea bind:value={action.replacement}></textarea>
2626
</div>

packages/core/src/modals/modalContents/buttonBuilder/ReplaceInNoteActionSettings.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
} = $props();
1313
</script>
1414

15-
<SettingComponent name="Line From" description="The line that marks the start of the area to replace.">
15+
<SettingComponent name="Line from" description="The line that marks the start of the area to replace.">
1616
<input type="number" bind:value={action.fromLine} placeholder="0" />
1717
</SettingComponent>
1818

19-
<SettingComponent name="Line To" description="The line that marks the end of the area to replace.">
19+
<SettingComponent name="Line to" description="The line that marks the end of the area to replace.">
2020
<input type="number" bind:value={action.toLine} placeholder="0" />
2121
</SettingComponent>
2222

23-
<SettingComponent name="Replacement Text" description="The text to replace the note section."></SettingComponent>
23+
<SettingComponent name="Replacement text" description="The text to replace the note section."></SettingComponent>
2424
<div class="meta-bind-full-width meta-bind-high">
2525
<textarea bind:value={action.replacement}></textarea>
2626
</div>

packages/core/src/modals/modalContents/buttonBuilder/ReplaceSelfActionSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
} = $props();
1313
</script>
1414

15-
<SettingComponent name="Replacement Text" description="The text to replace the match with."></SettingComponent>
15+
<SettingComponent name="Replacement text" description="The text to replace the match with."></SettingComponent>
1616
<div class="meta-bind-full-width meta-bind-high">
1717
<textarea bind:value={action.replacement}></textarea>
1818
</div>

packages/core/src/modals/modalContents/buttonBuilder/SleepActionSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
} = $props();
1313
</script>
1414

15-
<SettingComponent name="Sleep Time" description="The time to sleep in milliseconds.">
15+
<SettingComponent name="Sleep time" description="The time to sleep in milliseconds.">
1616
<input type="number" bind:value={action.ms} placeholder="100 ms" />
1717
</SettingComponent>

packages/core/src/modals/modalContents/buttonBuilder/TemplaterCreateNoteActionSettings.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</script>
3737

3838
<SettingComponent
39-
name="Template File: {action.templateFile || 'none'}"
39+
name="Template file: {action.templateFile || 'none'}"
4040
description="The template file to create a new note of."
4141
>
4242
<Button variant={ButtonStyleType.PRIMARY} onclick={() => templaterCreateNoteActionChangeTemplateFile(action)}
@@ -50,16 +50,16 @@
5050
</Button>
5151
</SettingComponent>
5252

53-
<SettingComponent name="File Name: {action.fileName || 'default'}" description="The file name of the new note.">
53+
<SettingComponent name="File name: {action.fileName || 'default'}" description="The file name of the new note.">
5454
<input type="text" bind:value={action.fileName} placeholder="some name" />
5555
</SettingComponent>
5656

57-
<SettingComponent name="Open Note" description="Whether to open the new note after this action ran.">
57+
<SettingComponent name="Open note" description="Whether to open the new note after this action ran.">
5858
<Toggle bind:checked={action.openNote}></Toggle>
5959
</SettingComponent>
6060

6161
<SettingComponent
62-
name="Open If Note Already Exists"
62+
name="Open if note already exists"
6363
description="Whether to open the note instead of creating a new one if the note already exists."
6464
>
6565
<Toggle bind:checked={action.openIfAlreadyExists}></Toggle>

packages/core/src/modals/modalContents/buttonBuilder/UpdateMetadataActionSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
} = $props();
1414
</script>
1515

16-
<SettingComponent name="Metadata Property" description="The metadata property in form of a bind target.">
16+
<SettingComponent name="Metadata property" description="The metadata property in form of a bind target.">
1717
<input type="text" bind:value={action.bindTarget} placeholder="some value" />
1818
</SettingComponent>
1919

packages/obsidian/src/dependencies/DependencyManager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class DependencyManager {
1919
if (dependency === undefined) {
2020
throw new MetaBindDependencyError({
2121
errorLevel: ErrorLevel.CRITICAL,
22-
effect: `Dependency Violation Detected`,
22+
effect: `Dependency violation detected`,
2323
cause: `Attempted to access dependency ${pluginId} which is not a listed dependency. Please report this error.`,
2424
});
2525
}
@@ -33,7 +33,7 @@ export class DependencyManager {
3333
private throwPluginNotFound(pluginId: string): void {
3434
throw new MetaBindDependencyError({
3535
errorLevel: ErrorLevel.ERROR,
36-
effect: `Dependency Violation Detected`,
36+
effect: `Dependency violation detected`,
3737
cause: `Plugin ${pluginId} is required, but not installed. Please install the plugin.`,
3838
});
3939
}
@@ -42,7 +42,7 @@ export class DependencyManager {
4242
if (Version.lessThan(version, dependency.minVersion)) {
4343
throw new MetaBindDependencyError({
4444
errorLevel: ErrorLevel.ERROR,
45-
effect: `Dependency Violation Detected`,
45+
effect: `Dependency violation detected`,
4646
cause: `Plugin ${dependency.pluginId} is outdated. Required version is at least ${dependency.minVersion}, installed version is ${version}. Please update the plugin.`,
4747
});
4848
}
@@ -53,7 +53,7 @@ export class DependencyManager {
5353
) {
5454
throw new MetaBindDependencyError({
5555
errorLevel: ErrorLevel.ERROR,
56-
effect: `Dependency Violation Detected`,
56+
effect: `Dependency violation detected`,
5757
cause: `Plugin ${dependency.pluginId} is too new. Required version is lower than ${dependency.maxVersion}, installed version is ${version}. Please downgrade the plugin.`,
5858
});
5959
}

packages/obsidian/src/playground/PlaygroundView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class PlaygroundView extends ItemView {
2121
}
2222

2323
getDisplayText(): string {
24-
return 'Meta Bind Playground';
24+
return 'Meta Bind playground';
2525
}
2626

2727
// eslint-disable-next-line @typescript-eslint/require-await

0 commit comments

Comments
 (0)