You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-obsidianmd:
npm install eslint-plugin-obsidianmd --save-devWith the release of ESLint v9, the default configuration file is now eslint.config.js.
To use the recommended configuration, add it to your eslint.config.js file. This will enable all the recommended rules.
// eslint.config.mjs
import tsparser from "@typescript-eslint/parser";
import { defineConfig } from "eslint/config";
import obsidianmd from "eslint-plugin-obsidianmd";
export default defineConfig([
...obsidianmd.configs.recommended,
{
files: ["**/*.ts"],
languageOptions: {
parser: tsparser,
parserOptions: { project: "./tsconfig.json" },
},
// You can add your own configuration to override or add rules
rules: {
// example: turn off a rule from the recommended set
"obsidianmd/sample-names": "off",
// example: add a rule not in the recommended set and set its severity
"obsidianmd/prefer-file-manager-trash": "error",
},
},
]);Click here for ESLint v8 and older
To use the recommended configuration, extend it in your .eslintrc file:
{
"extends": ["plugin:obsidianmd/recommended"]
}You can also override or add rules:
{
"extends": ["plugin:obsidianmd/recommended"],
"rules": {
"obsidianmd/sample-names": "off",
"obsidianmd/prefer-file-manager-trash": "error"
}
}| Name | |
|---|---|
| ✅ | recommended |
| 🇬🇧 | recommendedWithLocalesEn |
💼 Configurations enabled in.
🚫 Configurations disabled in.
✅ Set in the recommended configuration.
🇬🇧 Set in the recommendedWithLocalesEn configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.
Checks UI strings for sentence case. The rule reports warnings but doesn't change text unless you run ESLint with --fix and enable allowAutoFix.
- Included at warn level in
recommendedconfig - Extended locale checks available via
recommendedWithLocalesEn - By default allows CamelCase words like
AutoReveal - Set
enforceCamelCaseLower: trueto flag CamelCase as incorrect
// eslint.config.mjs
import tsparser from "@typescript-eslint/parser";
import { defineConfig } from "eslint/config";
import obsidianmd from "eslint-plugin-obsidianmd";
export default defineConfig([
...obsidianmd.configs.recommended,
// Or include English locale files (JSON and TS/JS modules)
// ...obsidianmd.configs.recommendedWithLocalesEn,
{
files: ["**/*.ts"],
languageOptions: {
parser: tsparser,
parserOptions: { project: "./tsconfig.json" },
},
// Optional project overrides
rules: {
"obsidianmd/ui/sentence-case": [
"warn",
{
brands: ["YourBrand"],
acronyms: ["OK"],
enforceCamelCaseLower: true,
},
],
},
},
]);- Hyphenated words:
Auto-Revealbecomesauto-reveal - Locale file patterns in
recommendedWithLocalesEn:en*.json,en*.ts,en*.js,en/**/*
Sentence detection may incorrectly split on abbreviations (Dr., Inc., etc.). Use single sentences or adjust rule options when needed.
