eslint-plugin-mobx-computed-getters
ESLint plugin that ensures MobX's computed methods are always getters.
@observable firstName = ''; @observable lastName = ''; // ESLint error: Computed methods should always be getters. Did you miss 'get' keyword? @computed { return ` `; }
Installation
npm i eslint-plugin-mobx-computed-getters
- Then in your
.eslintrc.json
file add the following line:
"plugins":
Now you can add the rule like so:
Usage with Create React App:
- Add
EXTEND_ESLINT=true
to your.env
file - Extend your
.eslintrc.json
file fromreact-app
config: