Skip to content

Conversation

@chrisgrieser
Copy link
Contributor

If you use a linter other than eslint (in my case biome), you may want to only enable Obsidian-specific rules, without all the other eslint rules resulting in duplicate warnings, the need to configure eslint for your specific setup, etc.

currently, there is no direct export of the obsidian-plugin-only rules, so I added that, along with a documentation how to configure eslint for that.

@joethei
Copy link
Collaborator

joethei commented Nov 11, 2025

Some external rules should still be enabled by default or have documented replacements in the other linter.

  • no-eval
  • no-implied-eval
  • no-console
  • no-restricted-globals
  • no-restricted-imports
  • the two rules imported from @microsoft/sdl
  • import/no-nodejs-modules

@chrisgrieser
Copy link
Contributor Author

I don't know about enabled by default, because that would exactly result in the problem of duplicate diagnostics with the other linters.

Maintaining a list of equivalent rules with other linters is going to be tedious, since there are numerous linters which might also change rule structure over time.

I think the best solution would be to just document the list of non-obsidian-but-still-recommended rules in the Readme?

@saberzero1
Copy link
Contributor

Some external rules should still be enabled by default or have documented replacements in the other linter.

  • no-eval
  • no-implied-eval
  • no-console
  • no-restricted-globals
  • no-restricted-imports
  • the two rules imported from @microsoft/sdl
  • import/no-nodejs-modules

I looked into this. Most of these rules have a Biome equivalent, but not all. import/no-nodejs-modules could probably be covered by adding Node builtins to restricted imports, but no-implied-eval and @microsoft/sdl/no-document-write seem to require additional effort.

ESLint rule Biome equivalent Notes & config snippet
no-eval noGlobalEval Biome rule: "noGlobalEval" rejects use of eval(). (Biome)
Example config:
json { "linter": { "rules": { "correctness": { "noGlobalEval": "error" } } } }
no-implied-eval No exact direct equivalent found ESLint’s no-implied-eval forbids e.g. setTimeout("…", 1000). Biome doesn’t list a dedicated rule by that name. You could potentially use noGlobalEval to cover eval() calls, but implied-eval via strings may not be covered yet.
no-console noConsole Biome lists noConsole as the equivalent for ESLint’s no-console. (Biome)
Example:
json { "linter": { "rules": { "correctness": { "noConsole": "error" } } } }
no-restricted-globals noRestrictedGlobals Biome maps ESLint’s no-restricted-globals to noRestrictedGlobals. (Biome)
Example:
json { "linter": { "rules": { "correctness": { "noRestrictedGlobals": { "level": "error", "options": ["event", "fdescribe"] } } } } }
no-restricted-imports noRestrictedImports Biome has noRestrictedImports which maps to ESLint’s rule. (Biome)
Note: According to discussions, the patterns / paths options may be partially supported. (GitHub)
Example:
json { "linter": { "rules": { "correctness": { "noRestrictedImports": { "level":"error", "options": { "paths": { "old-module": { "message":"Use new-module instead" } } } } } } } }
@microsoft/sdl/no-document-write No built-in equivalent found This is a plugin rule (from eslint-plugin-microsoft-sdl) forbidding document.write. Biome doesn’t list a built-in rule covering document.write. You may need to implement a custom rule or disable this check.
@microsoft/sdl/no-inner-html lint/security/noDangerouslySetInnerHtml (React) or no exact generic built-in For React, Biome has noDangerouslySetInnerHtml under the lint/security domain, forbidding use of dangerouslySetInnerHTML. (Biome) But for generic innerHTML assignments in non-React contexts there may not be a built-in equivalent yet — you may need custom linting or plugin.
import/no-nodejs-modules No exact built-in equivalent found ESLint plugin rule forbids importing certain Node.js built-in modules (or disallowed modules). Biome doesn’t list a direct mapping for “no importing nodejs built-in modules” rule. You might approximate via noRestrictedImports, listing the built-ins as restricted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants