Warning
This is not ready to be used in production yet.
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-obsidianmd
:
npm install eslint-plugin-obsidianmd --save-dev
Add obsidianmd
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"obsidianmd"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"obsidian/rule-name": 2
}
}
Name | |
---|---|
✅ | recommended |
💼 Configurations enabled in.
✅ Set in the recommended
configuration.
🔧 Automatically fixable by the --fix
CLI option.
Name | Description | 💼 | 🔧 |
---|---|---|---|
commands | Command guidelines | ✅ | |
detach-leaves | Don't detach leaves in onunload. | ✅ | 🔧 |
hardcoded-config-path | test | ✅ | |
no-tfile-tfolder-cast | Disallow type casting to TFile or TFolder, suggesting instanceof checks instead. | ✅ | |
no-view-references-in-plugin | Disallow storing references to custom views directly in the plugin, which can cause memory leaks. | ✅ | |
object-assign | Object.assign with two parameters instead of 3. | ✅ | |
platform | Disallow use of navigator API for OS detection | ✅ | |
regex-lookbehind | Using lookbehinds in Regex is not supported in some iOS versions | ✅ | |
sample-names | Rename sample plugin class names | ✅ | |
settings-tab | Discourage common anti-patterns in plugin settings tabs. | ✅ | 🔧 |
vault-iterate | Avoid iterating all files to find a file by its path |
✅ | 🔧 |