Skip to content

fix: properly scope rules to file types#86

Open
saberzero1 wants to merge 1 commit into
obsidianmd:masterfrom
saberzero1:properly-scope-rules
Open

fix: properly scope rules to file types#86
saberzero1 wants to merge 1 commit into
obsidianmd:masterfrom
saberzero1:properly-scope-rules

Conversation

@saberzero1
Copy link
Copy Markdown
Collaborator

@saberzero1 saberzero1 commented Nov 26, 2025

Summary

Splits the recommended config's rule sets so that rules requiring TypeScript type information only run on TypeScript files, while rules that don't need type info apply to both JS and TS files.

Problem

The recommended config applied all obsidianmd rules uniformly. Rules that call getParserServices (like no-plugin-as-component, no-view-references-in-plugin, prefer-file-manager-trash-file, prefer-instanceof, no-unsupported-api) would crash or produce misleading errors when run on plain JavaScript files that aren't parsed by @typescript-eslint/parser.

Changes

  • Split recommendedPluginRulesConfig into recommendedPluginRulesConfigBase (JS + TS) and recommendedPluginRulesConfigTypeChecked (TS only)
  • Separated package.json linting into its own packageJson config
  • Added stub configs for react and svelte
  • Regenerated documentation

@saberzero1 saberzero1 closed this Nov 26, 2025
@saberzero1 saberzero1 reopened this Nov 26, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 26, 2025
@saberzero1 saberzero1 closed this Nov 26, 2025
@saberzero1 saberzero1 reopened this Nov 26, 2025
@joethei
Copy link
Copy Markdown
Contributor

joethei commented Dec 4, 2025

The approach looks good.

@obsidianmd obsidianmd unlocked this conversation Dec 4, 2025
@saberzero1
Copy link
Copy Markdown
Collaborator Author

saberzero1 commented Dec 4, 2025

The approach looks good.

Alright. Thanks for confirming. I'll tidy up this PR tomorrow.

@saberzero1
Copy link
Copy Markdown
Collaborator Author

@joethei do we currently have any React/Svelte-specific rules? If not, do you want me to add stubs for those? Considering Obsidian's plugin tutorial has examples for both React and Svelte.

@joethei
Copy link
Copy Markdown
Contributor

joethei commented Jan 2, 2026

we don't have any specific rules, stubs would be nice.

@saberzero1 saberzero1 marked this pull request as ready for review May 9, 2026 15:00
@saberzero1
Copy link
Copy Markdown
Collaborator Author

@joethei apologies for the delay. Finally got around to addressing this.

- Split rule configurations into base (JS/TS) and type-checked (TS-only)
- Separate package.json checks from main configuration
- Add stubs for react and svelte configs
- Regenerated documentation
@saberzero1 saberzero1 force-pushed the properly-scope-rules branch from 0b40674 to b432677 Compare June 2, 2026 18:49
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.

2 participants