ESLint plugin providing MobX-specific linting rules for enforcing correct usage of makeObservable, makeAutoObservable, decorators, and observer in React components. Current stable version: 0.0.14. Supports ESLint 3–10 including flat config (ESLint 9+) and TypeScript via @typescript-eslint/parser. Key differentiator: catches common MobX footguns like missing makeObservable calls, non-exhaustive annotations, and missing observer wrappers, with autofix capabilities.
npm install eslint-plugin-mobxVerified import paths — ran on the pinned version, not inferred.
Shows both legacy (.eslintrc) and flat config (eslint.config.js) setups with recommended rules.
Use eslint.config.js with import syntax instead of .eslintrc.js with require.
Manually annotate such fields in makeObservable or use makeAutoObservable.
Migrate to eslint.config.js with flat config syntax.
Use overrides to limit rule to .jsx/.tsx files or adjust naming conventions.
Run autofix with --rule='mobx/exhaustive-make-observable: [2, { autofixAnnotation: false }]' to annotate with false.Add "type": "module" to package.json or rename file to .mjs.
Run npm install --save-dev eslint-plugin-mobx.
Use require() for legacy config or switch to flat config with .mjs extension.
Add 'mobx' to plugins: ['mobx'] in .eslintrc.js.